File tree Expand file tree Collapse file tree 4 files changed +50
-8
lines changed
Expand file tree Collapse file tree 4 files changed +50
-8
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class TypesAssignedToPropertiesRuleTest extends RuleTestCase
1414{
1515
1616 private bool $ checkExplicitMixed = false ;
17+
1718 private bool $ checkImplicitMixed = false ;
1819
1920 protected function getRule (): Rule
@@ -796,4 +797,14 @@ public function testBug8825(): void
796797 $ this ->analyse ([__DIR__ . '/data/bug-8825.php ' ], []);
797798 }
798799
800+ public function testBug7844 (): void
801+ {
802+ $ this ->analyse ([__DIR__ . '/data/bug-7844.php ' ], []);
803+ }
804+
805+ public function testBug7844b (): void
806+ {
807+ $ this ->analyse ([__DIR__ . '/data/bug-7844b.php ' ], []);
808+ }
809+
799810}
Original file line number Diff line number Diff line change @@ -12,11 +12,8 @@ class C
1212
1313 public function foo (): void
1414 {
15- \PHPStan \dumpType ($ this ->data );
1615 if (count ($ this ->data ) > 0 ) {
17- \PHPStan \dumpType ($ this ->data );
1816 $ this ->val = array_shift ($ this ->data );
19- \PHPStan \dumpType ($ this ->val );
2017 }
2118 }
2219}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug7844b ;
4+
5+ class Obj {}
6+
7+ class HelloWorld
8+ {
9+ public Obj $ p1 ;
10+ public Obj $ p2 ;
11+ public Obj $ p3 ;
12+ public Obj $ p4 ;
13+ public Obj $ p5 ;
14+
15+ /** @param non-empty-list<Obj> $objs */
16+ public function __construct (array $ objs )
17+ {
18+ \assert ($ objs !== []);
19+ $ this ->p1 = $ objs [0 ];
20+
21+ \assert ($ objs !== []);
22+ $ this ->p2 = $ objs [array_key_last ($ objs )];
23+
24+ \assert ($ objs !== []);
25+ $ this ->p3 = \array_pop ($ objs );
26+
27+ \assert ($ objs !== []);
28+ $ this ->p4 = \array_shift ($ objs );
29+
30+ \assert ($ objs !== []);
31+ $ p = \array_shift ($ objs );
32+ $ this ->p5 = $ p ;
33+
34+ \assert ($ objs !== []);
35+ $ this ->doSomething (\array_pop ($ objs ));
36+ }
37+
38+ private function doSomething (Obj $ obj ): void {}
39+ }
Original file line number Diff line number Diff line change @@ -74,9 +74,4 @@ public function testBug13093b(): void
7474 $ this ->analyse ([__DIR__ . '/data/bug-13093b.php ' ], []);
7575 }
7676
77- public function testBug7844 (): void
78- {
79- $ this ->analyse ([__DIR__ . '/data/bug-7844.php ' ], []);
80- }
81-
8277}
You can’t perform that action at this time.
0 commit comments