public function visit(NodeTraversal $t, \PHPParser_Node $node, \PHPParser_Node $parent = null)
 {
     if (!NodeUtil::isCallLike($node)) {
         return;
     }
     if (null === ($function = $this->typeRegistry->getCalledFunctionByNode($node))) {
         return;
     }
     foreach ($function->getParameters() as $param) {
         $index = $param->getIndex();
         if (!isset($node->args[$index])) {
             continue;
         }
         $node->args[$index]->setAttribute('param_expects_ref', $param->isPassedByRef());
     }
 }
 public function visit(NodeTraversal $t, \PHPParser_Node $node, \PHPParser_Node $parent = null)
 {
     if (!NodeUtil::isCallLike($node)) {
         return;
     }
     if (null === ($function = $this->typeRegistry->getCalledFunctionByNode($node))) {
         return;
     }
     foreach ($function->getParameters() as $param) {
         if (!$param->isPassedByRef()) {
             continue;
         }
         $index = $param->getIndex();
         if (!isset($node->args[$index])) {
             continue;
         }
         $arg = $node->args[$index];
         if (!NodeUtil::canBePassedByRef($arg->value)) {
             $this->phpFile->addComment($arg->getLine(), Comment::error('usage.non_referencable_arg', '``%argument%`` cannot be passed to ``%function_name%()`` as the parameter ``$%parameter_name%`` expects a reference.', array('argument' => self::$prettyPrinter->prettyPrintExpr($arg->value), 'function_name' => $function->getName(), 'parameter_name' => $param->getName())));
         }
     }
 }