Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e9556fb

Browse files
Fix test
1 parent ab854bb commit e9556fb

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

‎tests/PHPStan/Type/ClosureTypeFactoryTest.php

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,33 @@
55
use Closure;
66
use PHPStan\Testing\PHPStanTestCase;
77
use PHPUnit\Framework\Attributes\DataProvider;
8+
use const PHP_VERSION_ID;
89

910
/**
1011
* @phpstan-consistent-constructor
1112
*/
1213
class 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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /