3 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer;
5 use Drupal\drupalmoduleupgrader\AnalyzerBase;
6 use Drupal\drupalmoduleupgrader\TargetInterface;
8 use Pharborist\Functions\FunctionCallNode;
12 * id = "hook_uninstall",
13 * description = @Translation("Removes variable_del() calls from hook_uninstall()."),
14 * message = @Translation("Default configuration is deleted automatically."),
16 * "category" = { "config" },
17 * "error_level" = "warning"
19 * hook = "hook_uninstall"
22 class HookUninstall extends AnalyzerBase {
27 public function analyze(TargetInterface $target) {
28 $indexer = $target->getIndexer('function');
31 if ($indexer->has('hook_uninstall')) {
32 /** @var \Pharborist\NodeCollection $variable_del */
33 $variable_del = $indexer->get('hook_uninstall')->find(Filter::isFunctionCall('variable_del'));
35 if (sizeof($variable_del) > 0) {
36 $issue = $this->buildIssue($target);
37 $variable_del->each(function(FunctionCallNode $function_call) use ($issue) {
38 $issue->addViolation($function_call, $this);