Skip to content

Commit af3f105

Browse files
committed
Test ClosureTypeFactory return type fix
1 parent 8dcc4a6 commit af3f105

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/PHPStan/Type/ClosureTypeFactoryTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use PHPStan\Testing\PHPStanTestCase;
77
use PHPUnit\Framework\Attributes\DataProvider;
88

9+
/**
10+
* @phpstan-consistent-constructor
11+
*/
912
class ClosureTypeFactoryTest extends PHPStanTestCase
1013
{
1114

@@ -17,6 +20,14 @@ public static function dataFromClosureObjectReturnType(): array
1720
[static function () { // @phpcs:ignore
1821
}, 'mixed'],
1922
[static fn (): int => 5, 'int'],
23+
[
24+
static fn (): self => new self('name'),
25+
self::class,
26+
],
27+
[
28+
static fn (): static => new static('name'),
29+
'static(' . self::class . ')',
30+
],
2031
];
2132
}
2233

0 commit comments

Comments
 (0)