File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
tests/PHPStan/Rules/Classes Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -586,4 +586,13 @@ public function testBug12951(): void
586586 ]);
587587 }
588588
589+ public function testNamedArgumentsPhpversion (): void
590+ {
591+ if (PHP_VERSION_ID < 80000 ) {
592+ self ::markTestSkipped ('Test requires PHP 8.0 ' );
593+ }
594+
595+ $ this ->analyse ([__DIR__ . '/data/named-arguments-phpversion.php ' ], []);
596+ }
597+
589598}
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace NamedArgumentsPhpversion ;
4+
5+ use Exception ;
6+
7+ class HelloWorld
8+ {
9+ /** @return mixed[] */
10+ public function sayHello (): array |null
11+ {
12+ if (PHP_VERSION_ID >= 80400 ) {
13+ } else {
14+ }
15+ return [
16+ new Exception (previous: new Exception ()),
17+ ];
18+ }
19+ }
20+
21+ class HelloWorld2
22+ {
23+ /** @return mixed[] */
24+ public function sayHello (): array |null
25+ {
26+ return [
27+ PHP_VERSION_ID >= 80400 ? 1 : 0 ,
28+ new Exception (previous: new Exception ()),
29+ ];
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments