Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Tokenizers/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];

Expand Down
27 changes: 27 additions & 0 deletions tests/Core/Tokenizer/BitwiseOrTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {}

Expand All @@ -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 */
Expand Down
9 changes: 9 additions & 0 deletions tests/Core/Tokenizer/BitwiseOrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */'],
Expand Down