Skip to content

Commit

Permalink
Merge pull request #812 from kukulich/php81-never
Browse files Browse the repository at this point in the history
PHP 8.1: `never` builtin type
  • Loading branch information
Ocramius authored Oct 14, 2021
2 parents ded5e4d + 3665fc1 commit c913191
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Reflection/ReflectionNamedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ReflectionNamedType extends ReflectionType
'mixed' => null,
'static' => null,
'null' => null,
'never' => null,
];

private string $name;
Expand Down
2 changes: 2 additions & 0 deletions test/unit/Reflection/ReflectionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function isBuildinProvider(): Generator
yield ['object'];
yield ['iterable'];
yield ['mixed'];
yield ['never'];
}

/**
Expand Down Expand Up @@ -92,6 +93,7 @@ public function testImplicitCastToString(): void
self::assertSame('object', (string) ReflectionType::createFromTypeAndReflector(new Identifier('object')));
self::assertSame('iterable', (string) ReflectionType::createFromTypeAndReflector(new Identifier('iterable')));
self::assertSame('mixed', (string) ReflectionType::createFromTypeAndReflector(new Identifier('mixed')));
self::assertSame('never', (string) ReflectionType::createFromTypeAndReflector(new Identifier('never')));

self::assertSame('Foo\Bar\Baz', (string) ReflectionType::createFromTypeAndReflector(new Identifier('Foo\Bar\Baz')));
self::assertSame('\Foo\Bar\Baz', (string) ReflectionType::createFromTypeAndReflector(new Identifier('\Foo\Bar\Baz')));
Expand Down

0 comments on commit c913191

Please sign in to comment.