public function leaveNode(\PHPParser_Node $node) { if ($node instanceof \PHPParser_Node_Const) { $prettyPrinter = new \PHPParser_PrettyPrinter_Default(); static::$constants[$node->name] = $prettyPrinter->prettyPrintExpr($node->value); } }
public function getArg(\PHPParser_Node_Arg $arg) { if ($arg->value instanceof \PHPParser_Node_Expr_ClassConstFetch) { $constant = $arg->value; $rightPart = $constant->name; if (array_key_exists($rightPart, MyConstantVisitor::$constants)) { return MyConstantVisitor::$constants[$rightPart]; } } $prettyPrinter = new \PHPParser_PrettyPrinter_Default(); return $prettyPrinter->prettyPrintExpr($arg->value); }