public function enterNode(Twig_Node $node, Twig_Environment $env) { if ($node instanceof Twig_Node_Module) { $this->inAModule = true; $this->tags = array(); $this->filters = array(); return $node; } elseif ($this->inAModule) { // look for tags if ($node->getTag()) { $this->tags[$node->getTag()] = true; } // look for filters if ($node instanceof Twig_Node_Expression_Filter) { foreach ($node->getFilters() as $filter) { $this->filters[$filter[0]] = true; } } } return $node; }