Closed andyliuonline closed 6 years ago
Hmm my guess is you aren't actually using PHP 7+ like you think; support for methods named new
was added in PHP 7.0 so maybe there are multiple versions installed in your environment and the wrong one is being used?
Everything runs on PHP 7.1.8 fine here:
Can you share a screenshot of what you see when you output phpversion()
in your environment?
@adamwathan
I think its to do with the new reserved keywords, that are especially present in 7.2
If you run it through php7cc the usage of the ::new gets flagged up
e.g if i try use it from within my project
then check it with php7cc
Hopefully that helps shed some light :)
As of PHP 7.0.0 these keywords are allowed as property, constant, and method names of classes, interfaces and traits, except that
class
may not be used as constant name.
The PHP Manual (emphasis mine)
@simonhamp They are allowed yeah :) but I don't think that's what the problem is about.
I believe its more about a tool that is being used, such as an IDE or linter is throwing up the error - otherwise IF the version being mentioned is actually the one being used in the browser, it would not fail
This is totally valid in PHP 7+ and our tests all run without issue on PHP 7.2 so closing this.
PHP Parse error: syntax error, unexpected 'new' (T_NEW) in
vendor/kitetail/zttp/src/Zttp.php on line 9
Use PHP7.1