049ce7ddc6
PHP 8 Update - nullsafe operator (?->) - Remove (real) cast - Named arguments - Remove (unset) cast - Remove {} access - match expression - Union types in type hints and static typehint - Block catch without variable - Trailing comma in parameter lists - throw can be used as an expression - Concatenation precedence - Declaring properties in the constructor - Attributes - Names in the namespace are treated as a single token - Trailing comma in closure use list - Check that ::class on object works - Deferencable changes and arbitrary expressions in new/instanceof
31 lines
567 B
Go
31 lines
567 B
Go
package php8_test
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"testing"
|
|
|
|
"github.com/z7zmey/php-parser/internal/php8"
|
|
"github.com/z7zmey/php-parser/pkg/conf"
|
|
"github.com/z7zmey/php-parser/pkg/version"
|
|
)
|
|
|
|
func BenchmarkPhp8(b *testing.B) {
|
|
src, err := ioutil.ReadFile("test.php")
|
|
|
|
if err != nil {
|
|
b.Fatal("can not read test.php: " + err.Error())
|
|
}
|
|
|
|
for n := 0; n < b.N; n++ {
|
|
config := conf.Config{
|
|
Version: &version.Version{
|
|
Major: 8,
|
|
Minor: 8,
|
|
},
|
|
}
|
|
lexer := php8.NewLexer(src, config)
|
|
php8parser := php8.NewParser(lexer, config)
|
|
php8parser.Parse()
|
|
}
|
|
}
|