Skip to content

Commit

Permalink
[NodeManipulator] Reduce parent check on PropertyManipulator (#4397)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jul 1, 2023
1 parent b8129b4 commit 5944b6d
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/NodeManipulator/PropertyManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\PostDec;
use PhpParser\Node\Expr\PostInc;
use PhpParser\Node\Expr\PreDec;
use PhpParser\Node\Expr\PreInc;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\StaticPropertyFetch;
Expand All @@ -31,7 +27,6 @@
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\Core\PhpParser\NodeFinder\PropertyFetchFinder;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\Core\Util\MultiInstanceofChecker;
use Rector\Core\ValueObject\MethodName;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
Expand Down Expand Up @@ -72,8 +67,7 @@ public function __construct(
private readonly PromotedPropertyResolver $promotedPropertyResolver,
private readonly ConstructorAssignDetector $constructorAssignDetector,
private readonly ClassLikeAstResolver $classLikeAstResolver,
private readonly PropertyFetchAnalyzer $propertyFetchAnalyzer,
private readonly MultiInstanceofChecker $multiInstanceofChecker
private readonly PropertyFetchAnalyzer $propertyFetchAnalyzer
) {
}

Expand Down Expand Up @@ -192,13 +186,6 @@ private function isChangeableContext(PropertyFetch | StaticPropertyFetch $proper
return false;
}

if ($this->multiInstanceofChecker->isInstanceOf(
$parentNode,
[PreInc::class, PreDec::class, PostInc::class, PostDec::class]
)) {
$parentNode = $parentNode->getAttribute(AttributeKey::PARENT_NODE);
}

if ($parentNode instanceof Arg) {
$readArg = $this->variableToConstantGuard->isReadArg($parentNode);
if (! $readArg) {
Expand Down

0 comments on commit 5944b6d

Please sign in to comment.