location = $location; } public function leaveNode(AstNode $node) { switch ($node->getType()) { case 'Scalar_MagicConst_Class' : return new StringNode($this->location['class'] ?: ''); case 'Scalar_MagicConst_Dir' : return new StringNode($this->location['directory'] ?: ''); case 'Scalar_MagicConst_File' : return new StringNode($this->location['file'] ?: ''); case 'Scalar_MagicConst_Function' : return new StringNode($this->location['function'] ?: ''); case 'Scalar_MagicConst_Line' : return new NumberNode($node->getAttribute('startLine') ?: 0); case 'Scalar_MagicConst_Method' : return new StringNode($this->location['method'] ?: ''); case 'Scalar_MagicConst_Namespace' : return new StringNode($this->location['namespace'] ?: ''); case 'Scalar_MagicConst_Trait' : return new StringNode($this->location['trait'] ?: ''); } } }