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

Document generics order for PriorityQueue and SplPriorityQueue #72

Merged
merged 3 commits into from
Aug 24, 2022

Conversation

gsteel
Copy link
Member

@gsteel gsteel commented Aug 23, 2022

Q A
Documentation yes
Bugfix yes

Reference #71

Previously implemented template order did not match those of native SplPriorityQueue, i.e. \SplPriorityQueue<TPriority, TValue> - instead the templates were back-to-front.

It's decided that 'fixing' the order of the placeholders will be inconvenient for users that have already implemented templates with the existing order.

  • PriorityQueue value template renamed from T to TValue
  • Removes attempt to document internal array priority, adding resulting psalm issues to the baseline. Users will typically insert with an integer priority and shouldn't care that internally an array is used to represent priority - also, an array for \SplPriorityQueue priority is effectively an invalid argument according to stubs - this is better off in the baseline right?

gsteel added 2 commits August 23, 2022 14:08
Closes laminas#71

Previously implemented template order did not match those of native SplPriorityQueue, i.e. \SplPriorityQueue<TPriority, TValue> - instead the templates were back-to-front.

- PriorityQueue order is fixed and a test case added
- PriorityQueue value template renamed from `T` to `TValue`
- SplPriorityQueue order fixed and test case added
- Removes attempt to document internal array priority, adding resulting psalm issues to the baseline. Users will typically insert with an integer priority and shouldn't care that internally an array is used to represent priority - also, an array for \SplPriorityQueue priority is effectively an invalid argument according to stubs - this is better off in the baseline right?

Signed-off-by: George Steel <[email protected]>
@gsteel gsteel added Bug Something isn't working Documentation labels Aug 23, 2022
@gsteel
Copy link
Member Author

gsteel commented Aug 23, 2022

Not sure if this should target 3.12.1 or 3.13.0 ?

@Ocramius
Copy link
Member

@gsteel if this is a bugfix, 3.12.x IMO.

@gsteel gsteel changed the base branch from 3.13.x to 3.12.x August 23, 2022 15:49
@gsteel gsteel added this to the 3.12.1 milestone Aug 23, 2022
@boesing
Copy link
Member

boesing commented Aug 23, 2022

This would possibly break upstream projects which already spent time in fixing their code.

Yes, this looks correct to me but technically, it was not incorrect before.
Do we really want introduce this in a Patch?

@boesing
Copy link
Member

boesing commented Aug 23, 2022

ah this is only released for a few hours, maybe we can Patch it 👌🏻

@gsteel
Copy link
Member Author

gsteel commented Aug 23, 2022

Generics were introduced and released in #58 and #59 back in June

@boesing
Copy link
Member

boesing commented Aug 23, 2022

Oh, thats been a while. Not sure if we should annoy upstream devs who spent time to fix their static analysis. Do we have other thoughts?

@gsteel
Copy link
Member Author

gsteel commented Aug 23, 2022

Not sure if we should annoy upstream devs who spent time to fix their static analysis

I guess it depends whether we consider the original template order a bug or not - IMO it's a bug - aligning with PHP's SplPriorityQueue and psalms stubs should be a given. Not annoying devs with this is really valid, but the longer it's left, the more people we annoy?

This will already affect one or two laminas packages I think… view, maybe validator, possibly others. My bad! Sorry…

@internalsystemerror
Copy link
Member

Oh, thats been a while. Not sure if we should annoy upstream devs who spent time to fix their static analysis. Do we have other thoughts?

It's also possible, if this is a bug, that devs who already implemented correct static analysis have been annoyed by this break, so would appreciate this fix.

@Ocramius
Copy link
Member

Discussed in chat: clarifying template types is OK, but swapping order will likely just lead to unnecessary downstream breakages.

Yes, it is annoying that the generic types are inverted in our implementation, but it is just that: annoying. Not a major deal breaker.

@gsteel gsteel changed the base branch from 3.12.x to 3.13.x August 24, 2022 13:48
@gsteel gsteel changed the title Fixes generics order for PriorityQueue and SplPriorityQueue Document generics order for PriorityQueue and SplPriorityQueue Aug 24, 2022
@gsteel gsteel removed the Bug Something isn't working label Aug 24, 2022
@gsteel gsteel modified the milestones: 3.12.1, 3.13.0 Aug 24, 2022
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

🚢

@Ocramius Ocramius merged commit 66a6d03 into laminas:3.13.x Aug 24, 2022
@gsteel gsteel deleted the fix-generics-order branch August 24, 2022 13:57
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.

4 participants