From ef121e690c2c68d81c1a083b2f7259112bd009ef Mon Sep 17 00:00:00 2001 From: nikic Date: Mon, 11 Aug 2014 21:44:50 +0200 Subject: [PATCH] Preserve case of "static" class name --- grammar/zend_language_parser.phpy | 2 +- lib/PhpParser/Parser.php | 2 +- test/PhpParser/NodeVisitor/NameResolverTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/grammar/zend_language_parser.phpy b/grammar/zend_language_parser.phpy index 404512e..14c6e46 100644 --- a/grammar/zend_language_parser.phpy +++ b/grammar/zend_language_parser.phpy @@ -678,7 +678,7 @@ function_call: ; class_name: - T_STATIC { $$ = Name['static']; } + T_STATIC { $$ = Name[$1]; } | name { $$ = $1; } ; diff --git a/lib/PhpParser/Parser.php b/lib/PhpParser/Parser.php index 416ca6e..f3cec5b 100644 --- a/lib/PhpParser/Parser.php +++ b/lib/PhpParser/Parser.php @@ -2167,7 +2167,7 @@ class Parser extends ParserAbstract } protected function reduceRule289($attributes) { - $this->semValue = new Node\Name('static', $attributes); + $this->semValue = new Node\Name($this->semStack[$this->stackPos-(1-1)], $attributes); } protected function reduceRule290($attributes) { diff --git a/test/PhpParser/NodeVisitor/NameResolverTest.php b/test/PhpParser/NodeVisitor/NameResolverTest.php index ec88238..b833591 100644 --- a/test/PhpParser/NodeVisitor/NameResolverTest.php +++ b/test/PhpParser/NodeVisitor/NameResolverTest.php @@ -343,6 +343,6 @@ EOC; $this->assertEquals('SELF', (string)$methodStmt->stmts[0]->class); $this->assertEquals('PARENT', (string)$methodStmt->stmts[1]->class); - $this->assertEquals('static', (string)$methodStmt->stmts[2]->class); + $this->assertEquals('STATIC', (string)$methodStmt->stmts[2]->class); } }