diff --git a/grammar/zend_language_parser.phpy b/grammar/zend_language_parser.phpy index 768051e..2a2534d 100644 --- a/grammar/zend_language_parser.phpy +++ b/grammar/zend_language_parser.phpy @@ -140,10 +140,10 @@ use_declarations: ; use_declaration: - namespace_name { $$ = new PHPParser_Node_Stmt_UseUse(array('ns' => $1, 'alias' => null), #line, #docComment); } - | namespace_name T_AS T_STRING { $$ = new PHPParser_Node_Stmt_UseUse(array('ns' => $1, 'alias' => $3), #line, #docComment); } - | T_NS_SEPARATOR namespace_name { $$ = new PHPParser_Node_Stmt_UseUse(array('ns' => $2, 'alias' => null), #line, #docComment); } - | T_NS_SEPARATOR namespace_name T_AS T_STRING { $$ = new PHPParser_Node_Stmt_UseUse(array('ns' => $2, 'alias' => $4), #line, #docComment); } + namespace_name { $$ = new PHPParser_Node_Stmt_UseUse(array('name' => $1, 'alias' => null), #line, #docComment); } + | namespace_name T_AS T_STRING { $$ = new PHPParser_Node_Stmt_UseUse(array('name' => $1, 'alias' => $3), #line, #docComment); } + | T_NS_SEPARATOR namespace_name { $$ = new PHPParser_Node_Stmt_UseUse(array('name' => $2, 'alias' => null), #line, #docComment); } + | T_NS_SEPARATOR namespace_name T_AS T_STRING { $$ = new PHPParser_Node_Stmt_UseUse(array('name' => $2, 'alias' => $4), #line, #docComment); } ; constant_declaration: diff --git a/grammar/zend_language_parser.pre.phpy b/grammar/zend_language_parser.pre.phpy index a10d5b2..10ce7ff 100644 --- a/grammar/zend_language_parser.pre.phpy +++ b/grammar/zend_language_parser.pre.phpy @@ -140,10 +140,10 @@ use_declarations: ; use_declaration: - namespace_name { $$ = Stmt_UseUse[ns: $1, alias: null]; } - | namespace_name T_AS T_STRING { $$ = Stmt_UseUse[ns: $1, alias: $3]; } - | T_NS_SEPARATOR namespace_name { $$ = Stmt_UseUse[ns: $2, alias: null]; } - | T_NS_SEPARATOR namespace_name T_AS T_STRING { $$ = Stmt_UseUse[ns: $2, alias: $4]; } + namespace_name { $$ = Stmt_UseUse[name: $1, alias: null]; } + | namespace_name T_AS T_STRING { $$ = Stmt_UseUse[name: $1, alias: $3]; } + | T_NS_SEPARATOR namespace_name { $$ = Stmt_UseUse[name: $2, alias: null]; } + | T_NS_SEPARATOR namespace_name T_AS T_STRING { $$ = Stmt_UseUse[name: $2, alias: $4]; } ; constant_declaration: diff --git a/lib/PHPParser/Node/Stmt/UseUse.php b/lib/PHPParser/Node/Stmt/UseUse.php index 3ea565e..2498189 100644 --- a/lib/PHPParser/Node/Stmt/UseUse.php +++ b/lib/PHPParser/Node/Stmt/UseUse.php @@ -1,8 +1,8 @@ yyval = new PHPParser_Node_Stmt_UseUse(array('ns' => $this->yyastk[$this->yysp-(1-1)], 'alias' => null), $line, $docComment); + $this->yyval = new PHPParser_Node_Stmt_UseUse(array('name' => $this->yyastk[$this->yysp-(1-1)], 'alias' => null), $line, $docComment); } private function yyn19($line, $docComment) { - $this->yyval = new PHPParser_Node_Stmt_UseUse(array('ns' => $this->yyastk[$this->yysp-(3-1)], 'alias' => $this->yyastk[$this->yysp-(3-3)]), $line, $docComment); + $this->yyval = new PHPParser_Node_Stmt_UseUse(array('name' => $this->yyastk[$this->yysp-(3-1)], 'alias' => $this->yyastk[$this->yysp-(3-3)]), $line, $docComment); } private function yyn20($line, $docComment) { - $this->yyval = new PHPParser_Node_Stmt_UseUse(array('ns' => $this->yyastk[$this->yysp-(2-2)], 'alias' => null), $line, $docComment); + $this->yyval = new PHPParser_Node_Stmt_UseUse(array('name' => $this->yyastk[$this->yysp-(2-2)], 'alias' => null), $line, $docComment); } private function yyn21($line, $docComment) { - $this->yyval = new PHPParser_Node_Stmt_UseUse(array('ns' => $this->yyastk[$this->yysp-(4-2)], 'alias' => $this->yyastk[$this->yysp-(4-4)]), $line, $docComment); + $this->yyval = new PHPParser_Node_Stmt_UseUse(array('name' => $this->yyastk[$this->yysp-(4-2)], 'alias' => $this->yyastk[$this->yysp-(4-4)]), $line, $docComment); } private function yyn22($line, $docComment) { diff --git a/lib/PHPParser/ParserDebug.php b/lib/PHPParser/ParserDebug.php index bcf970d..d7d1b0f 100644 --- a/lib/PHPParser/ParserDebug.php +++ b/lib/PHPParser/ParserDebug.php @@ -1471,19 +1471,19 @@ class PHPParser_ParserDebug } private function yyn18($line, $docComment) { - $this->yyval = new PHPParser_Node_Stmt_UseUse(array('ns' => $this->yyastk[$this->yysp-(1-1)], 'alias' => null), $line, $docComment); + $this->yyval = new PHPParser_Node_Stmt_UseUse(array('name' => $this->yyastk[$this->yysp-(1-1)], 'alias' => null), $line, $docComment); } private function yyn19($line, $docComment) { - $this->yyval = new PHPParser_Node_Stmt_UseUse(array('ns' => $this->yyastk[$this->yysp-(3-1)], 'alias' => $this->yyastk[$this->yysp-(3-3)]), $line, $docComment); + $this->yyval = new PHPParser_Node_Stmt_UseUse(array('name' => $this->yyastk[$this->yysp-(3-1)], 'alias' => $this->yyastk[$this->yysp-(3-3)]), $line, $docComment); } private function yyn20($line, $docComment) { - $this->yyval = new PHPParser_Node_Stmt_UseUse(array('ns' => $this->yyastk[$this->yysp-(2-2)], 'alias' => null), $line, $docComment); + $this->yyval = new PHPParser_Node_Stmt_UseUse(array('name' => $this->yyastk[$this->yysp-(2-2)], 'alias' => null), $line, $docComment); } private function yyn21($line, $docComment) { - $this->yyval = new PHPParser_Node_Stmt_UseUse(array('ns' => $this->yyastk[$this->yysp-(4-2)], 'alias' => $this->yyastk[$this->yysp-(4-4)]), $line, $docComment); + $this->yyval = new PHPParser_Node_Stmt_UseUse(array('name' => $this->yyastk[$this->yysp-(4-2)], 'alias' => $this->yyastk[$this->yysp-(4-4)]), $line, $docComment); } private function yyn22($line, $docComment) { diff --git a/lib/PHPParser/PrettyPrinter/Zend.php b/lib/PHPParser/PrettyPrinter/Zend.php index 7ef17f8..55f9834 100644 --- a/lib/PHPParser/PrettyPrinter/Zend.php +++ b/lib/PHPParser/PrettyPrinter/Zend.php @@ -433,7 +433,7 @@ class PHPParser_PrettyPrinter_Zend extends PHPParser_PrettyPrinterAbstract } public function pStmt_UseUse(PHPParser_Node_Stmt_UseUse $node) { - return $this->p($node->ns) . (null !== $node->alias ? ' as ' . $node->alias : ''); + return $this->p($node->name) . (null !== $node->alias ? ' as ' . $node->alias : ''); } public function pStmt_Interface(PHPParser_Node_Stmt_Interface $node) {