Welcome! Log In Create A New Profile

Advanced

[PHP-DEV] Generator::

Posted by Christoph M. Becker 
Christoph M. Becker
[PHP-DEV] Generator::
March 16, 2018 04:50PM
Hi everybody!

Wrt. https://bugs.php.net/76104 I wonder whether the behavior has
actually been deliberately designed this way (i.e. whether it is indeed
a documentation issue).

Consider the following variation of the Generator::send() example:
https://3v4l.org/vbbZM. I certainly would not expect `NULL` as fourth
line of the output, but rather `int(1)`.

Can somebody please clarify?

--
Christoph M. Becker

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Nikita Popov
Re: [PHP-DEV] Generator::
March 16, 2018 05:10PM
On Fri, Mar 16, 2018 at 4:44 PM, Christoph M. Becker <[email protected]>
wrote:

> Hi everybody!
>
> Wrt. https://bugs.php.net/76104 I wonder whether the behavior has
> actually been deliberately designed this way (i.e. whether it is indeed
> a documentation issue).
>
> Consider the following variation of the Generator::send() example:
> https://3v4l.org/vbbZM. I certainly would not expect `NULL` as fourth
> line of the output, but rather `int(1)`.
>
> Can somebody please clarify?
>

Yes, this is working as intended. next() is equivalent to send(null),
modulo the return value.

Nikita
Christoph M. Becker
Re: [PHP-DEV] Generator::
March 16, 2018 05:30PM
On 16.03.2018 at 17:00, Nikita Popov wrote:

> On Fri, Mar 16, 2018 at 4:44 PM, Christoph M. Becker <[email protected]>
> wrote:
>
>> Wrt. https://bugs.php.net/76104 I wonder whether the behavior has
>> actually been deliberately designed this way (i.e. whether it is indeed
>> a documentation issue).
>>
>> Consider the following variation of the Generator::send() example:
>> https://3v4l.org/vbbZM. I certainly would not expect `NULL` as fourth
>> line of the output, but rather `int(1)`.
>>
>> Can somebody please clarify?
>
> Yes, this is working as intended. next() is equivalent to send(null),
> modulo the return value.

Ah, now I see! Thanks!

--
Christoph M. Becker

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login