Skip to content

Commit

Permalink
Fix #19176: Add #[\ReturnTypeWillChange] on MSSQL classes (#19177)
Browse files Browse the repository at this point in the history
  • Loading branch information
achretien committed Jan 20, 2022
1 parent 67ea4cf commit 942e726
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions framework/db/mssql/DBLibPDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class DBLibPDO extends \PDO
* @param string|null $name the sequence name. Defaults to null.
* @return int last inserted ID value.
*/
#[\ReturnTypeWillChange]
public function lastInsertId($name = null)
{
return $this->query('SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS bigint)')->fetchColumn();
Expand All @@ -35,6 +36,7 @@ public function lastInsertId($name = null)
* @return mixed A successful call returns the value of the requested PDO attribute.
* An unsuccessful call returns null.
*/
#[\ReturnTypeWillChange]
public function getAttribute($attribute)
{
try {
Expand Down
5 changes: 5 additions & 0 deletions framework/db/mssql/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class PDO extends \PDO
* @param string|null $sequence the sequence name. Defaults to null.
* @return int last inserted ID value.
*/
#[\ReturnTypeWillChange]
public function lastInsertId($sequence = null)
{
return $this->query('SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS bigint)')->fetchColumn();
Expand All @@ -31,6 +32,7 @@ public function lastInsertId($sequence = null)
* natively support transactions.
* @return bool the result of a transaction start.
*/
#[\ReturnTypeWillChange]
public function beginTransaction()
{
$this->exec('BEGIN TRANSACTION');
Expand All @@ -43,6 +45,7 @@ public function beginTransaction()
* natively support transactions.
* @return bool the result of a transaction commit.
*/
#[\ReturnTypeWillChange]
public function commit()
{
$this->exec('COMMIT TRANSACTION');
Expand All @@ -55,6 +58,7 @@ public function commit()
* natively support transactions.
* @return bool the result of a transaction roll back.
*/
#[\ReturnTypeWillChange]
public function rollBack()
{
$this->exec('ROLLBACK TRANSACTION');
Expand All @@ -71,6 +75,7 @@ public function rollBack()
* @return mixed A successful call returns the value of the requested PDO attribute.
* An unsuccessful call returns null.
*/
#[\ReturnTypeWillChange]
public function getAttribute($attribute)
{
try {
Expand Down
1 change: 1 addition & 0 deletions framework/db/mssql/SqlsrvPDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SqlsrvPDO extends \PDO
* @param string|null $sequence the sequence name. Defaults to null.
* @return int last inserted ID value.
*/
#[\ReturnTypeWillChange]
public function lastInsertId($sequence = null)
{
return !$sequence ? parent::lastInsertId() : parent::lastInsertId($sequence);
Expand Down

0 comments on commit 942e726

Please sign in to comment.