Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow generators to have a real return type of mixed#5626

Closed
TysonAndre wants to merge 1 commit into
php:masterphp/php-src:masterfrom
TysonAndre:mixed-generatorTysonAndre/php-src:mixed-generatorCopy head branch name to clipboard
Closed

Allow generators to have a real return type of mixed#5626
TysonAndre wants to merge 1 commit into
php:masterphp/php-src:masterfrom
TysonAndre:mixed-generatorTysonAndre/php-src:mixed-generatorCopy head branch name to clipboard

Conversation

@TysonAndre
Copy link
Copy Markdown
Contributor

Fixes an edge case overlooked in
#5313

@TysonAndre
Copy link
Copy Markdown
Contributor Author

The travis build failure was caused by Fixed JIT for SEND_VAR $undefined_cv (the commit already has a comment about the failure), and is unrelated to this.

Comment thread Zend/zend_compile.c Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should actually check for & (MAY_BE_ITERATABLE|MAY_BE_OBJECT) != 0. : object is also a fine type.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At which point we should really adjust the error message to be generic and not list every single possible type. Something along the lines of...

Cannot use %s as generator return type, because it is not a supertype of Generator

Generator return type must be a supertype of Generator, %s given

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Fixes an edge case overlooked in
php#5313

Generators are objects, so `object` should have also been allowed in addition to
`iterable` and `Traversable`
@kocsismate
Copy link
Copy Markdown
Member

Thank you, @TysonAndre!

@php-pulls php-pulls closed this in 9b33272 May 26, 2020
@TysonAndre TysonAndre deleted the mixed-generator branch November 25, 2021 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.