/** * Constructs a new function wrapper. * * @param \PDepend\Source\AST\ASTFunction $node */ public function __construct(ASTFunction $node) { parent::__construct($node); }
/** * Checks if this node has a suppressed annotation for the given rule * instance. * * @param \PHPMD\Rule $rule * @return boolean */ public function hasSuppressWarningsAnnotationFor(Rule $rule) { if (parent::hasSuppressWarningsAnnotationFor($rule)) { return true; } return $this->getParentType()->hasSuppressWarningsAnnotationFor($rule); }
/** * This method collects all local variable instances from the given * method/function node and stores their image in the <b>$_images</b> * property. * * * @param \PHPMD\Node\AbstractCallableNode $node * @return void */ private function collectVariables(AbstractCallableNode $node) { foreach ($node->findChildrenOfType('Variable') as $variable) { if ($this->isLocal($variable)) { $this->collectVariable($variable); } } foreach ($node->findChildrenOfType('VariableDeclarator') as $variable) { $this->collectVariable($variable); } foreach ($node->findChildrenOfType('FunctionPostfix') as $func) { if ($this->isFunctionNameEndingWith($func, 'compact')) { foreach ($func->findChildrenOfType('Literal') as $literal) { $this->collectLiteral($literal); } } } }