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 more iterable types #2436

Merged
merged 2 commits into from
Apr 30, 2022
Merged

Conversation

franmomu
Copy link
Contributor

@franmomu franmomu commented Apr 29, 2022

Q A
Type improvement
BC Break no
Fixed issues

Summary

Follow-up of #2433

With this finishes adding iterable types in lib directory, next PR will add iterable types in tests and will add the PHPStan check.

The ignored issues in PHPStan are expected, one is because the type is incorrect and that's what the test is checking (same for Psalm) and the other issues are because PHPStan doesn't yet understand importing custom types in traits.

@franmomu franmomu added this to the 2.4.0 milestone Apr 29, 2022
@franmomu franmomu force-pushed the specify_iterator_types_rest branch from b31d077 to 9184b44 Compare April 29, 2022 18:49
* @param array<string, int|string|array<string, string>> $fields
* @psalm-param SortShape $fields
*
* @psalm-return array<string, -1|1|array{"$meta": 'textScore'}>
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand how array{"$meta": 'textScore'} fits into the sorting, but it seems the CI is happy with it. Maybe it's worth to put the type into a class and import it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 I've created a type, the thing here is that I think this is only used for aggregations: https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/#mongodb-pipeline-pipe.-sort but these methods are used for queries and aggregations.

@franmomu franmomu force-pushed the specify_iterator_types_rest branch from 9184b44 to 94773b1 Compare April 30, 2022 06:40
@franmomu franmomu force-pushed the specify_iterator_types_rest branch from 94773b1 to 33d4765 Compare April 30, 2022 06:42
@franmomu franmomu merged commit 6d5fc5b into doctrine:2.4.x Apr 30, 2022
@franmomu franmomu deleted the specify_iterator_types_rest branch April 30, 2022 11:20
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.

2 participants