-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes of behavior detected in the tool between php74 and php80 #72
Comments
I'm debugging here a little bit the
Still looking at which exact point the difference happens, surely it's some difference in the Tokenizer... and can imagine which the solution may be... but want to understand it.... |
Aha, mystery solved, that change came with PHP8 (treat namespaces as single token): https://wiki.php.net/rfc/namespaced_names_as_token So, I'm going to try to keep old behavior and, when php8 is detected, look for the last part of the namespace only. Ciao :-) |
This tool has limited namespace handling capabilities and we always have been getting, exclusively, the last part of every namespace detected in function params. This was the default behavior for PHP7 tokenizer and, in fact, when reading the phpdocs for those params... we are removing everything but the final part of the namespace too. But PHP8 changed the default behavior and its tokenizer now returns the complete namespace as unique token. https://wiki.php.net/rfc/namespaced_names_as_token So, to keep everything working as it was... when we detect that some type of the function params contains namespaces, we are also going to remove everything but the final part of the namespace. That matches previous behaviour 100%. If some day we want to go processing full namespaces (instead of their final parts), that will be great, but not now. Fixes moodlehq#72.
It has been detected that the information reported by the tool is different based on the php version used. Here it's a real case:
This was first noticed with this GHA execution that is passing perfectly with PHP7, but reporting lots of errors with PHP8:
https://github.com/brickfield/moodle-tool_brickfield/runs/2510233810?check_suite_focus=true#step:11:1
Ciao :-)
The text was updated successfully, but these errors were encountered: