rewriters = $rewriters; } /** * {@inheritdoc} */ public function convert(TargetInterface $target) { /** @var \Pharborist\Functions\FunctionDeclarationNode $function */ $function = $target->getIndexer('function')->get('hook_user_login'); // The $edit parameter is defunct in Drupal 8, but we'll leave it in // there as an empty array to prevent errors, and move it to the back // of the line. /** @var \Pharborist\Functions\ParameterNode $edit */ $edit = $function->getParameterList()->shift()->setReference(FALSE)->setValue(ArrayNode::create([])); $function->appendParameter($edit); // Slap a FIXME on the hook implementation, informing the developer that // $edit and $category are dead. $comment = $function->getDocComment(); $comment_text = $comment ? $comment->getCommentText() : ''; if ($comment_text) { $comment_text .= "\n\n"; } $comment_text .= <<<'END' @FIXME The $edit parameter is gone in Drupal 8. It has been left here in order to prevent 'undefined variable' errors, but it will never actually be passed to this hook. You'll need to modify this function and remove every reference to it. END; $function->setDocComment(DocCommentNode::create($comment_text)); $rewriter = $this->rewriters->createInstance('_rewriter:user'); $this->rewriteFunction($rewriter, $function->getParameterAtIndex(0), $target); $target->save($function); } }