Skip to content

Commit

Permalink
Remove "allow trailing zeros" code
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jun 17, 2024
1 parent 2cc0fae commit 62cc9d7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
7 changes: 0 additions & 7 deletions src/Types/BigIntType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
use function assert;
use function is_int;
use function is_string;
use function rtrim;
use function str_starts_with;
use function strpos;
use function substr;

/**
Expand Down Expand Up @@ -53,11 +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.',
);

$dotPos = strpos($value, '.');
if ($dotPos !== false && rtrim(substr($value, $dotPos + 1), '0') === '') {
$value = substr($value, 0, $dotPos);
}

if (str_starts_with($value, '+') || $value === '-0') {

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

View workflow job for this annotation

GitHub Actions / Static Analysis with Psalm (8.3)

TypeDoesNotContainType

src/Types/BigIntType.php:54:45: TypeDoesNotContainType: Type never for $value is never =string(-0) (see https://psalm.dev/056)
$value = substr($value, 1);

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

View check run for this annotation

Codecov / codecov/patch

src/Types/BigIntType.php#L55

Added line #L55 was not covered by tests
}
Expand Down
12 changes: 0 additions & 12 deletions tests/Functional/Types/BigIntTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@ public function testSelectBigInt(string $sqlLiteral, int|string|null $expectedVa
Types::BIGINT,
),
);

if ($expectedValue === null) {
return;
}

self::assertSame(
$expectedValue,
$this->connection->convertToPHPValue(
$sqlLiteral . '.00',
Types::BIGINT,
),
);
}

/** @return Generator<string, array{string, int|string|null}> */
Expand Down

0 comments on commit 62cc9d7

Please sign in to comment.