private function removeParameters(AbstractNode $node, array &$localVariables) { $parameters = $node->getFirstChildOfType('FormalParameters'); $declarators = $parameters->findChildrenOfType('VariableDeclarator'); foreach ($declarators as $declarator) { unset($localVariables[$declarator->getImage()]); } }
/** * This method extracts all parameters for the given function or method node * and it stores the parameter images in the <b>$_images</b> property. * * @param \PHPMD\AbstractNode $node * @return void */ private function collectParameters(AbstractNode $node) { // First collect the formal parameters container $parameters = $node->getFirstChildOfType('FormalParameters'); // Now get all declarators in the formal parameters container $declarators = $parameters->findChildrenOfType('VariableDeclarator'); foreach ($declarators as $declarator) { $this->nodes[$declarator->getImage()] = $declarator; } }