Skip to content

Commit

Permalink
try reducing unnecessary work
Browse files Browse the repository at this point in the history
  • Loading branch information
clxmstaab committed Apr 28, 2022
1 parent e55c37d commit 3b176ac
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/Analyser/TypeSpecifier.php
Expand Up @@ -251,15 +251,18 @@ public function specifyTypesInCondition(
&& isset($exprNode->getArgs()[0])
&& $constantType instanceof ConstantStringType
&& $constantType->getValue() !== ''
&& $scope->getType($exprNode->getArgs()[0]->value)->isString()->yes()
) {
return $this->create(
$exprNode->getArgs()[0]->value,
TypeCombinator::intersect($scope->getType($exprNode->getArgs()[0]->value), new AccessoryNonEmptyStringType()),
$context,
false,
$scope
);
$argType = $scope->getType($exprNode->getArgs()[0]->value);

if ($argType->isString()->yes() && !$argType->isNonEmptyString()->yes()) {
return $this->create(
$exprNode->getArgs()[0]->value,
TypeCombinator::intersect($argType, new AccessoryNonEmptyStringType()),
$context,
false,
$scope,
);
}
}
}

Expand Down

0 comments on commit 3b176ac

Please sign in to comment.