@@ -1179,18 +1179,17 @@ public function pprintPropertyHook(\PhpParser\Node\PropertyHook $node)
11791179
11801180 public function pprintFullyQualifiedName (\PhpParser \Node \Name \FullyQualified $ node )
11811181 {
1182- return "\\" . $ this ->pprintName ($ node );
1182+ return $ this ->pprintName ($ node );
11831183 }
11841184
11851185 public function pprintRelativeName (\PhpParser \Node \Name \Relative $ node )
11861186 {
1187- return " namespace \\\\" . $ this ->pprintName ($ node );
1187+ return $ this ->pprintName ($ node );
11881188 }
11891189
11901190 public function pprintName (\PhpParser \Node \Name $ node )
11911191 {
1192- $ fragment = $ this ->implodeName ($ node );
1193- $ fragment = "name( \"" . $ fragment . "\"" ;
1192+ $ fragment = "name( \"" . addslashes ($ node ->toCodeString ()) . "\"" ;
11941193 $ fragment .= $ this ->annotateASTNode ($ node );
11951194 $ fragment .= ") " ;
11961195
@@ -1642,7 +1641,7 @@ public function pprintConstStmt(\PhpParser\Node\Stmt\Const_ $node)
16421641 $ attrs [] = $ this ->pprint ($ attr );
16431642 }
16441643
1645- $ fragment = "const([ " . implode (", " , $ consts ) . ",[ " . implode (", " , $ attrs ) . "] " ;
1644+ $ fragment = "const([ " . implode (", " , $ consts ) . "] ,[ " . implode (", " , $ attrs ) . "] " ;
16461645 $ fragment .= $ this ->annotateASTNode ($ node );
16471646 $ fragment .= ") " ;
16481647
@@ -2015,7 +2014,7 @@ public function pprintNamespaceStmt(\PhpParser\Node\Stmt\Namespace_ $node)
20152014 // namespace { global stuff }
20162015 $ priorNamespace = $ this ->currentNamespace ;
20172016 if (null !== $ node ->name ) {
2018- $ this ->currentNamespace = $ this -> implodeName ( $ node ->name );
2017+ $ this ->currentNamespace = $ node ->name -> toCodeString ( );
20192018 } else {
20202019 $ this ->currentNamespace = "" ;
20212020 }
@@ -2435,17 +2434,6 @@ public function pprintVarLikeIdentifier(\PhpParser\Node\VarLikeIdentifier $node)
24352434 return $ node ->name ;
24362435 }
24372436
2438- /**
2439- * @param string|\PhpParser\Node\Name $node
2440- * @return string
2441- */
2442- public function implodeName ($ node )
2443- {
2444- // NOTE: Remove this function later. Names are now stored in
2445- // imploded form, so we no longer need to implode them here.
2446- return $ node ->toString ();
2447- }
2448-
24492437 public function pprintEnumCaseStmt (\PhpParser \Node \Stmt \EnumCase $ node )
24502438 {
24512439 $ enumName = $ this ->pprint ($ node ->name );
0 commit comments