File tree Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Expand file tree Collapse file tree 1 file changed +19
-15
lines changed Original file line number Diff line number Diff line change 55use Closure ;
66use PHPStan \Testing \PHPStanTestCase ;
77use PHPUnit \Framework \Attributes \DataProvider ;
8+ use const PHP_VERSION_ID ;
89
910/**
1011 * @phpstan-consistent-constructor
1112 */
1213class ClosureTypeFactoryTest extends PHPStanTestCase
1314{
1415
15- public static function dataFromClosureObjectReturnType (): array
16+ public static function dataFromClosureObjectReturnType (): iterable
1617 {
17- return [
18- [static function (): void {
19- }, 'void ' ],
20- [static function () { // @phpcs:ignore
21- }, 'mixed ' ],
22- [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- ],
18+ yield [static function (): void {
19+ }, 'void ' ];
20+ yield [static function () { // @phpcs:ignore
21+ }, 'mixed ' ];
22+ yield [static fn (): int => 5 , 'int ' ];
23+ yield [
24+ static fn (): self => new self ('name ' ),
25+ self ::class,
26+ ];
27+
28+ if (PHP_VERSION_ID < 80000 ) {
29+ return ;
30+ }
31+
32+ yield [
33+ static fn (): static => new static ('name ' ),
34+ 'static( ' . self ::class . ') ' ,
3135 ];
3236 }
3337
You can’t perform that action at this time.
0 commit comments