Skip to content

Commit c540180

Browse files
committed
re-use logic from preparational PR
1 parent 2422f94 commit c540180

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
@@ -3769,36 +3769,12 @@ private function enterAnonymousFunctionWithoutReflection(
37693769
foreach ($nonStaticExpressions as $exprString => $typeHolder) {
37703770
$expr = $typeHolder->getExpr();
37713771

3772-
if (
3773-
!$expr instanceof PropertyFetch
3774-
) {
3772+
if (!$expr instanceof PropertyFetch) {
37753773
continue;
37763774
}
37773775

3778-
while ($expr instanceof PropertyFetch) {
3779-
if ($expr->var instanceof Variable) {
3780-
if (
3781-
! $expr->name instanceof Node\Identifier
3782-
|| !is_string($expr->var->name)
3783-
|| $expr->var->name !== 'this'
3784-
) {
3785-
continue 2;
3786-
}
3787-
} elseif (!$expr->var instanceof PropertyFetch) {
3788-
continue 2;
3789-
}
3790-
3791-
$propertyReflection = $this->propertyReflectionFinder->findPropertyReflectionFromNode($expr, $this);
3792-
if ($propertyReflection === null) {
3793-
continue 2;
3794-
}
3795-
3796-
$nativePropertyReflection = $propertyReflection->getNativeReflection();
3797-
if ($nativePropertyReflection === null || !$nativePropertyReflection->isReadOnly()) {
3798-
continue 2;
3799-
}
3800-
3801-
$expr = $expr->var;
3776+
if (!$this->isReadonlyPropertyFetchOnThis($expr)) {
3777+
continue;
38023778
}
38033779

38043780
$expressionTypes[$exprString] = $typeHolder;

0 commit comments

Comments
 (0)