Skip to content

Commit 27b10db

Browse files
author
shiomachi
committed
fix
1 parent d7aadbd commit 27b10db

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Type/Php/RoundFunctionReturnTypeExtension.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
use function is_float;
3030
use function is_int;
3131
use function round;
32+
use const PHP_ROUND_HALF_DOWN;
33+
use const PHP_ROUND_HALF_EVEN;
34+
use const PHP_ROUND_HALF_ODD;
35+
use const PHP_ROUND_HALF_UP;
3236

3337
final class RoundFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension
3438
{
@@ -146,7 +150,7 @@ public function resolveConstantType(string $functionName, array $args, Scope $sc
146150
$modeType = $scope->getType($modeArg);
147151
$mode = $modeType->getConstantScalarValues();
148152

149-
if (count($mode) === 1 && is_int($mode[0])) {
153+
if (count($mode) === 1 && in_array($mode[0], [PHP_ROUND_HALF_UP, PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_EVEN, PHP_ROUND_HALF_ODD], true)) {
150154
$proc = static fn ($name) => round($name, $precision, $mode[0]);
151155
}
152156
}

0 commit comments

Comments
 (0)