Skip to content

Added stubs for SplDoublyLinkedList, SplQueue and SplPriorityQueue#205

Closed
dktapps wants to merge 2 commits intophpstan:masterfrom
pmmp:spl-queue-stubs
Closed

Added stubs for SplDoublyLinkedList, SplQueue and SplPriorityQueue#205
dktapps wants to merge 2 commits intophpstan:masterfrom
pmmp:spl-queue-stubs

Conversation

@dktapps
Copy link
Copy Markdown
Contributor

@dktapps dktapps commented May 16, 2020

I made these for a project I'm working on, perhaps they'll be useful to someone else :)

NB: SplPriorityQueue is very nasty because the return types depend on the extract flags, which aren't available in the type system. It might be necessary to implement a dynamic return type extension for those.

ondrejmirtes and others added 2 commits May 22, 2020 18:17
I made these for a project I'm working on, perhaps they'll be useful to someone else :)
@ondrejmirtes
Copy link
Copy Markdown
Member

Merged, thank you! 6a38951

It might be necessary to implement a dynamic return type extension for those.

Yes, please do that :)

@dktapps
Copy link
Copy Markdown
Contributor Author

dktapps commented May 30, 2020

I had a think about how to do this and the problem I keep running into is that the information needed to decide what the extract flags of PriorityQueue are is not present in the type system. If an SplPriorityQueue is passed to a function parameter, the callee doesn't know from the type system what the extract flags are.
@ondrejmirtes do you have any idea how such a problem can be solved? I'm dubious whether it's worth the time tbh; I may just create wrapper classes which seal this nastiness away (or use Ds\PriorityQueue instead).

@ondrejmirtes
Copy link
Copy Markdown
Member

Can you show a piece of code that demonstrates the problem you're facing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants