Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Nov 2, 2025

Before this PR it was taken as int<0, max>

}

return $scope->getType($functionCall->getArgs()[0]->value)->getArraySize();
return $scope->getType($args[0]->value)->getArraySize();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe put the COUNT_MODE onto Type->getArraySize() as a first parameter

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

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

What about the mutants? 😊

@staabm
Copy link
Contributor Author

staabm commented Nov 8, 2025

I cannot think of a test I am missing and which could kill the mutant therefore I simplified the implementation

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

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

And escaped mutants :)

return $this->intersectTypes(static fn (Type $type): Type => $type->getArraySize());
$arraySize = $this->intersectTypes(static fn (Type $type): Type => $type->getArraySize());

if ($arraySize instanceof IntegerRangeType) {
Copy link
Member

Choose a reason for hiding this comment

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

What about unions of integer ranges?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rewrote it to get rid of the instanceof check.

@staabm
Copy link
Contributor Author

staabm commented Dec 5, 2025

@ondrejmirtes mutants killed.

@ondrejmirtes ondrejmirtes merged commit 99001bc into phpstan:2.1.x Dec 6, 2025
636 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the recurs branch December 6, 2025 12:43
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