Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Aug 22, 2024

No description provided.

@staabm
Copy link
Contributor Author

staabm commented Aug 22, 2024

realized we also could do better in == and ===

logged as phpstan/phpstan#11548 as I don't want todo it right now

@@ -323,7 +323,8 @@ public function specifyTypesInCondition(
$argType = $scope->getType($expr->right->getArgs()[0]->value);
if ($argType->isString()->yes()) {
$accessory = new AccessoryNonEmptyStringType();
if ($leftType instanceof ConstantIntegerType && $leftType->getValue() >= 2) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the old code missed to handle $offset which turns into off-by-one errors on smaller/greater comparisons

@ondrejmirtes ondrejmirtes merged commit 1a97440 into phpstan:1.11.x Aug 22, 2024
453 of 463 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

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