While reading through the lezer grammar for PHP, I noticed an oddity that turned out to be a PHP feature I didn’t know about.
At some point in time, it was possible to use continue
and break
statements with expressions in PHP (e.g. continue $someVar;
).
This is no longer allowed since PHP 7.1: Online PHP editor | output for okXui
And since PHP 7.1-4 and 8.0 are no longer supported, I thought the grammar here and here could be simplified to use an integer instead of an expression.
I didn’t report this as a “bug” yet because it isn’t clear to me which language version the grammar should target. I figured it might be desired to support the widest grammar possible and have these sort of things in a different layer, such as inspections.