Needs Feedback - Yield without value in reference generator function does not create notice
| From: | aggelos bellos | Date: | Tue, 26 Nov 2024 00:49:14 +0000 |
| Subject: | Needs Feedback - Yield without value in reference generator function does not create notice | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-126050@lists.php.net to get a copy of this message | ||
Hello everyone,
In this issue #16761 <https://github.com/php/php-src/issues/16761>
it was
verified that in the above code it should throw a notice for both yields:
```
<?phperror_reporting(E_ALL);function &y()
{
yield null; // warning
yield; // no warning, agreed to be a bug
}foreach (y() as &$y);
```
I have created this PR <https://github.com/php/php-src/pull/16882>
which adds the "missing" notice but we aren't sure on
how to continue on this.
There are 2 main questions:
1. Should we continue with adding the missing notice and merge it
also in master?
2. Should we deprecate / remove the usage of yield without value in
reference generator functions?
- Aggelos Bellos