Skip to content

Commit

Permalink
Remove "plus/minus sign" code
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jun 17, 2024
1 parent 62cc9d7 commit b78860b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
4 changes: 0 additions & 4 deletions src/Types/BigIntType.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ 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 (str_starts_with($value, '+') || $value === '-0') {
$value = substr($value, 1);
}

if ($value === (string) (int) $value) {
return (int) $value;

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

View workflow job for this annotation

GitHub Actions / Static Analysis with Psalm (8.3)

InvalidCast

src/Types/BigIntType.php:55:26: InvalidCast: never cannot be cast to int (see https://psalm.dev/103)
}

Check warning on line 56 in src/Types/BigIntType.php

View check run for this annotation

Codecov / codecov/patch

src/Types/BigIntType.php#L56

Added line #L56 was not covered by tests
Expand Down
7 changes: 0 additions & 7 deletions tests/Functional/Types/BigIntTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,13 @@ public function testSelectBigInt(string $sqlLiteral, int|string|null $expectedVa
public static function provideBigIntLiterals(): Generator
{
yield 'zero' => ['0', 0];
yield 'minus zero' => ['-0', 0];
yield 'plus zero' => ['+0', 0];
yield 'null' => ['null', null];
yield 'positive number' => ['42', 42];
yield 'negative number' => ['-42', -42];
yield 'large positive number' => [PHP_INT_SIZE === 4 ? '2147483646' : '9223372036854775806', PHP_INT_MAX - 1];
yield 'large negative number' => [PHP_INT_SIZE === 4 ? '-2147483647' : '-9223372036854775807', PHP_INT_MIN + 1];
yield 'largest positive number' => [PHP_INT_SIZE === 4 ? '2147483647' : '9223372036854775807', PHP_INT_MAX];
yield 'largest negative number' => [PHP_INT_SIZE === 4 ? '-2147483648' : '-9223372036854775808', PHP_INT_MIN];

yield 'plus largest positive number' => [
PHP_INT_SIZE === 4 ? '+2147483647' : '+9223372036854775807',
PHP_INT_MAX,
];
}

public function testUnsignedBigIntOnMySQL(): void
Expand Down

0 comments on commit b78860b

Please sign in to comment.