Skip to content

Commit

Permalink
Use "numeric-string" return type for methods that return integers as …
Browse files Browse the repository at this point in the history
…strings
  • Loading branch information
phansys committed Feb 7, 2023
1 parent e543ade commit f757fd4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ private function addCriteriaCondition(
* @param array<string, mixed> $criteria
* @param array<int, string|ParameterType|Type>|array<string, string|ParameterType|Type> $types
*
* @return int|string The number of affected rows.
* @return int|numeric-string The number of affected rows.
*
* @throws Exception
*/
Expand Down Expand Up @@ -445,7 +445,7 @@ public function getTransactionIsolation(): TransactionIsolationLevel
* @param array<string, mixed> $criteria
* @param array<int, string|ParameterType|Type>|array<string, string|ParameterType|Type> $types
*
* @return int|string The number of affected rows.
* @return int|numeric-string The number of affected rows.
*
* @throws Exception
*/
Expand Down Expand Up @@ -482,7 +482,7 @@ public function update(string $table, array $data, array $criteria = [], array $
* @param array<string, mixed> $data
* @param array<int, string|ParameterType|Type>|array<string, string|ParameterType|Type> $types
*
* @return int|string The number of affected rows.
* @return int|numeric-string The number of affected rows.
*
* @throws Exception
*/
Expand Down Expand Up @@ -839,6 +839,8 @@ public function executeCacheQuery(string $sql, array $params, array $types, Quer
* @param list<mixed>|array<string, mixed> $params
* @psalm-param WrapperParameterTypeArray $types
*
* @return int|numeric-string
*
* @throws Exception
*/
public function executeStatement(string $sql, array $params = [], array $types = []): int|string
Expand Down Expand Up @@ -878,7 +880,7 @@ public function getTransactionNestingLevel(): int
*
* If the underlying driver does not support identity columns, an exception is thrown.
*
* @return int|string The last insert ID, as an integer or a numeric string.
* @return int|numeric-string The last insert ID, as an integer or a numeric string.
*
* @throws Exception
*/
Expand Down Expand Up @@ -1371,6 +1373,8 @@ private function handleDriverException(
* @param array<int, mixed>|array<string, mixed> $params
* @psalm-param WrapperParameterTypeArray $types
*
* @return int|numeric-string
*
* @throws Exception
*/
public function executeUpdate(string $sql, array $params = [], array $types = []): int|string
Expand All @@ -1392,6 +1396,8 @@ public function query(string $sql): Result
* BC layer for a wide-spread use-case of old DBAL APIs
*
* @deprecated This API is deprecated and will be removed after 2022
*
* @return int|numeric-string
*/
public function exec(string $sql): int|string
{
Expand Down
4 changes: 3 additions & 1 deletion src/Driver/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function quote(string $value): string;
* If the number of affected rows is greater than the maximum int value (PHP_INT_MAX),
* the number of affected rows may be returned as a string.
*
* @return int|numeric-string
*
* @throws Exception
*/
public function exec(string $sql): int|string;
Expand All @@ -57,7 +59,7 @@ public function exec(string $sql): int|string;
* previous statement. DO NOT RELY ON THIS BEHAVIOR which is driver-dependent: always use getLastInsertId() right
* after executing an INSERT statement.
*
* @return int|string The last insert ID, as an integer or a numeric string.
* @return int|numeric-string The last insert ID, as an integer or a numeric string.
*
* @throws Exception
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Driver/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public function fetchFirstColumn(): array;
*
* If the number of rows exceeds {@see PHP_INT_MAX}, it might be returned as string if the driver supports it.
*
* @return int|numeric-string
*
* @throws Exception
*/
public function rowCount(): int|string;
Expand Down
2 changes: 1 addition & 1 deletion src/Query/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public function executeQuery(): Result
*
* Should be used for INSERT, UPDATE and DELETE
*
* @return int|string The number of affected rows.
* @return int|numeric-string The number of affected rows.
*
* @throws Exception
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ public function iterateColumn(): Traversable
*
* If the number of rows exceeds {@see PHP_INT_MAX}, it might be returned as string if the driver supports it.
*
* @return int|numeric-string
*
* @throws Exception
*/
public function rowCount(): int|string
Expand Down
2 changes: 2 additions & 0 deletions src/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ public function executeQuery(): Result
*
* If the number of rows exceeds {@see PHP_INT_MAX}, it might be returned as string if the driver supports it.
*
* @return int|numeric-string
*
* @throws Exception
*/
public function executeStatement(): int|string
Expand Down

0 comments on commit f757fd4

Please sign in to comment.