getIndexer('function'); if ($indexer->has('hook_form_alter')) { $violations[] = $indexer->get('hook_form_alter'); } $id = $target->id() . '_form_%_alter'; // Until kernel tests are run in PHPUnit, we need to check for // the existence of db_like(). if (function_exists('db_like')) { $id = db_like($id); } $alter_hooks = $target ->getIndexer('function') ->getQuery() ->condition('id', $id, 'LIKE') ->execute(); foreach ($alter_hooks as $alter_hook) { $violations[] = $target ->open($alter_hook->file) ->find(Filter::isFunction($alter_hook->id)); } $issues = []; if ($violations) { $issue = $this->buildIssue($target); array_walk($violations, function(FunctionDeclarationNode $function) use ($issue) { $issue->addViolation($function, $this); }); $issues[] = $issue; } return $issues; } }