Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Rector\Tests\CodingStyle\Rector\ClassMethod\BinaryOpStandaloneAssignsToDirectRector\Fixture;

use CodingStyle\Rector\ClassMethod\BinaryOpStandaloneAssignsToDirectRector\Source\SomeGetter;

final class SkipAnyCallLikeWithArgs
{
public function run(SomeGetter $firstSomeGetter, SomeGetter $secondSomeGetter)
{
$first = $firstSomeGetter::getSome($arg, $arg2, $arg3, $arg4, $arg5, $arg6);
$second = $secondSomeGetter::getSome($arg, $arg2, $arg3, $arg4, $arg5, $arg6);

return $first <=> $second;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use PhpParser\Node;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\ClassMethod;
Expand Down Expand Up @@ -133,7 +133,7 @@ private function matchToVariableAssignExpr(Stmt $stmt): ?VariableAndExprAssign
}

// skip complex cases
if ($assign->expr instanceof MethodCall && $assign->expr->args !== []) {
if ($assign->expr instanceof CallLike && ! $assign->expr->isFirstClassCallable() && $assign->expr->getArgs() !== []) {
return null;
}

Expand Down