Skip to content

Commit ee5ee65

Browse files
committed
Fix build
1 parent 5772b1a commit ee5ee65

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff 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
}

tests/PHPStan/Rules/Properties/data/bug-13537.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class Bar extends Foo
2222
}
2323

2424
function (): void {
25-
$bob = new Bar()->test->bob;
25+
$bar = new Bar();
26+
$bob = $bar->test->bob;
2627
};
2728

2829
class BaseModel

0 commit comments

Comments
 (0)