Skip to content

Commit

Permalink
numeric precision 0 is int
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerin committed Jan 8, 2025
1 parent ae2b10c commit 3536cbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Drivers/PdoSqlsrv/PdoSqlsrvResultAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public function getTypes(): array
throw new InvalidStateException("Should not happen.");
}
$types[$field['name']] = $field['sqlsrv:decl_type'] ?? null; // @phpstan-ignore-line
if($types[$field['name']] === 'numeric' && $field['precision'] === 0) {

Check failure on line 81 in src/Drivers/PdoSqlsrv/PdoSqlsrvResultAdapter.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Result of && is always false.

Check failure on line 81 in src/Drivers/PdoSqlsrv/PdoSqlsrvResultAdapter.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Strict comparison using === between null and 'numeric' will always evaluate to false.

Check failure on line 81 in src/Drivers/PdoSqlsrv/PdoSqlsrvResultAdapter.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2)

Result of && is always false.

Check failure on line 81 in src/Drivers/PdoSqlsrv/PdoSqlsrvResultAdapter.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2)

Strict comparison using === between null and 'numeric' will always evaluate to false.

Check failure on line 81 in src/Drivers/PdoSqlsrv/PdoSqlsrvResultAdapter.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3)

Result of && is always false.

Check failure on line 81 in src/Drivers/PdoSqlsrv/PdoSqlsrvResultAdapter.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3)

Strict comparison using === between null and 'numeric' will always evaluate to false.

Check failure on line 81 in src/Drivers/PdoSqlsrv/PdoSqlsrvResultAdapter.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4)

Result of && is always false.

Check failure on line 81 in src/Drivers/PdoSqlsrv/PdoSqlsrvResultAdapter.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4)

Strict comparison using === between null and 'numeric' will always evaluate to false.
$types[$field['name']] ='int';
}
}

return $types;
Expand Down
1 change: 0 additions & 1 deletion src/Drivers/PdoSqlsrv/PdoSqlsrvResultNormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public function resolve(array $types): array
'int' => true,
'smallint' => true,
'tinyint' => true,
'numeric' => true,
];

static $dateTimes = [
Expand Down

0 comments on commit 3536cbf

Please sign in to comment.