match is a reserved word in PHP 8, and while it technically is fine as a function name, it causes some weird errors with phan for example:
src/IPSet.php:209 PhanSyntaxError Fallback parser diagnostic error: 'Name' expected. (at column 17)
match is a reserved word in PHP 8, and while it technically is fine as a function name, it causes some weird errors with phan for example:
src/IPSet.php:209 PhanSyntaxError Fallback parser diagnostic error: 'Name' expected. (at column 17)
It is most definitely a bug, not in phan but in the polyfill parser it uses (the same code can be analyzed just fine with php-ast).
I think the proposal in this task is to rename the method even if the syntax is tehcnically correct, to avoid incurring in more bugs in the future (either in phan or other code checkers).
Fixed and released in tolerant-php-parser v0.1.2 on 5 Oct 2022. Then propagated to Phan in the Phan 5.4.2 release in March 2023. https://github.com/phan/phan/releases/tag/5.4.2
The last release of mediawiki-phan-config, mediawiki-phan-config 0.13.0 (2023-09-08) upgrades Phan to 5.4.2.
And mediawiki/core uses mediawiki-phan-config 0.13.0 as of writing. Marking as resolved.
https://gerrit.wikimedia.org/r/c/mediawiki/libs/IPUtils/+/960157
Also bump mediawiki/mediawiki-phan-config while at it, because this
repo is currently failing Phan on local development when tested on
PHP 8.2 due to https://github.com/phan/phan/issues/4751, which was
fixed in Phan 5.4.2, and mediawiki/mediawiki-phan-config 0.13, updates
use of Phan from 5.4.1 to 5.4.2.