/** * @param mixed $nodes * @return bool */ private function callsFuncGetArgs($nodes) : bool { foreach ($nodes as $node) { if (is_array($node)) { if ($this->callsFuncGetArgs($node)) { return true; } } if (!$node instanceof \PhpParser\Node) { continue; } if ($node instanceof \PhpParser\Node\Stmt\ClassLike && isset($node->namespacedName) && $this->declaringClass->getName() !== (string) $node->namespacedName) { continue; } if ($node instanceof ClassMethod) { if ($node->getStmts() === null) { continue; // interface } $methodName = $node->name; if ($methodName === $this->reflection->getName()) { return $this->functionCallStatementFinder->findFunctionCallInStatements(ParametersAcceptor::VARIADIC_FUNCTIONS, $node->getStmts()) !== null; } continue; } if ($this->callsFuncGetArgs($node)) { return true; } } return false; }
/** * @param mixed $nodes * @return bool */ private function callsFuncGetArgs($nodes) : bool { foreach ($nodes as $node) { if (is_array($node)) { if ($this->callsFuncGetArgs($node)) { return true; } } if (!$node instanceof \PhpParser\Node) { continue; } if ($node instanceof Function_) { $functionName = $node->name; if ((string) $node->namespacedName) { $functionName = (string) $node->namespacedName; } if ($functionName === $this->reflection->getName()) { return $this->functionCallStatementFinder->findFunctionCallInStatements(self::VARIADIC_FUNCTIONS, $node->getStmts()) !== null; } continue; } if ($this->callsFuncGetArgs($node)) { return true; } } return false; }
/** * @param mixed $nodes * @return bool */ private function callsFuncGetArgs($nodes) : bool { foreach ($nodes as $node) { if (is_array($node)) { if ($this->callsFuncGetArgs($node)) { return true; } } if (!$node instanceof \PhpParser\Node) { continue; } if ($node instanceof ClassMethod) { if ($node->getStmts() === null) { continue; // interface } $methodName = $node->name; if ($methodName === $this->reflection->getName()) { return $this->functionCallStatementFinder->findFunctionCallInStatements('func_get_args', $node->getStmts()) !== null; } } if ($this->callsFuncGetArgs($node)) { return true; } } return false; }