Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Aug 22, 2024

closes phpstan/phpstan#11548


after implementing I realized this also makes count($arr) == integer-range narrow to non-empty-array

Copy link
Contributor Author

Choose a reason for hiding this comment

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

inspired by the previous loop with constant-strings, I have added a similar case for integer ranges

Comment on lines -1093 to -1096
Copy link
Contributor Author

Choose a reason for hiding this comment

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

looked like dead code

@staabm staabm marked this pull request as ready for review August 26, 2024 07:34
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@staabm staabm marked this pull request as draft August 26, 2024 08:17
@staabm staabm marked this pull request as ready for review August 26, 2024 09:25
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@staabm staabm marked this pull request as draft August 27, 2024 08:11
Copy link
Contributor Author

Choose a reason for hiding this comment

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

in a followup PR I would factor out the 2 $constantType instanceof ConstantIntegerType if-blocks of this method into the parent caller and do a proper integer range check instead, which will fix phpstan/phpstan#11558

I don't do it now to keep this PR simpler and the next one will also be easier to review

@staabm staabm marked this pull request as ready for review August 27, 2024 08:28
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

simplify Update TypeSpecifier.php Update TypeSpecifier.php remove seemingly dead code Update strlen-int-range.php more tests more tests test count on int-range more tests more assertions fix negative context cs simplify
@staabm staabm changed the base branch from 1.11.x to 1.12.x August 27, 2024 14:10
@ondrejmirtes ondrejmirtes merged commit 562b730 into phpstan:1.12.x Aug 29, 2024
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the bug11548 branch August 29, 2024 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants