File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
tests/PHPStan/Rules/Arrays Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -101,4 +101,9 @@ public function testBug13013(): void
101101 $ this ->analyse ([__DIR__ . '/data/bug-13013.php ' ], []);
102102 }
103103
104+ public function testBug13022 (): void
105+ {
106+ $ this ->analyse ([__DIR__ . '/data/bug-13022.php ' ], []);
107+ }
108+
104109}
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug13022 ;
4+
5+ class RootClass
6+ {
7+ function getId (): int
8+ {
9+ return 1 ;
10+ }
11+ }
12+
13+ class SomeClass extends RootClass{
14+
15+ }
16+
17+ function test (RootClass $ object ): void
18+ {
19+
20+ $ searchId = $ object instanceof SomeClass ? 'uid ' : 'aid ' ;
21+ $ targetId = $ object instanceof SomeClass ? 'aid ' : 'uid ' ;
22+
23+ $ array = [
24+ $ searchId => $ object ->getId (),
25+ $ targetId => 'info ' ,
26+ ];
27+
28+ // sql()->insert('tablename', $array); - example how this will be used
29+ }
You can’t perform that action at this time.
0 commit comments