Skip to content

Commit

Permalink
[DeadCode] Skip dynamic name on RemoveParentCallWithoutParentRector
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jan 6, 2025
1 parent b833a75 commit 817d0bf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Rector\Tests\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector\Fixture;

use Rector\Tests\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector\Source\SomeParentMethod;

class SkipDynamicCallName extends SomeParentMethod
{
public function innerSearchService(string $function, array $args): mixed
{
$result = parent::{$function}(...$args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ private function isParentStaticCall(Expr $expr): bool
return false;
}

if ($expr->name instanceof Expr) {
return false;
}

return $this->isName($expr->class, ObjectReference::PARENT);
}

Expand Down

0 comments on commit 817d0bf

Please sign in to comment.