PHPMD\Rule\UnusedLocalVariable::collectVariables PHP Method

collectVariables() private method

This method collects all local variable instances from the given method/function node and stores their image in the $_images property.
private collectVariables ( PHPMD\Node\AbstractCallableNode $node ) : void
$node PHPMD\Node\AbstractCallableNode
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);
                }
            }
        }
    }