mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 06:18:07 +01:00
[Generic] skip static method in FuncCallToMethodCallRector (#3901)
This commit is contained in:
parent
b2054a32fc
commit
f322e4110c
@ -9,6 +9,7 @@ use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\RectorDefinition\ConfiguredCodeSample;
|
||||
@ -112,6 +113,15 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
|
||||
$classMethod = $node->getAttribute(AttributeKey::METHOD_NODE);
|
||||
if (! $classMethod instanceof ClassMethod) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($classMethod->isStatic()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach ($this->functionToClassToMethod as $function => $classMethod) {
|
||||
if (! $this->isName($node->name, $function)) {
|
||||
continue;
|
||||
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Generic\Tests\Rector\FuncCall\FuncCallToMethodCallRector\Fixture;
|
||||
|
||||
use function Rector\Generic\Tests\Rector\FuncCall\FuncCallToMethodCallRector\Source\some_view_function;
|
||||
|
||||
final class SkipStaticMethod
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
$result = \translate('name');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user