diff options
Diffstat (limited to 'includes/libs/rdbms')
18 files changed, 45 insertions, 45 deletions
diff --git a/includes/libs/rdbms/ServerInfo.php b/includes/libs/rdbms/ServerInfo.php index 2b68567db7a9..5de1d6c189dc 100644 --- a/includes/libs/rdbms/ServerInfo.php +++ b/includes/libs/rdbms/ServerInfo.php @@ -136,7 +136,7 @@ class ServerInfo { return $newIndexByServerIndex; } - public function normalizeServerMaps( array $servers, array &$indexBySrvName = null ) { + public function normalizeServerMaps( array $servers, ?array &$indexBySrvName = null ) { if ( !$servers ) { throw new InvalidArgumentException( 'Missing or empty "servers" parameter' ); } diff --git a/includes/libs/rdbms/database/DBConnRef.php b/includes/libs/rdbms/database/DBConnRef.php index 63444ecb5c97..98e907853e20 100644 --- a/includes/libs/rdbms/database/DBConnRef.php +++ b/includes/libs/rdbms/database/DBConnRef.php @@ -637,7 +637,7 @@ class DBConnRef implements Stringable, IMaintainableDatabase, IDatabaseForOwner return $this->__call( __FUNCTION__, func_get_args() ); } - public function setTransactionListener( $name, callable $callback = null ) { + public function setTransactionListener( $name, ?callable $callback = null ) { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -653,7 +653,7 @@ class DBConnRef implements Stringable, IMaintainableDatabase, IDatabaseForOwner return $this->__call( __FUNCTION__, func_get_args() ); } - public function cancelAtomic( $fname = __METHOD__, AtomicSectionIdentifier $sectionId = null ) { + public function cancelAtomic( $fname = __METHOD__, ?AtomicSectionIdentifier $sectionId = null ) { // Don't call assertRoleAllowsWrites(); caller might want a REPEATABLE-READ snapshot return $this->__call( __FUNCTION__, func_get_args() ); } @@ -789,10 +789,10 @@ class DBConnRef implements Stringable, IMaintainableDatabase, IDatabaseForOwner public function sourceFile( $filename, - callable $lineCallback = null, - callable $resultCallback = null, + ?callable $lineCallback = null, + ?callable $resultCallback = null, $fname = false, - callable $inputCallback = null + ?callable $inputCallback = null ) { $this->assertRoleAllowsWrites(); @@ -801,10 +801,10 @@ class DBConnRef implements Stringable, IMaintainableDatabase, IDatabaseForOwner public function sourceStream( $fp, - callable $lineCallback = null, - callable $resultCallback = null, + ?callable $lineCallback = null, + ?callable $resultCallback = null, $fname = __METHOD__, - callable $inputCallback = null + ?callable $inputCallback = null ) { $this->assertRoleAllowsWrites(); diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 17ff248f3a5d..b36650d683f5 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -1970,7 +1970,7 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD $this->transactionManager->onAtomicSectionCancel( $this, $callback, $fname ); } - final public function setTransactionListener( $name, callable $callback = null ) { + final public function setTransactionListener( $name, ?callable $callback = null ) { $this->transactionManager->setTransactionListener( $name, $callback ); } @@ -2196,7 +2196,7 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD final public function cancelAtomic( $fname = __METHOD__, - AtomicSectionIdentifier $sectionId = null + ?AtomicSectionIdentifier $sectionId = null ) { $this->transactionManager->onCancelAtomicBeforeCriticalSection( $this, $fname ); $pos = $this->transactionManager->getPositionFromSectionId( $sectionId ); @@ -2708,10 +2708,10 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD public function sourceFile( $filename, - callable $lineCallback = null, - callable $resultCallback = null, + ?callable $lineCallback = null, + ?callable $resultCallback = null, $fname = false, - callable $inputCallback = null + ?callable $inputCallback = null ) { AtEase::suppressWarnings(); $fp = fopen( $filename, 'r' ); @@ -2740,10 +2740,10 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD public function sourceStream( $fp, - callable $lineCallback = null, - callable $resultCallback = null, + ?callable $lineCallback = null, + ?callable $resultCallback = null, $fname = __METHOD__, - callable $inputCallback = null + ?callable $inputCallback = null ) { $delimiterReset = new ScopedCallback( function ( $delimiter ) { @@ -3116,7 +3116,7 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD protected function completeCriticalSection( string $fname, ?CriticalSectionScope $csm, - Throwable $trxError = null + ?Throwable $trxError = null ) { if ( $csm !== null ) { if ( $this->csmId === null ) { diff --git a/includes/libs/rdbms/database/IDatabase.php b/includes/libs/rdbms/database/IDatabase.php index eb6c45fab574..8e614a231c56 100644 --- a/includes/libs/rdbms/database/IDatabase.php +++ b/includes/libs/rdbms/database/IDatabase.php @@ -774,7 +774,7 @@ interface IDatabase extends IReadableDatabase { * passing this enables cancellation of unclosed nested sections [optional] * @throws DBError If an error occurs, {@see query} */ - public function cancelAtomic( $fname = __METHOD__, AtomicSectionIdentifier $sectionId = null ); + public function cancelAtomic( $fname = __METHOD__, ?AtomicSectionIdentifier $sectionId = null ); /** * Perform an atomic section of reversible SQL statements from a callback diff --git a/includes/libs/rdbms/database/IDatabaseForOwner.php b/includes/libs/rdbms/database/IDatabaseForOwner.php index 0e4933c8a6b1..8b36262e1f93 100644 --- a/includes/libs/rdbms/database/IDatabaseForOwner.php +++ b/includes/libs/rdbms/database/IDatabaseForOwner.php @@ -47,7 +47,7 @@ interface IDatabaseForOwner extends IDatabase { * @param callable|null $callback Use null to unset a listener * @since 1.28 */ - public function setTransactionListener( $name, callable $callback = null ); + public function setTransactionListener( $name, ?callable $callback = null ); /** * @return bool Whether this DB server is running in server-side read-only mode diff --git a/includes/libs/rdbms/database/IMaintainableDatabase.php b/includes/libs/rdbms/database/IMaintainableDatabase.php index 2cdf1e755a62..a5aaf543de3a 100644 --- a/includes/libs/rdbms/database/IMaintainableDatabase.php +++ b/includes/libs/rdbms/database/IMaintainableDatabase.php @@ -50,10 +50,10 @@ interface IMaintainableDatabase extends IDatabase { */ public function sourceFile( $filename, - callable $lineCallback = null, - callable $resultCallback = null, + ?callable $lineCallback = null, + ?callable $resultCallback = null, $fname = false, - callable $inputCallback = null + ?callable $inputCallback = null ); /** @@ -71,10 +71,10 @@ interface IMaintainableDatabase extends IDatabase { */ public function sourceStream( $fp, - callable $lineCallback = null, - callable $resultCallback = null, + ?callable $lineCallback = null, + ?callable $resultCallback = null, $fname = __METHOD__, - callable $inputCallback = null + ?callable $inputCallback = null ); /** diff --git a/includes/libs/rdbms/database/Query.php b/includes/libs/rdbms/database/Query.php index 44a06f4179d6..14a51958b9c0 100644 --- a/includes/libs/rdbms/database/Query.php +++ b/includes/libs/rdbms/database/Query.php @@ -67,7 +67,7 @@ class Query { string $sql, $flags, $queryVerb, - string $writeTable = null, + ?string $writeTable = null, $cleanedSql = '' ) { $this->sql = $sql; diff --git a/includes/libs/rdbms/database/TransactionManager.php b/includes/libs/rdbms/database/TransactionManager.php index 1022c46245ed..ba55919967b5 100644 --- a/includes/libs/rdbms/database/TransactionManager.php +++ b/includes/libs/rdbms/database/TransactionManager.php @@ -123,7 +123,7 @@ class TransactionManager { /** @var TransactionProfiler */ private $profiler; - public function __construct( LoggerInterface $logger = null, $profiler = null ) { + public function __construct( ?LoggerInterface $logger = null, $profiler = null ) { $this->logger = $logger ?? new NullLogger(); $this->profiler = $profiler ?? new TransactionProfiler(); } @@ -474,7 +474,7 @@ class TransactionManager { return [ $savepointId, $sectionId ]; } - public function getPositionFromSectionId( AtomicSectionIdentifier $sectionId = null ): ?int { + public function getPositionFromSectionId( ?AtomicSectionIdentifier $sectionId = null ): ?int { if ( $sectionId !== null ) { // Find the (last) section with the given $sectionId $pos = -1; @@ -622,7 +622,7 @@ class TransactionManager { ]; } - public function setTransactionListener( $name, callable $callback = null ) { + public function setTransactionListener( $name, ?callable $callback = null ) { if ( $callback ) { $this->trxRecurringCallbacks[$name] = $callback; } else { @@ -691,7 +691,7 @@ class TransactionManager { */ public function modifyCallbacksForCancel( array $excisedSectionsId, - AtomicSectionIdentifier $newSectionId = null + ?AtomicSectionIdentifier $newSectionId = null ) { // Cancel the "on commit" callbacks owned by this savepoint $this->trxPostCommitOrIdleCallbacks = array_filter( diff --git a/includes/libs/rdbms/exception/DBConnectionError.php b/includes/libs/rdbms/exception/DBConnectionError.php index 0ee2542f13c6..c3c8eda2e5b3 100644 --- a/includes/libs/rdbms/exception/DBConnectionError.php +++ b/includes/libs/rdbms/exception/DBConnectionError.php @@ -29,7 +29,7 @@ class DBConnectionError extends DBExpectedError { * @param IDatabase|null $db Object throwing the error * @param string $error Error text */ - public 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"; diff --git a/includes/libs/rdbms/exception/DBError.php b/includes/libs/rdbms/exception/DBError.php index dae50a39cbf3..f791bc77a342 100644 --- a/includes/libs/rdbms/exception/DBError.php +++ b/includes/libs/rdbms/exception/DBError.php @@ -44,7 +44,7 @@ class DBError extends RuntimeException { * @param string $error A simple error message to be used for debugging * @param \Throwable|null $prev Previous throwable */ - public function __construct( ?IDatabase $db, $error, \Throwable $prev = null ) { + public function __construct( ?IDatabase $db, $error, ?\Throwable $prev = null ) { parent::__construct( $error, 0, $prev ); $this->db = $db; } diff --git a/includes/libs/rdbms/exception/DBExpectedError.php b/includes/libs/rdbms/exception/DBExpectedError.php index b3ddfe2e88ab..4397fc293da9 100644 --- a/includes/libs/rdbms/exception/DBExpectedError.php +++ b/includes/libs/rdbms/exception/DBExpectedError.php @@ -41,7 +41,7 @@ class DBExpectedError extends DBError implements MessageSpecifier { * @param \Throwable|null $prev */ public function __construct( - ?IDatabase $db, $error, array $params = [], \Throwable $prev = null + ?IDatabase $db, $error, array $params = [], ?\Throwable $prev = null ) { parent::__construct( $db, $error, $prev ); $this->params = $params; diff --git a/includes/libs/rdbms/exception/DBLanguageError.php b/includes/libs/rdbms/exception/DBLanguageError.php index 328e2a8fafd3..3b6a620a18ac 100644 --- a/includes/libs/rdbms/exception/DBLanguageError.php +++ b/includes/libs/rdbms/exception/DBLanguageError.php @@ -27,7 +27,7 @@ use Throwable; * @ingroup Database */ class DBLanguageError extends DBUnexpectedError { - public function __construct( $error, Throwable $prev = null ) { + public function __construct( $error, ?Throwable $prev = null ) { parent::__construct( null, $error, $prev ); } } diff --git a/includes/libs/rdbms/exception/DBTransactionError.php b/includes/libs/rdbms/exception/DBTransactionError.php index 253faa421012..c8ec8adffe4f 100644 --- a/includes/libs/rdbms/exception/DBTransactionError.php +++ b/includes/libs/rdbms/exception/DBTransactionError.php @@ -39,7 +39,7 @@ class DBTransactionError extends DBExpectedError implements INormalizedException * @param array $errorParams PSR-3 message context */ public function __construct( - ?IDatabase $db, $error, array $params = [], \Throwable $prev = null, $errorParams = [] + ?IDatabase $db, $error, array $params = [], ?\Throwable $prev = null, $errorParams = [] ) { $this->normalizedMessage = $error; $this->messageContext = $errorParams; diff --git a/includes/libs/rdbms/lbfactory/ILBFactory.php b/includes/libs/rdbms/lbfactory/ILBFactory.php index ad3b3702660f..96427524e307 100644 --- a/includes/libs/rdbms/lbfactory/ILBFactory.php +++ b/includes/libs/rdbms/lbfactory/ILBFactory.php @@ -237,7 +237,7 @@ interface ILBFactory extends IConnectionProvider { */ public function shutdown( $flags = self::SHUTDOWN_NORMAL, - callable $workCallback = null, + ?callable $workCallback = null, &$cpIndex = null, &$cpClientId = null ); @@ -383,7 +383,7 @@ interface ILBFactory extends IConnectionProvider { * @param string $name Callback name * @param callable|null $callback Use null to unset a callback */ - public function setWaitForReplicationListener( $name, callable $callback = null ); + public function setWaitForReplicationListener( $name, ?callable $callback = null ); /** * Disable the ChronologyProtector on all instantiated tracked load balancer instances diff --git a/includes/libs/rdbms/lbfactory/LBFactory.php b/includes/libs/rdbms/lbfactory/LBFactory.php index ca6910d4cf70..c53d5091fe26 100644 --- a/includes/libs/rdbms/lbfactory/LBFactory.php +++ b/includes/libs/rdbms/lbfactory/LBFactory.php @@ -228,7 +228,7 @@ abstract class LBFactory implements ILBFactory { public function shutdown( $flags = self::SHUTDOWN_NORMAL, - callable $workCallback = null, + ?callable $workCallback = null, &$cpIndex = null, &$cpClientId = null ) { @@ -498,7 +498,7 @@ abstract class LBFactory implements ILBFactory { return !$failed; } - public function setWaitForReplicationListener( $name, callable $callback = null ) { + public function setWaitForReplicationListener( $name, ?callable $callback = null ) { if ( $callback ) { $this->replicationWaitCallbacks[$name] = $callback; } else { diff --git a/includes/libs/rdbms/loadbalancer/ILoadBalancer.php b/includes/libs/rdbms/loadbalancer/ILoadBalancer.php index 2d3165d5049b..1725d9fbd939 100644 --- a/includes/libs/rdbms/loadbalancer/ILoadBalancer.php +++ b/includes/libs/rdbms/loadbalancer/ILoadBalancer.php @@ -472,7 +472,7 @@ interface ILoadBalancer { * @param string $name Callback name * @param callable|null $callback */ - public function setTransactionListener( $name, callable $callback = null ); + public function setTransactionListener( $name, ?callable $callback = null ); /** * Make certain table names use their own database, schema, and table prefix diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php b/includes/libs/rdbms/loadbalancer/LoadBalancer.php index c779f061b82b..7d30e2a8d457 100644 --- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php +++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php @@ -1754,7 +1754,7 @@ class LoadBalancer implements ILoadBalancerForOwner { * @param IDatabaseForOwner|null $conn Recently acquired primary connection; null if not applicable * @return bool Whether the entire primary DB server or the local domain DB is read-only */ - private function isPrimaryRunningReadOnly( IDatabaseForOwner $conn = null ) { + private function isPrimaryRunningReadOnly( ?IDatabaseForOwner $conn = null ) { // Context will often be HTTP GET/HEAD; heavily cache the results return (bool)$this->wanCache->getWithSetCallback( // Note that table prefixes are not related to server-side read-only mode @@ -1921,7 +1921,7 @@ class LoadBalancer implements ILoadBalancerForOwner { return $ok; } - public function setTransactionListener( $name, callable $callback = null ) { + public function setTransactionListener( $name, ?callable $callback = null ) { if ( $callback ) { $this->trxRecurringCallbacks[$name] = $callback; } else { diff --git a/includes/libs/rdbms/platform/SQLPlatform.php b/includes/libs/rdbms/platform/SQLPlatform.php index 8dbfdbee2a1a..563a9d920062 100644 --- a/includes/libs/rdbms/platform/SQLPlatform.php +++ b/includes/libs/rdbms/platform/SQLPlatform.php @@ -62,8 +62,8 @@ class SQLPlatform implements ISQLPlatform { public function __construct( DbQuoter $quoter, - LoggerInterface $logger = null, - DatabaseDomain $currentDomain = null, + ?LoggerInterface $logger = null, + ?DatabaseDomain $currentDomain = null, $errorLogger = null ) { |