Using Rector, I'm trying to convert the following.
$integer = some_made_up_function_call($parm1, $parm2);
Enter this:
$integer = $parm1->made_up_method_call($parm2)['hard_coded_index'];
My problem is with the last ['hard_coded_index']
. I don't know how to do this. What I have so far is.
public function refactor(Node $node): ?Node { if (! $this->isName($node->name, 'some_made_up_function_call')) { return null; } $firstParameter = new Node\Expr\Variable($node->args[0]->value->name); return new Node\Expr\MethodCall( $firstParameter, 'made_up_method_call', [$node->args[1]] ); }
好吧,我明白了...