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

str_split() length parameter is always positive #631

Merged
merged 1 commit into from Aug 20, 2021

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Aug 20, 2021

@@ -11696,7 +11696,7 @@
'str_replace' => ['string|array', 'search'=>'string|array', 'replace'=>'string|array', 'subject'=>'string|array', '&w_replace_count='=>'int'],
'str_rot13' => ['string', 'str'=>'string'],
'str_shuffle' => ['string', 'str'=>'string'],
'str_split' => ['array<int,string>|false', 'str'=>'string', 'split_length='=>'int'],
'str_split' => ['array<int,string>|false', 'str'=>'string', 'split_length='=>'positive-int'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

str_split always returns a non-empty array.. I tried adding this here, but it seems the &nonEmpty signature doesn't work from this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since maybe controversial, put it into a separate PR:
#632

Copy link
Member

Choose a reason for hiding this comment

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

The correct is 'non-empty-array<int,string>|false'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahh makes sense.. #633

@ondrejmirtes ondrejmirtes merged commit 15a0ff0 into phpstan:master Aug 20, 2021
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the positive-split-length branch August 20, 2021 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants