count(non-empty-array, COUNT_RECURSIVE) is int<1, max>#4515
Merged
ondrejmirtes merged 14 commits intophpstan:2.1.xfrom Dec 6, 2025
Merged
count(non-empty-array, COUNT_RECURSIVE) is int<1, max>#4515ondrejmirtes merged 14 commits intophpstan:2.1.xfrom
count(non-empty-array, COUNT_RECURSIVE) is int<1, max>#4515ondrejmirtes merged 14 commits intophpstan:2.1.xfrom
Conversation
staabm
commented
Nov 7, 2025
| } | ||
|
|
||
| return $scope->getType($functionCall->getArgs()[0]->value)->getArraySize(); | ||
| return $scope->getType($args[0]->value)->getArraySize(); |
Contributor
Author
There was a problem hiding this comment.
maybe put the COUNT_MODE onto Type->getArraySize() as a first parameter
ondrejmirtes
requested changes
Nov 7, 2025
Member
ondrejmirtes
left a comment
There was a problem hiding this comment.
What about the mutants? 😊
Contributor
Author
|
I cannot think of a test I am missing and which could kill the mutant |
d52ed95 to
9d8c80e
Compare
ondrejmirtes
requested changes
Dec 5, 2025
src/Type/IntersectionType.php
Outdated
| return $this->intersectTypes(static fn (Type $type): Type => $type->getArraySize()); | ||
| $arraySize = $this->intersectTypes(static fn (Type $type): Type => $type->getArraySize()); | ||
|
|
||
| if ($arraySize instanceof IntegerRangeType) { |
Member
There was a problem hiding this comment.
What about unions of integer ranges?
Contributor
Author
There was a problem hiding this comment.
rewrote it to get rid of the instanceof check.
Contributor
Author
|
@ondrejmirtes mutants killed. |
Member
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this PR it was taken as
int<0, max>