mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-26 12:52:36 +00:00
fix incorrect varialbe name
This commit is contained in:
parent
8976681b20
commit
d3295a7d1e
|
@ -49,7 +49,7 @@ final class ContextAnalyzer
|
|||
}
|
||||
|
||||
foreach (self::LOOP_NODES as $type) {
|
||||
if (is_a($node, $type, true)) {
|
||||
if (is_a($firstParent, $type, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ParamTypeDeclarationRector::class);
|
||||
};
|
||||
|
|
|
@ -62,7 +62,11 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
$tempVarName = $this->variableNaming->resolveFromNodeWithScopeCountAndFallbackName($node->var, $node->getAttribute(AttributeKey::SCOPE), '_');
|
||||
$tempVarName = $this->variableNaming->resolveFromNodeWithScopeCountAndFallbackName(
|
||||
$node->var,
|
||||
$node->getAttribute(AttributeKey::SCOPE),
|
||||
'_'
|
||||
);
|
||||
$tempVar = new Node\Expr\Variable($tempVarName);
|
||||
$called = $node instanceof NullsafeMethodCall
|
||||
? new MethodCall($tempVar, $node->name, $node->args)
|
||||
|
|
|
@ -50,7 +50,10 @@ final class RenameMethodRector extends AbstractRector implements ConfigurableRec
|
|||
*/
|
||||
private $methodCallRenameCollector;
|
||||
|
||||
public function __construct(ClassManipulator $classManipulator, MethodCallRenameCollector $methodCallRenameCollector)
|
||||
public function __construct(
|
||||
ClassManipulator $classManipulator,
|
||||
MethodCallRenameCollector $methodCallRenameCollector
|
||||
)
|
||||
{
|
||||
$this->classManipulator = $classManipulator;
|
||||
$this->methodCallRenameCollector = $methodCallRenameCollector;
|
||||
|
|
|
@ -101,7 +101,7 @@ final class BetterNodeFinder
|
|||
|
||||
do {
|
||||
foreach ($types as $type) {
|
||||
if (is_a($node, $type, true)) {
|
||||
if (is_a($parent, $type, true)) {
|
||||
return $parent;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user