Skip to content
Discussion options

You must be logged in to vote

You need to replace whole Expresssion for that:

First, define the node types as Expression stmt:

    public function getNodeTypes(): array
    {
        return [\PhpParser\Node\Stmt\Expression::class];
    }

Next, verify if the node expr is match with Assign

    /**
     * @param \PhpParser\Node\Stmt\Expression $node
     */
    public function refactor(Node $node): ?Node
    {
        if (! $node->expr instanceof \PhpParser\Node\Expr\Assign) {
            return null;
        }

        if (! $node->expr->expr instanceof \PhpParser\Node\Expr\FuncCall) {
            return null;
        }

        if (! $this->nodeNameResolver->isName($node->expr->expr, 'user_password')) {
            return

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@mglaman
Comment options

@samsonasik
Comment options

Answer selected by samsonasik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants