You are here

function hook_upgrade_call_alter in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_upgrade/coder_upgrade.api.php \hook_upgrade_call_alter()

Alters function calls using the grammar parser.

This hook allows contributed modules to alter any function call object using the grammar parser. The function call may be a stand-alone statement or part of an expression in another statement. For example:

foo($bar);

// Stand-alone.
if (foo($bar)) {

  // Embedded.
  // Do something.
}

Coder Upgrade will call this alter hook for each function call in the file that was parsed. However, the function name must be a string, not a variable expression. To modify the latter, use hook_upgrade_file_alter(). Refer to the grammar parser documentation for details of the function call object.

Parameters

PGPFunctionCall $node: A node object containing a function call object.

PGPReader $reader: The object containing the grammar statements of the file to convert.

$name: The name of the function.

See also

hook_upgrade_file_alter()

PGPFunctionCall

1 function implements hook_upgrade_call_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

coder_upgrade_upgrade_call_alter in coder_upgrade/conversions/call.inc
Implements hook_upgrade_call_alter().
1 invocation of hook_upgrade_call_alter()
coder_upgrade_convert_function_calls in coder_upgrade/includes/main.inc
Upgrades function calls using grammar parser.

File

coder_upgrade/coder_upgrade.api.php, line 124
Documents hooks provided by this module.

Code

function hook_upgrade_call_alter(&$node, &$reader, $name) {

  // Get the function call object.
  $item =& $node->data;

  // Modify the function call.
  switch ($name) {
    case 'foo':
      $item
        ->deleteParameter();
      break;
    default:
      break;
  }
}