diff --git a/src/Tokenizers/PHP.php b/src/Tokenizers/PHP.php index 3d8cee1657..8d2e3779d2 100644 --- a/src/Tokenizers/PHP.php +++ b/src/Tokenizers/PHP.php @@ -2583,6 +2583,7 @@ protected function processAdditional() T_STATIC => T_STATIC, T_FALSE => T_FALSE, T_NULL => T_NULL, + T_NAMESPACE => T_NAMESPACE, T_NS_SEPARATOR => T_NS_SEPARATOR, ]; diff --git a/tests/Core/Tokenizer/BitwiseOrTest.inc b/tests/Core/Tokenizer/BitwiseOrTest.inc index ec1801d569..2af0ecae98 100644 --- a/tests/Core/Tokenizer/BitwiseOrTest.inc +++ b/tests/Core/Tokenizer/BitwiseOrTest.inc @@ -24,6 +24,15 @@ class TypeUnion /* testTypeUnionPropertyMulti3 */ | null $arrayOrFalse; + /* testTypeUnionPropertyNamespaceRelative */ + public namespace\Sub\NameA|namespace\Sub\NameB $namespaceRelative; + + /* testTypeUnionPropertyPartiallyQualified */ + public Partially\Qualified\NameA|Partially\Qualified\NameB $partiallyQual; + + /* testTypeUnionPropertyFullyQualified */ + public \Fully\Qualified\NameA|\Fully\Qualified\NameB $fullyQual; + public function paramTypes( /* testTypeUnionParam1 */ int|float $paramA /* testBitwiseOrParamDefaultValue */ = CONSTANT_A | CONSTANT_B, @@ -35,6 +44,15 @@ class TypeUnion return (($a1 ^ $b1) |($a2 ^ $b2)) + $c; } + public function identifierNames( + /* testTypeUnionParamNamespaceRelative */ + namespace\Sub\NameA|namespace\Sub\NameB $paramA, + /* testTypeUnionParamPartiallyQualified */ + Partially\Qualified\NameA|Partially\Qualified\NameB $paramB, + /* testTypeUnionParamFullyQualified */ + \Fully\Qualified\NameA|\Fully\Qualified\NameB $paramC, + ) {} + /* testTypeUnionReturnType */ public function returnType() : int|false {} @@ -43,6 +61,15 @@ class TypeUnion /* testTypeUnionAbstractMethodReturnType1 */ abstract public function abstractMethod(): object|array /* testTypeUnionAbstractMethodReturnType2 */ |false; + + /* testTypeUnionReturnTypeNamespaceRelative */ + public function identifierNamesReturnRelative() : namespace\Sub\NameA|namespace\Sub\NameB {} + + /* testTypeUnionReturnPartiallyQualified */ + public function identifierNamesReturnPQ() : Partially\Qualified\NameA|Partially\Qualified\NameB {} + + /* testTypeUnionReturnFullyQualified */ + public function identifierNamesReturnFQ() : \Fully\Qualified\NameA|\Fully\Qualified\NameB {} } /* testTypeUnionClosureParamIllegalNullable */ diff --git a/tests/Core/Tokenizer/BitwiseOrTest.php b/tests/Core/Tokenizer/BitwiseOrTest.php index f6288d817e..d4a27bdc33 100644 --- a/tests/Core/Tokenizer/BitwiseOrTest.php +++ b/tests/Core/Tokenizer/BitwiseOrTest.php @@ -102,13 +102,22 @@ public function dataTypeUnion() ['/* testTypeUnionPropertyMulti1 */'], ['/* testTypeUnionPropertyMulti2 */'], ['/* testTypeUnionPropertyMulti3 */'], + ['/* testTypeUnionPropertyNamespaceRelative */'], + ['/* testTypeUnionPropertyPartiallyQualified */'], + ['/* testTypeUnionPropertyFullyQualified */'], ['/* testTypeUnionParam1 */'], ['/* testTypeUnionParam2 */'], ['/* testTypeUnionParam3 */'], + ['/* testTypeUnionParamNamespaceRelative */'], + ['/* testTypeUnionParamPartiallyQualified */'], + ['/* testTypeUnionParamFullyQualified */'], ['/* testTypeUnionReturnType */'], ['/* testTypeUnionConstructorPropertyPromotion */'], ['/* testTypeUnionAbstractMethodReturnType1 */'], ['/* testTypeUnionAbstractMethodReturnType2 */'], + ['/* testTypeUnionReturnTypeNamespaceRelative */'], + ['/* testTypeUnionReturnPartiallyQualified */'], + ['/* testTypeUnionReturnFullyQualified */'], ['/* testTypeUnionClosureParamIllegalNullable */'], ['/* testTypeUnionWithReference */'], ['/* testTypeUnionWithSpreadOperator */'],