File tree Expand file tree Collapse file tree 4 files changed +72
-0
lines changed
Expand file tree Collapse file tree 4 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ /**
6+ * This file is part of phpDocumentor.
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ *
11+ * @link http://phpdoc.org
12+ */
13+
14+ namespace phpDocumentor \Reflection \PseudoTypes ;
15+
16+ use phpDocumentor \Reflection \PseudoType ;
17+ use phpDocumentor \Reflection \Type ;
18+ use phpDocumentor \Reflection \Types \Never_ ;
19+
20+ /**
21+ * Value Object representing the type 'no-return'.
22+ *
23+ * @psalm-immutable
24+ */
25+ final class NoReturn extends Never_ implements PseudoType
26+ {
27+ public function underlyingType (): Type
28+ {
29+ return new Never_ ();
30+ }
31+
32+ public function __toString (): string
33+ {
34+ return 'no-return ' ;
35+ }
36+ }
Original file line number Diff line number Diff line change 5050use phpDocumentor \Reflection \PseudoTypes \NonNegativeInteger ;
5151use phpDocumentor \Reflection \PseudoTypes \NonPositiveInteger ;
5252use phpDocumentor \Reflection \PseudoTypes \NonZeroInteger ;
53+ use phpDocumentor \Reflection \PseudoTypes \NoReturn ;
5354use phpDocumentor \Reflection \PseudoTypes \Numeric_ ;
5455use phpDocumentor \Reflection \PseudoTypes \NumericString ;
5556use phpDocumentor \Reflection \PseudoTypes \ObjectShape ;
@@ -186,6 +187,7 @@ final class TypeResolver
186187 'never ' => Never_::class,
187188 'never-return ' => NeverReturn::class,
188189 'never-returns ' => NeverReturns::class,
190+ 'no-return ' => NoReturn::class,
189191 'list ' => List_::class,
190192 'non-empty-list ' => NonEmptyList::class,
191193 'non-falsy-string ' => NonFalsyString::class,
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ /**
6+ * This file is part of phpDocumentor.
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ *
11+ * @link http://phpdoc.org
12+ */
13+
14+ namespace phpDocumentor \Reflection \PseudoTypes ;
15+
16+ use phpDocumentor \Reflection \Types \Never_ ;
17+ use PHPUnit \Framework \TestCase ;
18+
19+ final class NoReturnTest extends TestCase
20+ {
21+ public function testCreate (): void
22+ {
23+ $ type = new NoReturn ();
24+
25+ $ this ->assertEquals (new Never_ (), $ type ->underlyingType ());
26+ }
27+
28+ public function testToString (): void
29+ {
30+ $ this ->assertSame ('no-return ' , (string ) (new NoReturn ()));
31+ }
32+ }
Original file line number Diff line number Diff line change 5050use phpDocumentor \Reflection \PseudoTypes \NonNegativeInteger ;
5151use phpDocumentor \Reflection \PseudoTypes \NonPositiveInteger ;
5252use phpDocumentor \Reflection \PseudoTypes \NonZeroInteger ;
53+ use phpDocumentor \Reflection \PseudoTypes \NoReturn ;
5354use phpDocumentor \Reflection \PseudoTypes \Numeric_ ;
5455use phpDocumentor \Reflection \PseudoTypes \NumericString ;
5556use phpDocumentor \Reflection \PseudoTypes \ObjectShape ;
@@ -680,6 +681,7 @@ public function provideKeywords(): array
680681 ['never ' , Never_::class],
681682 ['never-return ' , NeverReturn::class],
682683 ['never-returns ' , NeverReturns::class],
684+ ['no-return ' , NoReturn::class],
683685 ['literal-string ' , LiteralString::class],
684686 ['list ' , List_::class],
685687 ['non-empty-list ' , NonEmptyList::class],
You can’t perform that action at this time.
0 commit comments