Skip to content

Improve return types of explode() with limit#2286

Merged
muglug merged 1 commit intovimeo:masterfrom
shira-374:improve-explode-handling
Nov 2, 2019
Merged

Improve return types of explode() with limit#2286
muglug merged 1 commit intovimeo:masterfrom
shira-374:improve-explode-handling

Conversation

@shira-374
Copy link
Copy Markdown

Currently, explode() calls with 3 arguments are skipped by FunctionAnalyzer and fallback to the default array<int, string>|false return type.

https://psalm.dev/r/2fecda20b4

This PR aims to improve this by extending the existing rules by:

  • explode() with $limit >= 0 should always return a non-empty list
  • explode() with $limit < 0 (or dynamic) may return an empty list

@muglug muglug merged commit b229ac8 into vimeo:master Nov 2, 2019
@muglug
Copy link
Copy Markdown
Collaborator

muglug commented Nov 2, 2019

Thanks!

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