PHP 8.3: "yield /*comment*/ from" is no longer a parse error ?
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
The following code:
<?php
function generator()
{
yield from gen2();
yield /* comment */ from gen2();
yield
from
gen2();
yield // comment
from gen2();
yield
/* comment */
from
gen2();
}
Resulted in this output:
_no output_
But I expected this output instead:
Parse error: syntax error, unexpected identifier "gen2" in /in/2SI2Q on line 7
For a full analysis of the differences in tokenization, see: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/529#issuecomment-2209337419
While I'm not necessarily challenging this change, I'd like to know if this was a deliberate/intentional change.
I have not been able to find anything in the PHP 8.3 CHANGELOG about this change, nor in the NEWS file. I can't even seem to find the commit which caused this change.
If this change was intentional, this is probably a documentation issue and the change should be annotated in the PHP 8.3 CHANGELOG.
If this change was unintentional, I believe it may be prudent to revert the change (or at least revert the side-effects of the commit which incidentally caused this change).
I'd like to get some clarity about this as it will inform how the PHP_CodeSniffer issue linked above should be fixed.
PHP Version
PHP 8.3.8
Operating System
Not relevant
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。