Skip to content

Commit 9ab5547

Browse files
shiomachiShioPy0101
authored andcommitted
fix
1 parent 83af3d5 commit 9ab5547

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/Type/Php/RoundFunctionReturnTypeExtension.php‎

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

3438
#[AutowiredService]
3539
final class RoundFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension
@@ -157,7 +161,7 @@ public function resolveConstantType(string $functionName, array $args, Scope $sc
157161
$modeType = $scope->getType($modeArg);
158162
$mode = $modeType->getConstantScalarValues();
159163

160-
if (count($mode) === 1 && is_int($mode[0])) {
164+
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)) {
161165
$proc = static fn ($name) => round($name, $precision, $mode[0]);
162166
}
163167
}

0 commit comments

Comments
 (0)