Skip to content

Commit 3bfce41

Browse files
committed
re-use logic from preparational PR
1 parent bd5720a commit 3bfce41

File tree

1 file changed

+3
-27
lines changed

1 file changed

+3
-27
lines changed

src/Analyser/MutatingScope.php

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3762,36 +3762,12 @@ private function enterAnonymousFunctionWithoutReflection(
37623762
foreach ($nonStaticExpressions as $exprString => $typeHolder) {
37633763
$expr = $typeHolder->getExpr();
37643764

3765-
if (
3766-
!$expr instanceof PropertyFetch
3767-
) {
3765+
if (!$expr instanceof PropertyFetch) {
37683766
continue;
37693767
}
37703768

3771-
while ($expr instanceof PropertyFetch) {
3772-
if ($expr->var instanceof Variable) {
3773-
if (
3774-
! $expr->name instanceof Node\Identifier
3775-
|| !is_string($expr->var->name)
3776-
|| $expr->var->name !== 'this'
3777-
) {
3778-
continue 2;
3779-
}
3780-
} elseif (!$expr->var instanceof PropertyFetch) {
3781-
continue 2;
3782-
}
3783-
3784-
$propertyReflection = $this->propertyReflectionFinder->findPropertyReflectionFromNode($expr, $this);
3785-
if ($propertyReflection === null) {
3786-
continue 2;
3787-
}
3788-
3789-
$nativePropertyReflection = $propertyReflection->getNativeReflection();
3790-
if ($nativePropertyReflection === null || !$nativePropertyReflection->isReadOnly()) {
3791-
continue 2;
3792-
}
3793-
3794-
$expr = $expr->var;
3769+
if (!$this->isReadonlyPropertyFetchOnThis($expr)) {
3770+
continue;
37953771
}
37963772

37973773
$expressionTypes[$exprString] = $typeHolder;

0 commit comments

Comments
 (0)