|
@@ -43,9 +43,9 @@ final class TypeAlternationTransformerTest extends AbstractTransformerTestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public static function provideProcessCases(): array
|
|
|
+ public static function provideProcessCases(): iterable
|
|
|
{
|
|
|
- return [
|
|
|
+ yield from [
|
|
|
'no namespace' => [
|
|
|
'<?php try {} catch (ExceptionType1 | ExceptionType2 | ExceptionType3 $e) {}',
|
|
|
[
|
|
@@ -89,6 +89,32 @@ final class TypeAlternationTransformerTest extends AbstractTransformerTestCase
|
|
|
',
|
|
|
],
|
|
|
];
|
|
|
+
|
|
|
+ yield 'self as type' => [
|
|
|
+ '<?php class Foo {
|
|
|
+ function f1(bool|self|int $x): void {}
|
|
|
+ function f2(): self|\stdClass {}
|
|
|
+ }',
|
|
|
+ [
|
|
|
+ 12 => CT::T_TYPE_ALTERNATION,
|
|
|
+ 14 => CT::T_TYPE_ALTERNATION,
|
|
|
+ 34 => CT::T_TYPE_ALTERNATION,
|
|
|
+ ],
|
|
|
+ ];
|
|
|
+
|
|
|
+ yield 'static as type' => [
|
|
|
+ '<?php class Foo {
|
|
|
+ function f1(): static|TypeA {}
|
|
|
+ function f2(): TypeA|static|TypeB {}
|
|
|
+ function f3(): TypeA|static {}
|
|
|
+ }',
|
|
|
+ [
|
|
|
+ 15 => CT::T_TYPE_ALTERNATION,
|
|
|
+ 29 => CT::T_TYPE_ALTERNATION,
|
|
|
+ 31 => CT::T_TYPE_ALTERNATION,
|
|
|
+ 45 => CT::T_TYPE_ALTERNATION,
|
|
|
+ ],
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
/**
|