Skip to content

Commit 055fb6b

Browse files
phpstan-botclaude
andcommitted
Add assertType for modify() on union DateTimeImmutable subclasses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b30da34 commit 055fb6b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/PHPStan/Analyser/nsrt/date-format.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ function (?\DateTimeImmutable $d): void {
4848
assertType('DateTimeImmutable', $d->modify('+1 day'));
4949
assertType('DateTimeImmutable|null', $d?->modify('+1 day'));
5050
};
51+
52+
class Foo extends \DateTimeImmutable {}
53+
class Bar extends \DateTimeImmutable {}
54+
55+
function (Foo|Bar $d): void {
56+
assertType('DateFormatReturnType\Bar|DateFormatReturnType\Foo', $d->modify('+1 day'));
57+
};

0 commit comments

Comments
 (0)