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
1221
1221
$ this ->checkThisOnly = false ;
1222
1222
$ this ->checkUnionTypes = true ;
1223
1223
$ 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 );
1234
1239
}
1235
1240
1236
1241
}
Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ class Bar extends Foo
22
22
}
23
23
24
24
function (): void {
25
- $ bob = new Bar ()->test ->bob ;
25
+ $ bar = new Bar ();
26
+ $ bob = $ bar ->test ->bob ;
26
27
};
27
28
28
29
class BaseModel
You can’t perform that action at this time.
0 commit comments