public function FunctionCallModifier::convert in Drupal 7 to 8/9 Module Upgrader 8
Performs required conversions.
Parameters
TargetInterface $target: The target module to convert.
Overrides ConverterInterface::convert
1 call to FunctionCallModifier::convert()
- VariableGet::convert in src/Plugin/ DMU/ Converter/ Functions/ VariableGet.php 
- Performs required conversions.
1 method overrides FunctionCallModifier::convert()
- VariableGet::convert in src/Plugin/ DMU/ Converter/ Functions/ VariableGet.php 
- Performs required conversions.
File
- src/Plugin/ DMU/ Converter/ Functions/ FunctionCallModifier.php, line 43 
Class
- FunctionCallModifier
- Base class for converters which modify individual function calls.
Namespace
Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\FunctionsCode
public function convert(TargetInterface $target) {
  // Prevent stupid effing 'undefined index' notices.
  $function = @($this->pluginDefinition['function'] ?: $this
    ->getPluginId());
  $function_calls = $target
    ->getIndexer('function_call')
    ->get($function);
  foreach ($function_calls as $function_call) {
    // If the function call is no longer attached to a tree, don't even
    // try to rewrite it. This could happen when there are two calls to
    // the same function in a single statement, and the first one has
    // been commented out -- the second one will be attached to an orphaned
    // sub-tree, and this will result in fatal errors.
    if (!$function_call
      ->hasRoot()) {
      continue;
    }
    $rewritten = $this
      ->rewrite($function_call, $target);
    if (empty($rewritten)) {
      $statement = $function_call
        ->getStatement();
      $rewritten = $statement
        ->toComment();
      $statement
        ->replaceWith($rewritten);
      $this
        ->buildFixMe()
        ->insertBefore($rewritten);
    }
    elseif ($rewritten !== $function_call) {
      $function_call
        ->replaceWith($rewritten);
    }
    $target
      ->save($rewritten);
  }
}