File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed
tests/PHPStan/Rules/Properties Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -1221,16 +1221,21 @@ public function testBug13537(): void
12211221 $ this ->checkThisOnly = false ;
12221222 $ this ->checkUnionTypes = true ;
12231223 $ this ->checkDynamicProperties = true ;
1224- $ this ->analyse ([__DIR__ . '/data/bug-13537.php ' ], [
1225- [
1226- 'Cannot access property $bob on array<string, mixed>. ' ,
1227- 25 ,
1228- ],
1229- [
1230- 'Access to protected property Bug13537\Bar::$test. ' ,
1231- 25 ,
1232- ],
1233- ]);
1224+
1225+ $ errors = [];
1226+ if (PHP_VERSION_ID >= 80200 ) {
1227+ $ errors = [
1228+ [
1229+ 'Cannot access property $bob on array<string, mixed>. ' ,
1230+ 26 ,
1231+ ],
1232+ [
1233+ 'Access to protected property Bug13537\Bar::$test. ' ,
1234+ 26 ,
1235+ ],
1236+ ];
1237+ }
1238+ $ this ->analyse ([__DIR__ . '/data/bug-13537.php ' ], $ errors );
12341239 }
12351240
12361241}
Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ class Bar extends Foo
2222}
2323
2424function (): void {
25- $ bob = new Bar ()->test ->bob ;
25+ $ bar = new Bar ();
26+ $ bob = $ bar ->test ->bob ;
2627};
2728
2829class BaseModel
You can’t perform that action at this time.
0 commit comments