Skip to content

Commit e1b12a1

Browse files
committed
fix dynamic property variant
1 parent 228a0d1 commit e1b12a1

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5674,7 +5674,7 @@ static function (): void {
56745674
} else {
56755675
// fallback
56765676
$assignedExprType = $scope->getType($assignedExpr);
5677-
$nodeCallback(new PropertyAssignNode($var, $assignedExpr, $isAssignOp), $scope);
5677+
$nodeCallback(new PropertyAssignNode($var, $assignedExpr, $isAssignOp), $scopeBeforeAssignEval);
56785678
$scope = $scope->assignExpression($var, $assignedExprType, $scope->getNativeType($assignedExpr));
56795679
// simulate dynamic property assign by __set to get throw points
56805680
if (!$propertyHolderType->hasMethod('__set')->no()) {

tests/PHPStan/Rules/Properties/data/bug-13093c.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,24 @@ public function fillBucketOnce(array &$killer): int
2626

2727
}
2828

29+
final class ParallelProcessRunner2
30+
{
31+
/**
32+
* @var array<int, string>
33+
*/
34+
private array $nextMutantProcessKillerContainer = [];
35+
36+
private string $prop;
37+
38+
public function fillBucketOnce(array &$killer): int
39+
{
40+
$name = 'prop';
41+
if ($this->nextMutantProcessKillerContainer !== []) {
42+
$this->{$name} = array_shift($this->nextMutantProcessKillerContainer);
43+
}
44+
45+
return 0;
46+
}
47+
48+
}
49+

tests/PHPStan/Rules/Properties/data/bug-13093d.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function fillBucketOnce(array &$killer): int
2626

2727
}
2828

29-
final class ParallelProcessRunner
29+
final class ParallelProcessRunner2
3030
{
3131
/**
3232
* @var array<int, string>

0 commit comments

Comments
 (0)