Add never type

This should be recognized as Identifier instead of Name now.
This commit is contained in:
Nikita Popov 2021-04-25 22:35:28 +02:00
parent e03d63cffb
commit 8eb194ea1f
2 changed files with 24 additions and 0 deletions

View File

@ -663,6 +663,7 @@ abstract class ParserAbstract implements Parser
'null' => true, 'null' => true,
'false' => true, 'false' => true,
'mixed' => true, 'mixed' => true,
'never' => true,
]; ];
if (!$name->isUnqualified()) { if (!$name->isUnqualified()) {

View File

@ -0,0 +1,23 @@
Never type
-----
<?php
function test(): never {}
-----
!!php7
array(
0: Stmt_Function(
attrGroups: array(
)
byRef: false
name: Identifier(
name: test
)
params: array(
)
returnType: Identifier(
name: never
)
stmts: array(
)
)
)