Skip to content

Commit 7b09276

Browse files
Div returns only DivisionByZeroError
1 parent e62cf84 commit 7b09276

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/Rules/ThrowsPhpDocRule.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -698,21 +698,16 @@ private function processFuncCall(FuncCall $node, Scope $scope): array
698698
*/
699699
private function processDiv(Expr $divisor, Scope $scope): array
700700
{
701-
$divisionByZero = false;
702701
$divisorType = $scope->getType($divisor);
703702
foreach (TypeUtils::getConstantScalars($divisorType) as $constantScalarType) {
704703
if ($constantScalarType->getValue() === 0) {
705-
$divisionByZero = true;
704+
return $this->processThrowsTypes(new ObjectType(DivisionByZeroError::class));
706705
}
707706

708707
$divisorType = TypeCombinator::remove($divisorType, $constantScalarType);
709708
}
710709

711710
if (!$divisorType instanceof NeverType) {
712-
return $this->processThrowsTypes(new ObjectType(ArithmeticError::class));
713-
}
714-
715-
if ($divisionByZero) {
716711
return $this->processThrowsTypes(new ObjectType(DivisionByZeroError::class));
717712
}
718713

0 commit comments

Comments
 (0)