From 0cee2088eab93700691fbdeb878554110b03dd9c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 9 Aug 2020 21:21:22 +0200 Subject: [PATCH] Remove self/parent/static restriction for namespace names This no longer applies as of PHP 8.0. --- lib/PhpParser/ParserAbstract.php | 7 --- .../parser/expr/keywordsInNamespacedName.test | 30 ++++++++++++ .../parser/stmt/namespace/invalidName.test | 46 ------------------- 3 files changed, 30 insertions(+), 53 deletions(-) diff --git a/lib/PhpParser/ParserAbstract.php b/lib/PhpParser/ParserAbstract.php index 2986643..11c8568 100644 --- a/lib/PhpParser/ParserAbstract.php +++ b/lib/PhpParser/ParserAbstract.php @@ -898,13 +898,6 @@ abstract class ParserAbstract implements Parser } protected function checkNamespace(Namespace_ $node) { - if ($node->name && $node->name->isSpecialClassName()) { - $this->emitError(new Error( - sprintf('Cannot use \'%s\' as namespace name', $node->name), - $node->name->getAttributes() - )); - } - if (null !== $node->stmts) { foreach ($node->stmts as $stmt) { if ($stmt instanceof Namespace_) { diff --git a/test/code/parser/expr/keywordsInNamespacedName.test b/test/code/parser/expr/keywordsInNamespacedName.test index 07546a3..58d9d35 100644 --- a/test/code/parser/expr/keywordsInNamespacedName.test +++ b/test/code/parser/expr/keywordsInNamespacedName.test @@ -3,6 +3,9 @@ Keywords in namespaced name