HookUninstall.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Plugin/DMU/Analyzer/HookUninstall.php
View source
<?php
namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer;
use Drupal\drupalmoduleupgrader\AnalyzerBase;
use Drupal\drupalmoduleupgrader\TargetInterface;
use Pharborist\Filter;
use Pharborist\Functions\FunctionCallNode;
class HookUninstall extends AnalyzerBase {
public function analyze(TargetInterface $target) {
$indexer = $target
->getIndexer('function');
$issues = [];
if ($indexer
->has('hook_uninstall')) {
$variable_del = $indexer
->get('hook_uninstall')
->find(Filter::isFunctionCall('variable_del'));
if (sizeof($variable_del) > 0) {
$issue = $this
->buildIssue($target);
$variable_del
->each(function (FunctionCallNode $function_call) use ($issue) {
$issue
->addViolation($function_call, $this);
});
$issues[] = $issue;
}
}
return $issues;
}
}
Classes
Name |
Description |
HookUninstall |
Plugin annotation
@Analyzer(
id = "hook_uninstall",
description = @Translation("Removes variable_del() calls from hook_uninstall()."),
message = @Translation("Default configuration is deleted automatically."),
tags = {
"category" = { "config"… |