Skip to content

Commit

Permalink
Keep original condition
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Oct 1, 2024
1 parent d732dd4 commit 366175c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Types/BigIntType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use function is_int;
use function is_string;

use const PHP_INT_MAX;
use const PHP_INT_MIN;

/**
* Type that attempts to map a database BIGINT to a PHP int.
*
Expand Down Expand Up @@ -49,7 +52,10 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): int
'DBAL assumes values outside of the integer range to be returned as string by the database driver.',
);

if ($value === (string) (int) $value) {
if (
($value > PHP_INT_MIN && $value < PHP_INT_MAX)
|| $value === (string) (int) $value

Check failure on line 57 in src/Types/BigIntType.php

View workflow job for this annotation

GitHub Actions / Static Analysis with Psalm (8.3)

TypeDoesNotContainType

src/Types/BigIntType.php:57:16: TypeDoesNotContainType: Type never for $value is never =string(1) (see https://psalm.dev/056)

Check failure on line 57 in src/Types/BigIntType.php

View workflow job for this annotation

GitHub Actions / Static Analysis with Psalm (8.3)

InvalidCast

src/Types/BigIntType.php:57:42: InvalidCast: never cannot be cast to int (see https://psalm.dev/103)
) {
return (int) $value;
}

Expand Down

0 comments on commit 366175c

Please sign in to comment.