From 15eb955aeee08c64ec268fd685d899d02a7ba9d3 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Tue, 7 Feb 2023 10:39:52 -0300 Subject: [PATCH] Fix type assumptions about `Connection::lastInsertId()` --- src/Connection.php | 2 -- src/Driver/Connection.php | 4 +--- src/Driver/IBMDB2/Connection.php | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Connection.php b/src/Connection.php index 2549f04132f..1e39b6d214e 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -878,8 +878,6 @@ 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. - * * @throws Exception */ public function lastInsertId(): int|string diff --git a/src/Driver/Connection.php b/src/Driver/Connection.php index f5229a2d298..29b3f3aba62 100644 --- a/src/Driver/Connection.php +++ b/src/Driver/Connection.php @@ -46,7 +46,7 @@ public function exec(string $sql): int|string; /** * Returns the ID of the last inserted row. * - * This method returns an integer or a numeric string representing the value of the auto-increment column + * This method returns an integer or a string representing the value of the auto-increment column * from the last row inserted into the database, if any, or throws an exception if a value cannot be returned, * in particular when: * @@ -57,8 +57,6 @@ 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. - * * @throws Exception */ public function lastInsertId(): int|string; diff --git a/src/Driver/IBMDB2/Connection.php b/src/Driver/IBMDB2/Connection.php index ae437ce3de9..26b288473d4 100644 --- a/src/Driver/IBMDB2/Connection.php +++ b/src/Driver/IBMDB2/Connection.php @@ -77,7 +77,7 @@ public function exec(string $sql): int|string return db2_num_rows($stmt); } - public function lastInsertId(): int|string + public function lastInsertId(): string { $lastInsertId = db2_last_insert_id($this->connection);