From: Roland Häder Date: Mon, 20 Jun 2022 06:12:09 +0000 (+0200) Subject: Changes: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cc750d743b9008daf28b1088fbc560a4f7cc2dc0;p=friendica.git Changes: - some methods now need to return bool to be compatible - added some missing type-hints --- diff --git a/tests/Util/Database/ExtendedPDO.php b/tests/Util/Database/ExtendedPDO.php index b127e312ca..b36c126d5b 100644 --- a/tests/Util/Database/ExtendedPDO.php +++ b/tests/Util/Database/ExtendedPDO.php @@ -33,7 +33,7 @@ class ExtendedPDO extends PDO /** * @var array Database drivers that support SAVEPOINT * statements. */ - protected static $_supportedDrivers = ["pgsql", "mysql"]; + protected static $_supportedDrivers = ['pgsql', 'mysql']; /** * @var int the current transaction depth @@ -80,9 +80,9 @@ class ExtendedPDO extends PDO /** * Commit current transaction * - * @return bool|void + * @return bool */ - public function commit() + public function commit(): bool { // We don't want to "really" commit something, so skip the most outer hierarchy if ($this->_transactionDepth <= 1 && $this->hasSavepoint()) { @@ -92,28 +92,29 @@ class ExtendedPDO extends PDO $this->_transactionDepth--; - $this->exec("RELEASE SAVEPOINT LEVEL{$this->_transactionDepth}"); + return $this->exec("RELEASE SAVEPOINT LEVEL{$this->_transactionDepth}"); } /** * Rollback current transaction, * * @throws PDOException if there is no transaction started - * @return bool|void + * @return bool Whether rollback was successful */ - public function rollBack() + public function rollback(): bool { $this->_transactionDepth--; - if($this->_transactionDepth <= 0 || !$this->hasSavepoint()) { + if ($this->_transactionDepth <= 0 || !$this->hasSavepoint()) { $this->_transactionDepth = 0; try { - parent::rollBack(); + return parent::rollBack(); } catch (PDOException $e) { // this shouldn't happen, but it does ... } } else { - $this->exec("ROLLBACK TO SAVEPOINT LEVEL{$this->_transactionDepth}"); + return $this->exec("ROLLBACK TO SAVEPOINT LEVEL{$this->_transactionDepth}"); } + return false; } }