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

Narrow explode return to constant arrays for small positive limits #3708

Draft
wants to merge 1 commit into
base: 1.12.x
Choose a base branch
from

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Dec 4, 2024

Related to phpstan/phpstan#12187

kept this simple and only handle a single constant limit on purpose for now

Needs #3709 first

@herndlm herndlm force-pushed the explode-const-arrays branch from afe6896 to 1b46208 Compare December 4, 2024 16:05
Copy link
Contributor

@staabm staabm left a comment

Choose a reason for hiding this comment

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

to cover the initial request of the discussion, I think it would be useful to assert the result of
explode(',', $date, 2) + [1 => null] in the tests

@staabm
Copy link
Contributor

staabm commented Dec 4, 2024

I guess you saw it already yourself, but just in case: seems you found a case in which we miss to narrow a constant arrays optional offsets :-)

https://phpstan.org/r/6286a642-020a-4e53-b713-72994a0bbcad

@herndlm
Copy link
Contributor Author

herndlm commented Dec 4, 2024

Yes, was creating a similar example in parallel (https://phpstan.org/r/d6b8098a-282b-47cd-be91-38e42401d1eb) :) let's fix that first..

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