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
14
14
{
15
15
16
16
private bool $ checkExplicitMixed = false ;
17
+
17
18
private bool $ checkImplicitMixed = false ;
18
19
19
20
protected function getRule (): Rule
@@ -796,4 +797,14 @@ public function testBug8825(): void
796
797
$ this ->analyse ([__DIR__ . '/data/bug-8825.php ' ], []);
797
798
}
798
799
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
+
799
810
}
Original file line number Diff line number Diff line change @@ -12,11 +12,8 @@ class C
12
12
13
13
public function foo (): void
14
14
{
15
- \PHPStan \dumpType ($ this ->data );
16
15
if (count ($ this ->data ) > 0 ) {
17
- \PHPStan \dumpType ($ this ->data );
18
16
$ this ->val = array_shift ($ this ->data );
19
- \PHPStan \dumpType ($ this ->val );
20
17
}
21
18
}
22
19
}
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
74
74
$ this ->analyse ([__DIR__ . '/data/bug-13093b.php ' ], []);
75
75
}
76
76
77
- public function testBug7844 (): void
78
- {
79
- $ this ->analyse ([__DIR__ . '/data/bug-7844.php ' ], []);
80
- }
81
-
82
77
}
You can’t perform that action at this time.
0 commit comments