File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
tests/PHPStan/Rules/Methods Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -3900,6 +3900,14 @@ public function testBug6120(): void
39003900 $ this ->analyse ([__DIR__ . '/data/bug-6120.php ' ], []);
39013901 }
39023902
3903+ public function testBug1501 (): void
3904+ {
3905+ $ this ->checkThisOnly = false ;
3906+ $ this ->checkNullables = true ;
3907+ $ this ->checkUnionTypes = true ;
3908+ $ this ->analyse ([__DIR__ . '/data/bug-1501.php ' ], []);
3909+ }
3910+
39033911 public function testBug11463 (): void
39043912 {
39053913 $ this ->checkThisOnly = false ;
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug1501 ;
4+
5+ class HelloWorld
6+ {
7+ public function sayHello (): void
8+ {
9+ $ so = new SomeObject ();
10+ $ this ->modify ($ so ->getForModify ());
11+ }
12+
13+ private function modify (array &$ data ): void
14+ {
15+ $ data [] = 'abc ' ;
16+ }
17+ }
18+
19+ class SomeObject
20+ {
21+ private $ someVar ;
22+
23+ public function __construct ()
24+ {
25+ $ this ->someVar = [];
26+ }
27+
28+ public function &getForModify (): array
29+ {
30+ return $ this ->someVar ;
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments