You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior to PHP 7, reserved keywords can be used as class method names.
When using patchwork for unit tests(using phpunit and symfony) following error occured:
During class fetch: Uncaught ParseError: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting function (T_FUNCTION) or const (T_CONST) in vendor/symfony/dependency-injection/Loader/Configurator/Traits/ClassTrait.php:26
Temporary workaround for this issue is to load ClassTrait before the patchwork library is loaded, but I would appreciate if support for reserved keywords as method names will be added to the library. Thank you!
The text was updated successfully, but these errors were encountered:
Thank you for the report, @pkopi! And apologies for the delay. It was quite a surprise to me that token_get_all() has a flag, TOKEN_PARSE, that should solve all of this. It even had it for quite a while already. I will try switching it on.
@antecedent Just for your information - TOKEN_PARSE also makes token_get_all() parse error intolerant, which depending on the use-case, can be problematic if code suitable for different PHP versions needs to be tokenized. (I'm not 100% sure where token_get_all() is used here, but just so you know)
Prior to PHP 7, reserved keywords can be used as class method names.
When using patchwork for unit tests(using phpunit and symfony) following error occured:
During class fetch: Uncaught ParseError: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting function (T_FUNCTION) or const (T_CONST) in vendor/symfony/dependency-injection/Loader/Configurator/Traits/ClassTrait.php:26
Temporary workaround for this issue is to load ClassTrait before the patchwork library is loaded, but I would appreciate if support for reserved keywords as method names will be added to the library. Thank you!
The text was updated successfully, but these errors were encountered: