diff options
Diffstat (limited to 'includes/libs')
36 files changed, 73 insertions, 73 deletions
diff --git a/includes/libs/Message/DataMessageValue.php b/includes/libs/Message/DataMessageValue.php index 44cb66f06218..a7a93bfb62cd 100644 --- a/includes/libs/Message/DataMessageValue.php +++ b/includes/libs/Message/DataMessageValue.php @@ -39,7 +39,7 @@ class DataMessageValue extends MessageValue { * @param array|null $data Structured data representing the concept * behind this message. */ - public function __construct( $key, $params = [], $code = null, array $data = null ) { + public function __construct( $key, $params = [], $code = null, ?array $data = null ) { parent::__construct( $key, $params ); $this->code = $code ?? $key; @@ -54,7 +54,7 @@ class DataMessageValue extends MessageValue { * @param array|null $data * @return DataMessageValue */ - public static function new( $key, $params = [], $code = null, array $data = null ) { + public static function new( $key, $params = [], $code = null, ?array $data = null ) { return new DataMessageValue( $key, $params, $code, $data ); } diff --git a/includes/libs/ParamValidator/TypeDef.php b/includes/libs/ParamValidator/TypeDef.php index c7eecf91f8b6..7a7b4e24a991 100644 --- a/includes/libs/ParamValidator/TypeDef.php +++ b/includes/libs/ParamValidator/TypeDef.php @@ -153,7 +153,7 @@ abstract class TypeDef { * @param string|null $suffix Suffix to append when producing the message key * @return DataMessageValue */ - protected function failureMessage( $code, array $data = null, $suffix = null ): DataMessageValue { + protected function failureMessage( $code, ?array $data = null, $suffix = null ): DataMessageValue { return DataMessageValue::new( "paramvalidator-$code" . ( $suffix !== null ? "-$suffix" : '' ), [], $code, $data diff --git a/includes/libs/ParamValidator/ValidationException.php b/includes/libs/ParamValidator/ValidationException.php index e37820aff598..c217b3184840 100644 --- a/includes/libs/ParamValidator/ValidationException.php +++ b/includes/libs/ParamValidator/ValidationException.php @@ -36,7 +36,7 @@ class ValidationException extends UnexpectedValueException { * @param Throwable|null $previous Previous throwable causing this failure */ public function __construct( - DataMessageValue $failureMessage, $name, $value, $settings, Throwable $previous = null + DataMessageValue $failureMessage, $name, $value, $settings, ?Throwable $previous = null ) { $this->failureMessage = $failureMessage; $this->paramName = $name; diff --git a/includes/libs/Stats/OutputFormats.php b/includes/libs/Stats/OutputFormats.php index ff10f7ea8b39..157b05e3c71c 100644 --- a/includes/libs/Stats/OutputFormats.php +++ b/includes/libs/Stats/OutputFormats.php @@ -96,7 +96,7 @@ class OutputFormats { string $prefix, StatsCache $cache, FormatterInterface $formatter, - string $target = null + ?string $target = null ): EmitterInterface { switch ( get_class( $formatter ) ) { case StatsdFormatter::class: diff --git a/includes/libs/WRStats/LimitOperation.php b/includes/libs/WRStats/LimitOperation.php index 1b73f5ad3a09..145e419821b6 100644 --- a/includes/libs/WRStats/LimitOperation.php +++ b/includes/libs/WRStats/LimitOperation.php @@ -27,7 +27,7 @@ class LimitOperation { */ public function __construct( string $condName, - EntityKey $entityKey = null, + ?EntityKey $entityKey = null, $amount = 1 ) { $this->condName = $condName; diff --git a/includes/libs/WRStats/WRStatsRateLimiter.php b/includes/libs/WRStats/WRStatsRateLimiter.php index 2b9e0313eb53..4270835b15a5 100644 --- a/includes/libs/WRStats/WRStatsRateLimiter.php +++ b/includes/libs/WRStats/WRStatsRateLimiter.php @@ -74,7 +74,7 @@ class WRStatsRateLimiter { */ public function peek( string $condName, - EntityKey $entityKey = null, + ?EntityKey $entityKey = null, $amount = 1 ): LimitOperationResult { $actions = [ new LimitOperation( $condName, $entityKey, $amount ) ]; @@ -136,7 +136,7 @@ class WRStatsRateLimiter { */ public function tryIncr( string $condName, - EntityKey $entityKey = null, + ?EntityKey $entityKey = null, $amount = 1 ): LimitOperationResult { $actions = [ new LimitOperation( $condName, $entityKey, $amount ) ]; @@ -169,7 +169,7 @@ class WRStatsRateLimiter { */ public function incr( string $condName, - EntityKey $entityKey = null, + ?EntityKey $entityKey = null, $amount = 1 ) { $actions = [ new LimitOperation( $condName, $entityKey, $amount ) ]; diff --git a/includes/libs/filebackend/FSFileBackend.php b/includes/libs/filebackend/FSFileBackend.php index 11ba1b706112..2e6c9ba076e4 100644 --- a/includes/libs/filebackend/FSFileBackend.php +++ b/includes/libs/filebackend/FSFileBackend.php @@ -613,7 +613,7 @@ class FSFileBackend extends FileBackendStore { return $hadError ? self::RES_ERROR : self::RES_ABSENT; } - protected function doClearCache( array $paths = null ) { + protected function doClearCache( ?array $paths = null ) { if ( is_array( $paths ) ) { foreach ( $paths as $path ) { $fsPath = $this->resolveToFSPath( $path ); diff --git a/includes/libs/filebackend/FileBackend.php b/includes/libs/filebackend/FileBackend.php index 46a46ff05131..8ad1ca2956c7 100644 --- a/includes/libs/filebackend/FileBackend.php +++ b/includes/libs/filebackend/FileBackend.php @@ -1388,7 +1388,7 @@ abstract class FileBackend implements LoggerAwareInterface { * * @param array|null $paths Storage paths (optional) */ - abstract public function clearCache( array $paths = null ); + abstract public function clearCache( ?array $paths = null ); /** * Preload file stat information (concurrently if possible) into in-process cache. diff --git a/includes/libs/filebackend/FileBackendMultiWrite.php b/includes/libs/filebackend/FileBackendMultiWrite.php index 8c9b753cb27b..c35237da1c5d 100644 --- a/includes/libs/filebackend/FileBackendMultiWrite.php +++ b/includes/libs/filebackend/FileBackendMultiWrite.php @@ -793,7 +793,7 @@ class FileBackendMultiWrite extends FileBackend { return $this->backends[$this->masterIndex]->getFeatures(); } - public function clearCache( array $paths = null ) { + public function clearCache( ?array $paths = null ) { foreach ( $this->backends as $backend ) { $realPaths = is_array( $paths ) ? $this->substPaths( $paths, $backend ) : null; $backend->clearCache( $realPaths ); diff --git a/includes/libs/filebackend/FileBackendStore.php b/includes/libs/filebackend/FileBackendStore.php index 9d0530f82591..99db1aa65103 100644 --- a/includes/libs/filebackend/FileBackendStore.php +++ b/includes/libs/filebackend/FileBackendStore.php @@ -1486,7 +1486,7 @@ abstract class FileBackendStore extends FileBackend { $this->primeFileCache( $paths ); } - final public function clearCache( array $paths = null ) { + final public function clearCache( ?array $paths = null ) { if ( is_array( $paths ) ) { $paths = array_map( [ FileBackend::class, 'normalizeStoragePath' ], $paths ); $paths = array_filter( $paths, 'strlen' ); // remove nulls @@ -1511,7 +1511,7 @@ abstract class FileBackendStore extends FileBackend { * * @param string[]|null $paths Storage paths (optional) */ - protected function doClearCache( array $paths = null ) { + protected function doClearCache( ?array $paths = null ) { } final public function preloadFileStat( array $params ) { diff --git a/includes/libs/lockmanager/ScopedLock.php b/includes/libs/lockmanager/ScopedLock.php index 67b56f9a8f9d..679d4debb442 100644 --- a/includes/libs/lockmanager/ScopedLock.php +++ b/includes/libs/lockmanager/ScopedLock.php @@ -83,7 +83,7 @@ class ScopedLock { * @param ScopedLock|null &$lock * @since 1.21 */ - public static function release( ScopedLock &$lock = null ) { + public static function release( ?ScopedLock &$lock = null ) { $lock = null; } diff --git a/includes/libs/mime/MimeAnalyzer.php b/includes/libs/mime/MimeAnalyzer.php index 6487c385ded1..6c12c96210e0 100644 --- a/includes/libs/mime/MimeAnalyzer.php +++ b/includes/libs/mime/MimeAnalyzer.php @@ -952,7 +952,7 @@ class MimeAnalyzer implements LoggerAwareInterface { * @param string|null $mime MIME type. If null it will be guessed using guessMimeType. * @return string A value to be used with the MEDIATYPE_xxx constants. */ - public function getMediaType( string $path = null, string $mime = null ): string { + public function getMediaType( ?string $path = null, ?string $mime = null ): string { if ( !$mime && !$path ) { return MEDIATYPE_UNKNOWN; } diff --git a/includes/libs/objectcache/BagOStuff.php b/includes/libs/objectcache/BagOStuff.php index 500134705f59..a2337caa8e82 100644 --- a/includes/libs/objectcache/BagOStuff.php +++ b/includes/libs/objectcache/BagOStuff.php @@ -394,9 +394,9 @@ abstract class BagOStuff implements */ abstract public function deleteObjectsExpiringBefore( $timestamp, - callable $progress = null, + ?callable $progress = null, $limit = INF, - string $tag = null + ?string $tag = null ); /** diff --git a/includes/libs/objectcache/CachedBagOStuff.php b/includes/libs/objectcache/CachedBagOStuff.php index 3e209ac7de80..e6f6e06dc14f 100644 --- a/includes/libs/objectcache/CachedBagOStuff.php +++ b/includes/libs/objectcache/CachedBagOStuff.php @@ -187,9 +187,9 @@ class CachedBagOStuff extends BagOStuff { public function deleteObjectsExpiringBefore( $timestamp, - callable $progress = null, + ?callable $progress = null, $limit = INF, - string $tag = null + ?string $tag = null ) { $this->procCache->deleteObjectsExpiringBefore( $timestamp, $progress, $limit, $tag ); diff --git a/includes/libs/objectcache/MediumSpecificBagOStuff.php b/includes/libs/objectcache/MediumSpecificBagOStuff.php index 02772457a2ac..1eaf24bb006c 100644 --- a/includes/libs/objectcache/MediumSpecificBagOStuff.php +++ b/includes/libs/objectcache/MediumSpecificBagOStuff.php @@ -657,9 +657,9 @@ abstract class MediumSpecificBagOStuff extends BagOStuff { public function deleteObjectsExpiringBefore( $timestamp, - callable $progress = null, + ?callable $progress = null, $limit = INF, - string $tag = null + ?string $tag = null ) { return false; } diff --git a/includes/libs/objectcache/MultiWriteBagOStuff.php b/includes/libs/objectcache/MultiWriteBagOStuff.php index 3d9233836703..9948a7e26208 100644 --- a/includes/libs/objectcache/MultiWriteBagOStuff.php +++ b/includes/libs/objectcache/MultiWriteBagOStuff.php @@ -307,9 +307,9 @@ class MultiWriteBagOStuff extends BagOStuff { public function deleteObjectsExpiringBefore( $timestamp, - callable $progress = null, + ?callable $progress = null, $limit = INF, - string $tag = null + ?string $tag = null ) { $ret = false; foreach ( $this->caches as $cache ) { diff --git a/includes/libs/objectcache/WANObjectCache.php b/includes/libs/objectcache/WANObjectCache.php index 3ea23c95a81a..fe6e7bb8f179 100644 --- a/includes/libs/objectcache/WANObjectCache.php +++ b/includes/libs/objectcache/WANObjectCache.php @@ -1908,7 +1908,7 @@ class WANObjectCache implements * @param string|null $route Routing prefix (optional) * @return string[] Order-corresponding list of sister keys */ - private function makeSisterKeys( array $baseKeys, string $type, string $route = null ) { + private function makeSisterKeys( array $baseKeys, string $type, ?string $route = null ) { $sisterKeys = []; foreach ( $baseKeys as $baseKey ) { $sisterKeys[] = $this->makeSisterKey( $baseKey, $type, $route ); @@ -1927,7 +1927,7 @@ class WANObjectCache implements * @param string|null $route Routing prefix (optional) * @return string Sister key */ - private function makeSisterKey( string $baseKey, string $typeChar, string $route = null ) { + private function makeSisterKey( string $baseKey, string $typeChar, ?string $route = null ) { if ( $this->coalesceScheme === self::SCHEME_HASH_STOP ) { // Key style: "WANCache:<base key>|#|<character>" $sisterKey = 'WANCache:' . $baseKey . '|#|' . $typeChar; @@ -3013,7 +3013,7 @@ class WANObjectCache implements * @param array|null &$purge Unwrapped purge value array [returned] * @return string Wrapped purge value; format is "PURGED:<timestamp>:<holdoff>" */ - private function makeCheckPurgeValue( float $timestamp, int $holdoff, array &$purge = null ) { + private function makeCheckPurgeValue( float $timestamp, int $holdoff, ?array &$purge = null ) { $normalizedTime = (int)$timestamp; // Purge array that matches what parsePurgeValue() would have returned $purge = [ self::PURGE_TIME => (float)$normalizedTime, self::PURGE_HOLDOFF => $holdoff ]; 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 ) { diff --git a/includes/libs/redis/RedisConnectionPool.php b/includes/libs/redis/RedisConnectionPool.php index 495a4e366149..709d6967e8bd 100644 --- a/includes/libs/redis/RedisConnectionPool.php +++ b/includes/libs/redis/RedisConnectionPool.php @@ -183,7 +183,7 @@ class RedisConnectionPool implements LoggerAwareInterface { * @return RedisConnRef|Redis|false Returns false on failure * @throws InvalidArgumentException */ - public function getConnection( $server, LoggerInterface $logger = null ) { + public function getConnection( $server, ?LoggerInterface $logger = null ) { // The above @return also documents 'Redis' for convenience with IDEs. // RedisConnRef uses PHP magic methods, which wouldn't be recognised. |