Skip to content

Conversation

duncan3dc
Copy link
Member

As pointed out on internals there is a valid yield syntax that is not currently tested for.

I've attempted to add a test for this, let me know if there's anything that needs changing or doesn't make sense.

@pierredup
Copy link

What about testing the +, - and / operators as well?
There seems to already be a regression when using operators on yield since PHP 7

https://bugs.php.net/bug.php?id=69160
http://3v4l.org/JQdt6
http://3v4l.org/U5iki

@duncan3dc duncan3dc force-pushed the yield-with-operator branch from 9af1365 to b10ebfd Compare March 2, 2015 16:07
@duncan3dc
Copy link
Member Author

I've updated the test with the other operators now, and + & - are failing, as reported by @pierredup

@php-pulls
Copy link

Comment on behalf of bwoebi at php.net:

How can I now yield a literal negative number?

yield -1; does what? It yields -1 (in 5.5/5.6 too). [As long as it's a standalone statement, or it will require parenthesis in PHP 5.x.]

Now it'd be very surprising if that changed and yielded null (the implicit default value) in PHP 7.
Or do you want to really make behavior dependent on if the return value is used? That'd be really weird...

Closing as bogus test (Bug report left open for @nikic to add a note to UPGRADING).

I will add some test for the new behavior though, to explicitly document that.

@php-pulls php-pulls closed this Mar 7, 2015
@duncan3dc duncan3dc deleted the yield-with-operator branch September 9, 2015 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants