On 21-7-2024 13:28, Ilija Tovilo wrote:

Hi Ilja,


I agree that it's not very likely that many people started placing
comments between yield and from, but certainly not impossible. The
main problem with reverting this change is that such code will
completely stop working. Patch updates are routinely installed on
servers without additional testing, so it's very much possible that we
would brick peoples production environments.
That can be said about any bug fix though. The space bar heating anecdote comes to mind.

To compare the impact on PHP_CodeSniffer: From what I understand
(please correct me if I'm wrong), there are really only two possible
scenarios when encountering comments between yield and from:

* PHP_CodeSniffer doesn't see the comment and acts as if it weren't
there, and potentially removes it when fixing errors automatically.
* PHP_CodeSniffer thinks this is a syntax error and thus reports it.

Actually, the impact is a bit larger than that (false positives/negatives for indentation checks, annotations being ignored, comments not being checked etc), but that's a different discussion.

The more problematic impact is that this undocumented change in tokenization can currently cause the autofixer of PHPCS to **create** parse errors in code.

While that's not optimal, it is limited to a subset of the already
small set of people using this new feature, namely the ones also using
PHP_CodeSniffer. It is also limited to development environments, where
PHP_CodeSniffer is executed.

While I understand the interest in minimizing the impact, there are millions of people using PHP_CodeSniffer every day.

In the likely case of not finding consensus on this issue: Setting up
a vote doesn't seem straight-forward to me either. Would we consider
8.3 the baseline, with reverting the change requiring the 2/3
majority, or do we consider 8.2 the baseline?

For a potential vote, I would think more along the lines of consistency rules, i.e. "what is allowed in a token" (whitespace, new lines, comments) ? And then, depending on the proposal, what tokens would be impacted if this is changed (namespaced names, cast tokens, heredoc/nowdoc openers, yield from) and how will this impact these tokens ?

Smile,
Juliette

Reply via email to