items) !== 2) { return null; } $firstItem = $array->items[0]; $secondItem = $array->items[1]; if (!$firstItem instanceof \PhpParser\Node\Expr\ArrayItem) { return null; } if (!$secondItem instanceof \PhpParser\Node\Expr\ArrayItem) { return null; } if (!$secondItem->value instanceof \PhpParser\Node\Scalar\String_) { return null; } if (!$firstItem->value instanceof \PhpParser\Node\Expr\PropertyFetch && !$firstItem->value instanceof \PhpParser\Node\Expr\Variable) { return null; } $string = $secondItem->value; $methodName = $string->value; return new \PhpParser\Node\Expr\MethodCall($firstItem->value, $methodName); } }