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

improve array_splice inference #5738

Merged
merged 1 commit into from May 10, 2021
Merged

improve array_splice inference #5738

merged 1 commit into from May 10, 2021

Conversation

orklah
Copy link
Collaborator

@orklah orklah commented May 9, 2021

This should fix #5678

I mainly used array_slice return type provider to adapt it, this will be better than before but there is definitely some improvements to be made:

  1. I'm not sure what this does: https://github.com/vimeo/psalm/compare/master...orklah:array_splice?expand=1#diff-5953e521e3d01187b486b9c7a2e7e57ca6c4aa65886e4825c1bc765de64029cbR50
  2. The fourth param should be used to infer the return type. Right now I'm only using the first one.
  3. There is a reference for the first param that should be treated the same way
  4. I only return list<int>, list<string> or list<mixed> to avoid making a really long list. I searched for a method that would widen a type to standard scalars (for example 'foo'|'bar' would become string) but I couldn't find it

@muglug muglug merged commit 7202213 into vimeo:master May 10, 2021
@muglug
Copy link
Collaborator

muglug commented May 10, 2021

Thanks!

@orklah orklah deleted the array_splice branch September 14, 2021 17:39
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.

Return value of array_splice should be of a list type
2 participants