3 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
5 use Drupal\drupalmoduleupgrader\TargetInterface;
6 use Pharborist\Functions\FunctionCallNode;
7 use Pharborist\Objects\ClassMethodCallNode;
11 * id = "variable_del",
12 * description = @Translation("Replaces variable_del() calls with Configuration API.")
15 class VariableDel extends VariableAPI {
20 public function rewrite(FunctionCallNode $call, TargetInterface $target) {
21 if ($this->tryRewrite($call, $target)) {
22 return ClassMethodCallNode::create('\Drupal', 'config')
23 ->appendArgument($target->id() . '.settings')
24 ->appendMethodCall('clear')
25 ->appendArgument(clone $call->getArguments()->get(0))
26 ->appendMethodCall('save');