Skip to content

Conversation

@driftingly
Copy link
Owner

This PR moves the ArgumentFuncCallToMethodCallRector class from Rector to Rector Laravel.

See rectorphp/rector-src#3774 (comment)

}

/** @var Class_ $classLike */
$classLike = $this->betterNodeFinder->findParentType($node, Class_::class);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of find parent type, it is better to use Class_ node, and traverser its methods, something like this:

        $hasChanged = false;
        $this->traverseNodesWithCallable($node->getMethods(), function (Node $node) use (
            &$hasChanged
        ) {
                if ($node instanceof  FuncCall) {
                       $result = $this->refactorFuncCallToMethodCall($node);
                       if ($result instanceof MethodCall) {
                              $hasChanged = true;
                              return $result;
                       }

                       return null;
                }

                return null;
        });

        if ($hasChanged) {
              return $node;
        }

        return null;

@driftingly driftingly force-pushed the adc/add-arg-func-call branch from 4a09d70 to 451d8cd Compare June 7, 2023 15:45
@driftingly driftingly force-pushed the adc/add-arg-func-call branch from 451d8cd to b1a6f8b Compare June 7, 2023 15:47
@driftingly driftingly removed the request for review from TomasVotruba June 23, 2023 18:58
@driftingly driftingly merged commit ba22ffb into main Jun 23, 2023
@driftingly driftingly deleted the adc/add-arg-func-call branch June 23, 2023 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants