public function enterNode(Node $node)
 {
     if (!NodeHelper::isFunctionCallByStaticName($node)) {
         return;
     }
     /** @var Node\Expr\FuncCall $node */
     $functionName = $node->name->toString();
     if (isset($this->removedFunctionNames[$functionName])) {
         $this->addContextMessage(sprintf('Removed function "%s" called', $functionName), $node);
     }
 }
Esempio n. 2
0
 /**
  * @param Node $node
  * @param array $functions
  * @param null|bool $skippedByRefType Reference type (by value/by reference) to skip
  * @return bool
  */
 protected function hasFunctionCallWithForeachArgument(Node $node, array $functions, $skippedByRefType = null)
 {
     if (!NodeHelper::isFunctionCallByStaticName($node)) {
         return false;
     }
     /** @var Node\Expr\FuncCall $node */
     $functionName = $node->name->toString();
     if (!isset($functions[$functionName])) {
         return false;
     }
     foreach ($node->args as $argument) {
         /** @var Node\Stmt\Foreach_ $foreach */
         foreach ($this->foreachStack as $foreach) {
             if ($skippedByRefType !== null && $foreach->byRef === $skippedByRefType) {
                 continue;
             }
             if ($argument->value instanceof Node\Expr\Variable && $argument->value->name === $this->getForeachVariableName($foreach)) {
                 return true;
             }
         }
     }
     return false;
 }