Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7.0: New sniff to detect generator return expressions #618

Merged
merged 1 commit into from Mar 18, 2018

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Mar 17, 2018

Generator Return Expressions

This feature builds upon the generator functionality introduced into PHP 5.5. It enables for a return statement to be used within a generator to enable for a final expression to be returned (return by reference is not allowed). > This value can be fetched using the new Generator::getReturn() method, which may only be used once the generator has finished yielding values.

Refs:

The new sniff checks for and reports on return statements being found in generator functions.

Includes unit tests.

> Generator Return Expressions
>
> This feature builds upon the generator functionality introduced into PHP 5.5. It enables for a `return` statement to be used within a generator to enable for a final expression to be returned (return by reference is not allowed). > This value can be fetched using the new `Generator::getReturn()` method, which may only be used once the generator has finished yielding values.

Refs:
* http://php.net/manual/en/migration70.new-features.php#migration70.new-features.generator-return-expressions
* https://wiki.php.net/rfc/generator-return-expressions
> php/php-src@5c230ba

The new sniff checks for and reports on `return` statements being found in generator functions.

Includes unit tests.
@jrfnl jrfnl added this to the 8.2.0 milestone Mar 17, 2018
@jrfnl jrfnl requested a review from wimg March 17, 2018 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants