php8.1: added never type (#8)

This commit is contained in:
Makhnev Petr 2021-07-31 18:06:46 +03:00 committed by GitHub
parent 8c35b0aef1
commit 8df80651e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View File

@ -226,3 +226,31 @@ class Foo {
suite.Run() suite.Run()
} }
func TestNeverType(t *testing.T) {
suite := tester.NewParserDumpTestSuite(t)
suite.UsePHP8()
suite.Code = `<?php
function f(): never {}
`
suite.Expected = `&ast.Root{
Stmts: []ast.Vertex{
&ast.StmtFunction{
Name: &ast.Identifier{
Val: []byte("f"),
},
ReturnType: &ast.Name{
Parts: []ast.Vertex{
&ast.NamePart{
Val: []byte("never"),
},
},
},
Stmts: []ast.Vertex{},
},
},
},`
suite.Run()
}

View File

@ -23,3 +23,9 @@ class Foo {
} }
`) `)
} }
func TestNeverTypePHP81(t *testing.T) {
tester.NewParserPrintTestSuite(t).UsePHP8().Run(`<?php
function f(): never {}
`)
}