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

Add some generic information #2439

Merged
merged 1 commit into from May 9, 2022

Conversation

franmomu
Copy link
Contributor

@franmomu franmomu commented May 1, 2022

Q A
Type improvement
BC Break no
Fixed issues

Summary

To reach level 6 of PHPStan the remaining check is about generics, there are ~110 errors. This PR fixes some the "easy" ones.

The rest I guess that will involve making some classes generic (Builder, Query and Aggregate probably) and that would mean more errors and changes.

@franmomu franmomu added this to the 2.4.0 milestone May 1, 2022
@franmomu franmomu added this to 2.4 (in development) in Roadmap May 1, 2022
@franmomu franmomu force-pushed the generics_part_1 branch 2 times, most recently from b8f91d2 to 873a72f Compare May 1, 2022 09:24
Copy link
Member

@IonBazan IonBazan left a comment

Choose a reason for hiding this comment

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

I just wish PHPStan would allow default values for template values.

*
* @return BaseCollection
* @psalm-return BaseCollection<array-key, TDocument>
Copy link
Member

Choose a reason for hiding this comment

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

This looks wrong: TDocument is taken from the parameter (which tells what class should be instantiated) and is definitely not what is later stored in the collection (we don't know what it'll be at this point). The only thing we can be kind-of-certain is that $collectionClass is a descendant of the Collection interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, totally right, I missed this, thanks!

@malarzm malarzm modified the milestones: 2.4.0, 2.5.0 May 8, 2022
@SenseException SenseException merged commit 4beddcf into doctrine:2.4.x May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Roadmap
2.4 (bug fixes only)
Development

Successfully merging this pull request may close these issues.

None yet

4 participants