DB excepions: consistently declare constructors as public
authorChad Horohoe <chadh@wikimedia.org>
Wed, 30 Aug 2017 23:44:35 +0000 (16:44 -0700)
committerChad Horohoe <chadh@wikimedia.org>
Wed, 30 Aug 2017 23:44:50 +0000 (16:44 -0700)
Also DBTransactionSizeError::getKey() while we're here

Change-Id: Ic76abf3ca0bf74dd96018d67da466365957bf3b1

includes/libs/rdbms/exception/DBConnectionError.php
includes/libs/rdbms/exception/DBError.php
includes/libs/rdbms/exception/DBExpectedError.php
includes/libs/rdbms/exception/DBQueryError.php
includes/libs/rdbms/exception/DBTransactionSizeError.php

index 0091524..91d98dc 100644 (file)
@@ -28,7 +28,7 @@ class DBConnectionError extends DBExpectedError {
         * @param IDatabase $db Object throwing the error
         * @param string $error Error text
         */
-       function __construct( IDatabase $db = null, $error = 'unknown error' ) {
+       public function __construct( IDatabase $db = null, $error = 'unknown error' ) {
                $msg = 'Cannot access the database';
                if ( trim( $error ) != '' ) {
                        $msg .= ": $error";
index d65e2d3..2f7499b 100644 (file)
@@ -36,7 +36,7 @@ class DBError extends Exception {
         * @param IDatabase $db Object which threw the error
         * @param string $error A simple error message to be used for debugging
         */
-       function __construct( IDatabase $db = null, $error ) {
+       public function __construct( IDatabase $db = null, $error ) {
                $this->db = $db;
                parent::__construct( $error );
        }
index 4f65efa..31d8c27 100644 (file)
@@ -36,7 +36,7 @@ class DBExpectedError extends DBError implements MessageSpecifier, ILocalizedExc
        /** @var string[] Message parameters */
        protected $params;
 
-       function __construct( IDatabase $db = null, $error, array $params = [] ) {
+       public function __construct( IDatabase $db = null, $error, array $params = [] ) {
                parent::__construct( $db, $error );
                $this->params = $params;
        }
index 6a4076f..a8ea3ad 100644 (file)
@@ -41,7 +41,7 @@ class DBQueryError extends DBExpectedError {
         * @param string $sql
         * @param string $fname
         */
-       function __construct( IDatabase $db, $error, $errno, $sql, $fname ) {
+       public function __construct( IDatabase $db, $error, $errno, $sql, $fname ) {
                if ( $db instanceof Database && $db->wasConnectionError( $errno ) ) {
                        $message = "A connection error occured. \n" .
                                "Query: $sql\n" .
index e45b9f3..d2622e1 100644 (file)
@@ -25,7 +25,7 @@ namespace Wikimedia\Rdbms;
  * @ingroup Database
  */
 class DBTransactionSizeError extends DBTransactionError {
-       function getKey() {
+       public function getKey() {
                return 'transaction-duration-limit-exceeded';
        }
 }