Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
php8.1: added never type (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
i582 committed Jul 31, 2021
1 parent 8c35b0a commit 8df8065
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
28 changes: 28 additions & 0 deletions internal/php8/parser_php8_1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,31 @@ class Foo {

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()
}
6 changes: 6 additions & 0 deletions pkg/visitor/printer/printer_php8_1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ class Foo {
}
`)
}

func TestNeverTypePHP81(t *testing.T) {
tester.NewParserPrintTestSuite(t).UsePHP8().Run(`<?php
function f(): never {}
`)
}

0 comments on commit 8df8065

Please sign in to comment.