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

Enhance type inference for the Dispatch Method by adding a @template Annotation #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rkrx
Copy link

@rkrx rkrx commented Apr 4, 2024

@template was added to indicate that the same type is returned that was passed as an object to the dispatch method. This change is useful because static code analysers would otherwise interpret the return of the dispatch method as a generic object. See before and after.

…Annotation

`@template` was added to indicate that the same type is returned that was passed as an object to the dispatch method. This change is useful because static code analysers would otherwise interpret the return of the dispatch method as a generic object. See [before](https://phpstan.org/r/16b67279-1560-451c-b00d-a9c224864ee2) and [after](https://phpstan.org/r/06555e83-cdcc-45ff-a25f-3024b4b2b1b6).
@Jean85 Jean85 requested a review from Crell April 5, 2024 07:38
@Crell
Copy link
Contributor

Crell commented Apr 5, 2024

We don't yet as FIG have a policy on whether or not to use "extended" docblock syntax like PHPStan and Psalm use. I absolutely agree typing this would be useful, but we should make sure FIG as a whole is on board.

Can you start a brief conversation on list, to get the overall temperature on this question?

@Crell
Copy link
Contributor

Crell commented Apr 5, 2024

(And then there's the divergence from the PSR text itself question to answer, too.)

@WyriHaximus
Copy link
Member

I'm onboard with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants