File tree Expand file tree Collapse file tree 4 files changed +122
-0
lines changed
tests/PHPStan/Rules/Methods Expand file tree Collapse file tree 4 files changed +122
-0
lines changed Original file line number Diff line number Diff line change @@ -568,4 +568,37 @@ public function testGenericStaticType(): void
568568$ this ->analyse ([__DIR__ . '/data/method-signature-generic-static-type.php ' ], []);
569569}
570570
571+ public function testBug10240 (): void
572+ {
573+ if (PHP_VERSION_ID < 80000 ) {
574+ $ this ->markTestSkipped ('Test requires PHP 8.0. ' );
575+ }
576+
577+ $ this ->reportMaybes = true ;
578+ $ this ->reportStatic = true ;
579+ $ this ->analyse ([__DIR__ . '/data/bug-10240.php ' ], []);
580+ }
581+
582+ public function testBug10488 (): void
583+ {
584+ if (PHP_VERSION_ID < 80000 ) {
585+ $ this ->markTestSkipped ('Test requires PHP 8.0. ' );
586+ }
587+
588+ $ this ->reportMaybes = true ;
589+ $ this ->reportStatic = true ;
590+ $ this ->analyse ([__DIR__ . '/data/bug-10488.php ' ], []);
591+ }
592+
593+ public function testBug12073 (): void
594+ {
595+ if (PHP_VERSION_ID < 80000 ) {
596+ $ this ->markTestSkipped ('Test requires PHP 8.0. ' );
597+ }
598+
599+ $ this ->reportMaybes = true ;
600+ $ this ->reportStatic = true ;
601+ $ this ->analyse ([__DIR__ . '/data/bug-12073.php ' ], []);
602+ }
603+
571604}
Original file line number Diff line number Diff line change 1+ <?php // lint >= 8.0
2+
3+ namespace Bug10240 ;
4+
5+ interface MyInterface
6+ {
7+ /**
8+ * @phpstan-param truthy-string $truthyStrParam
9+ */
10+ public function doStuff (
11+ string $ truthyStrParam ,
12+ ): void ;
13+ }
14+
15+ trait MyTrait
16+ {
17+ /**
18+ * @phpstan-param truthy-string $truthyStrParam
19+ */
20+ abstract public function doStuff (
21+ string $ truthyStrParam ,
22+ ): void ;
23+ }
24+
25+ class MyClass implements MyInterface
26+ {
27+ use MyTrait;
28+
29+ public function doStuff (
30+ string $ truthyStrParam ,
31+ ): void
32+ {
33+ // ...
34+ }
35+ }
Original file line number Diff line number Diff line change 1+ <?php // lint >= 8.0
2+
3+ namespace Bug10488 ;
4+
5+ trait Bar
6+ {
7+ /**
8+ * @param array<string,mixed> $data
9+ */
10+
11+ abstract protected function test (array $ data ): void ;
12+ }
13+
14+ abstract class Foo
15+ {
16+ use Bar;
17+ }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug12073 ;
4+
5+ trait HasFieldBuildersTrait
6+ {
7+ /**
8+ * @param array<string,mixed> $field
9+ */
10+ abstract public function field (array $ field ): static ;
11+ }
12+
13+ class GroupBuilder
14+ {
15+ use HasFieldBuildersTrait;
16+
17+ /** @var array<string,mixed> */
18+ private array $ group = [];
19+
20+ private function __construct ()
21+ {
22+ }
23+
24+ /**
25+ * @param array<string,mixed> $field
26+ */
27+ public function field (array $ field ): static
28+ {
29+ if (! is_array ($ this ->group ['fields ' ] ?? null )) {
30+ $ this ->group ['fields ' ] = [];
31+ }
32+
33+ $ this ->group ['fields ' ][] = $ field ;
34+
35+ return $ this ;
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments