Comment Inside yield from

Since PHP 8.3, there can be a comment, inserted between the yield and the from.

In previous versions, this would not compile, unless there was a defined constant called from.

PHP code

<?php

function foo() {
    yield /*a*/  from [3];
}

foreach(foo() as $i) {
    print $i;
}
?>

Before

PHP Fatal error:  Uncaught Error: Undefined constant "from" in /codes/yield_comment_from.php:4
Stack trace:
#0 /codes/yield_comment_from.php(7): foo()
#1 {main}
  thrown in /codes/yield_comment_from.php on line 4

Fatal error: Uncaught Error: Undefined constant from in /codes/yield_comment_from.php:4
Stack trace:
#0 /codes/yield_comment_from.php(7): foo()
#1 {main}
  thrown in /codes/yield_comment_from.php on line 4

After

3

PHP version change

This behavior changed in 8.3