Browse Source

Fix #19176: Add #[\ReturnTypeWillChange] on MSSQL classes (#19177)

tags/2.0.45
Aurélien Chretien 3 years ago committed by GitHub
parent
commit
942e726a8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      framework/db/mssql/DBLibPDO.php
  2. 5
      framework/db/mssql/PDO.php
  3. 1
      framework/db/mssql/SqlsrvPDO.php

2
framework/db/mssql/DBLibPDO.php

@ -21,6 +21,7 @@ class DBLibPDO extends \PDO
* @param string|null $name the sequence name. Defaults to null. * @param string|null $name the sequence name. Defaults to null.
* @return int last inserted ID value. * @return int last inserted ID value.
*/ */
#[\ReturnTypeWillChange]
public function lastInsertId($name = null) public function lastInsertId($name = null)
{ {
return $this->query('SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS bigint)')->fetchColumn(); return $this->query('SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS bigint)')->fetchColumn();
@ -35,6 +36,7 @@ class DBLibPDO extends \PDO
* @return mixed A successful call returns the value of the requested PDO attribute. * @return mixed A successful call returns the value of the requested PDO attribute.
* An unsuccessful call returns null. * An unsuccessful call returns null.
*/ */
#[\ReturnTypeWillChange]
public function getAttribute($attribute) public function getAttribute($attribute)
{ {
try { try {

5
framework/db/mssql/PDO.php

@ -21,6 +21,7 @@ class PDO extends \PDO
* @param string|null $sequence the sequence name. Defaults to null. * @param string|null $sequence the sequence name. Defaults to null.
* @return int last inserted ID value. * @return int last inserted ID value.
*/ */
#[\ReturnTypeWillChange]
public function lastInsertId($sequence = null) public function lastInsertId($sequence = null)
{ {
return $this->query('SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS bigint)')->fetchColumn(); return $this->query('SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS bigint)')->fetchColumn();
@ -31,6 +32,7 @@ class PDO extends \PDO
* natively support transactions. * natively support transactions.
* @return bool the result of a transaction start. * @return bool the result of a transaction start.
*/ */
#[\ReturnTypeWillChange]
public function beginTransaction() public function beginTransaction()
{ {
$this->exec('BEGIN TRANSACTION'); $this->exec('BEGIN TRANSACTION');
@ -43,6 +45,7 @@ class PDO extends \PDO
* natively support transactions. * natively support transactions.
* @return bool the result of a transaction commit. * @return bool the result of a transaction commit.
*/ */
#[\ReturnTypeWillChange]
public function commit() public function commit()
{ {
$this->exec('COMMIT TRANSACTION'); $this->exec('COMMIT TRANSACTION');
@ -55,6 +58,7 @@ class PDO extends \PDO
* natively support transactions. * natively support transactions.
* @return bool the result of a transaction roll back. * @return bool the result of a transaction roll back.
*/ */
#[\ReturnTypeWillChange]
public function rollBack() public function rollBack()
{ {
$this->exec('ROLLBACK TRANSACTION'); $this->exec('ROLLBACK TRANSACTION');
@ -71,6 +75,7 @@ class PDO extends \PDO
* @return mixed A successful call returns the value of the requested PDO attribute. * @return mixed A successful call returns the value of the requested PDO attribute.
* An unsuccessful call returns null. * An unsuccessful call returns null.
*/ */
#[\ReturnTypeWillChange]
public function getAttribute($attribute) public function getAttribute($attribute)
{ {
try { try {

1
framework/db/mssql/SqlsrvPDO.php

@ -26,6 +26,7 @@ class SqlsrvPDO extends \PDO
* @param string|null $sequence the sequence name. Defaults to null. * @param string|null $sequence the sequence name. Defaults to null.
* @return int last inserted ID value. * @return int last inserted ID value.
*/ */
#[\ReturnTypeWillChange]
public function lastInsertId($sequence = null) public function lastInsertId($sequence = null)
{ {
return !$sequence ? parent::lastInsertId() : parent::lastInsertId($sequence); return !$sequence ? parent::lastInsertId() : parent::lastInsertId($sequence);

Loading…
Cancel
Save