mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-21 01:41:00 +01:00
This commit is contained in:
parent
8e915ebe9b
commit
9e731713b6
@ -6,6 +6,7 @@ namespace Rector\Naming\Guard;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Nette\Utils\Strings;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\FunctionLike;
|
||||
@ -155,7 +156,17 @@ final class BreakingVariableRenameGuard
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->isDateTimeAtNamingConvention($param);
|
||||
if ($this->isDateTimeAtNamingConvention($param)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (bool) $this->betterNodeFinder->find((array) $classMethod->stmts, function (Node $node) use ($expectedName): bool {
|
||||
if (! $node instanceof Variable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->nodeNameResolver->isName($node, $expectedName);
|
||||
});
|
||||
}
|
||||
|
||||
private function isVariableAlreadyDefined(Variable $variable, string $currentVariableName): bool
|
||||
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Naming\Tests\Rector\ClassMethod\RenameParamToMatchTypeRector\Fixture;
|
||||
|
||||
final class SkipUsed
|
||||
{
|
||||
public function run(Node $nd)
|
||||
{
|
||||
$this->betterNodeFinder->find($nd->stmts, function (Node $node) use ($nd) {
|
||||
return $nd !== $node;
|
||||
});
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user