Skip to content

Commit

Permalink
Match more types of ray calls
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandijck committed Jan 15, 2024
1 parent 9b12be1 commit 835086c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Rector/RemoveRayCallRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use PhpParser\Node;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Stmt\Expression;
use PhpParser\NodeTraverser;
use Rector\Core\Contract\Rector\RectorInterface;
Expand Down Expand Up @@ -34,14 +35,18 @@ public function refactor(Node $node): ?int
{
$expr = $node->expr;

if (! $expr instanceof FuncCall) {
if (! $expr instanceof FuncCall && !$expr instanceof MethodCall) {
return null;
}

if (! $this->isName($expr->name, 'ray')) {
return null;
if ($this->isName($expr->name, 'ray')) {
return NodeTraverser::REMOVE_NODE;
}

if ($expr->var->name->parts && in_array('ray', $expr->var->name->parts)) {
return NodeTraverser::REMOVE_NODE;
}

return NodeTraverser::REMOVE_NODE;
return null;
}
}

0 comments on commit 835086c

Please sign in to comment.