Skip to content

FR: a way to have the return type of yield inferred from the yielded type #4245

@dktapps

Description

@dktapps

Feature request

I thought it would be nice to be able to implement an await-like pattern using generic Promises and generators.

Sadly, I don't seem to be able to make PHPStan understand that the result of yield is dependent on the type of promise yielded.

Is this something that would be good for PHPStan itself, or is there a way that this could be implemented by an extension?

https://phpstan.org/r/235a7674-8514-4c68-969c-c97740151188

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions