diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/libs/ParamValidator/TypeDef/BooleanDef.php | 2 | ||||
-rw-r--r-- | includes/libs/WRStats/LimitBatch.php | 2 | ||||
-rw-r--r-- | includes/libs/filebackend/FileBackendMultiWrite.php | 2 | ||||
-rw-r--r-- | includes/libs/http/MultiHttpClient.php | 2 | ||||
-rw-r--r-- | includes/libs/mime/MSCompoundFileReader.php | 16 | ||||
-rw-r--r-- | includes/libs/mime/XmlTypeCheck.php | 4 | ||||
-rw-r--r-- | includes/libs/rdbms/ChronologyProtector.php | 2 | ||||
-rw-r--r-- | includes/libs/rdbms/database/Database.php | 4 | ||||
-rw-r--r-- | includes/libs/rdbms/database/DatabaseMySQL.php | 2 | ||||
-rw-r--r-- | includes/libs/rdbms/database/QueryBuilderFromRawSql.php | 2 | ||||
-rw-r--r-- | includes/libs/rdbms/dbal/DoctrineAbstractSchemaTrait.php | 2 | ||||
-rw-r--r-- | includes/libs/rdbms/expression/LikeValue.php | 2 | ||||
-rw-r--r-- | includes/libs/rdbms/lbfactory/LBFactorySimple.php | 2 | ||||
-rw-r--r-- | includes/libs/rdbms/loadbalancer/LoadBalancer.php | 2 | ||||
-rw-r--r-- | includes/libs/rdbms/platform/SQLPlatform.php | 2 |
15 files changed, 25 insertions, 23 deletions
diff --git a/includes/libs/ParamValidator/TypeDef/BooleanDef.php b/includes/libs/ParamValidator/TypeDef/BooleanDef.php index e2ab0cb1460b..19ee271bde00 100644 --- a/includes/libs/ParamValidator/TypeDef/BooleanDef.php +++ b/includes/libs/ParamValidator/TypeDef/BooleanDef.php @@ -57,7 +57,7 @@ class BooleanDef extends TypeDef { ); } - private function quoteVal( $v ) { + private function quoteVal( string $v ): ScalarParam { return new ScalarParam( ParamType::TEXT, "\"$v\"" ); } diff --git a/includes/libs/WRStats/LimitBatch.php b/includes/libs/WRStats/LimitBatch.php index 3758a40fc6e3..b83adb4cffda 100644 --- a/includes/libs/WRStats/LimitBatch.php +++ b/includes/libs/WRStats/LimitBatch.php @@ -72,7 +72,7 @@ class LimitBatch { return $this; } - private function queueOp( $type, $entity, $amount ) { + private function queueOp( string $type, ?EntityKey $entity, ?int $amount ) { $amount ??= $this->defaultAmount; if ( isset( $this->operations[$type] ) ) { throw new WRStatsError( 'Cannot queue multiple actions of the same type, ' . diff --git a/includes/libs/filebackend/FileBackendMultiWrite.php b/includes/libs/filebackend/FileBackendMultiWrite.php index 7be37112be27..7c59e161e396 100644 --- a/includes/libs/filebackend/FileBackendMultiWrite.php +++ b/includes/libs/filebackend/FileBackendMultiWrite.php @@ -776,7 +776,7 @@ class FileBackendMultiWrite extends FileBackend { return $this->backends[$this->masterIndex]->getFileList( $realParams ); } - private function getFileListForWrite( $params ) { + private function getFileListForWrite( array $params ): array { $files = []; // Get the list of thumbnails from all backends to allow // deleting all of them. Otherwise, old thumbnails existing on diff --git a/includes/libs/http/MultiHttpClient.php b/includes/libs/http/MultiHttpClient.php index 4aefaf1551b5..ff0bd5f6866c 100644 --- a/includes/libs/http/MultiHttpClient.php +++ b/includes/libs/http/MultiHttpClient.php @@ -734,7 +734,7 @@ class MultiHttpClient implements LoggerAwareInterface { } } - private function useReverseProxy( array &$req, $proxy ) { + private function useReverseProxy( array &$req, string $proxy ) { $parsedProxy = parse_url( $proxy ); if ( $parsedProxy === false ) { throw new InvalidArgumentException( "Invalid reverseProxy configured: $proxy" ); diff --git a/includes/libs/mime/MSCompoundFileReader.php b/includes/libs/mime/MSCompoundFileReader.php index ff6afe144088..398c2bdd8e9d 100644 --- a/includes/libs/mime/MSCompoundFileReader.php +++ b/includes/libs/mime/MSCompoundFileReader.php @@ -170,11 +170,11 @@ class MSCompoundFileReader { $this->valid = true; } - private function sectorOffset( $sectorId ) { + private function sectorOffset( int $sectorId ): int { return $this->sectorLength * ( $sectorId + 1 ); } - private function decodeClsid( $binaryClsid ) { + private function decodeClsid( string $binaryClsid ): string { $parts = unpack( 'Va/vb/vc/C8d', $binaryClsid ); return sprintf( "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", $parts['a'], @@ -220,7 +220,7 @@ class MSCompoundFileReader { return $data; } - private function bin2dec( $str, $offset, $length ) { + private function bin2dec( string $str, int $offset, int $length ): int { $value = 0; for ( $i = $length - 1; $i >= 0; $i-- ) { $value *= 256; @@ -229,7 +229,7 @@ class MSCompoundFileReader { return $value; } - private function readOffset( $offset, $length ) { + private function readOffset( int $offset, int $length ): string { $this->fseek( $offset ); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged $block = @fread( $this->file, $length ); @@ -243,7 +243,7 @@ class MSCompoundFileReader { return $block; } - private function readSector( $sectorId ) { + private function readSector( int $sectorId ): string { return $this->readOffset( $this->sectorOffset( $sectorId ), 1 << $this->header['sector_shift'] ); } @@ -256,7 +256,7 @@ class MSCompoundFileReader { throw new RuntimeException( $message, $code ); } - private function fseek( $offset ) { + private function fseek( int $offset ) { // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged $result = @fseek( $this->file, $offset ); if ( $result !== 0 ) { @@ -287,14 +287,14 @@ class MSCompoundFileReader { } } - private function getNextSectorIdFromFat( $sectorId ) { + private function getNextSectorIdFromFat( int $sectorId ): int { $entriesPerSector = intdiv( $this->sectorLength, 4 ); $fatSectorId = intdiv( $sectorId, $entriesPerSector ); $fatSectorArray = $this->getFatSector( $fatSectorId ); return $fatSectorArray[$sectorId % $entriesPerSector]; } - private function getFatSector( $fatSectorId ) { + private function getFatSector( int $fatSectorId ): array { if ( !isset( $this->fat[$fatSectorId] ) ) { $fat = []; if ( !isset( $this->difat[$fatSectorId] ) ) { diff --git a/includes/libs/mime/XmlTypeCheck.php b/includes/libs/mime/XmlTypeCheck.php index b86fd406bef7..274bcbaafc4c 100644 --- a/includes/libs/mime/XmlTypeCheck.php +++ b/includes/libs/mime/XmlTypeCheck.php @@ -197,7 +197,7 @@ class XmlTypeCheck { } } - private function readNext( XMLReader $reader ) { + private function readNext( XMLReader $reader ): bool { set_error_handler( function ( $line, $file ) { $this->wellFormed = false; return true; @@ -207,7 +207,7 @@ class XmlTypeCheck { return $ret; } - private function validate( $reader ) { + private function validate( XMLReader $reader ) { // First, move through anything that isn't an element, and // handle any processing instructions with the callback do { diff --git a/includes/libs/rdbms/ChronologyProtector.php b/includes/libs/rdbms/ChronologyProtector.php index 5b8783cbe047..95b9fd7d1440 100644 --- a/includes/libs/rdbms/ChronologyProtector.php +++ b/includes/libs/rdbms/ChronologyProtector.php @@ -591,7 +591,7 @@ class ChronologyProtector implements LoggerAwareInterface { $this->wallClockOverride =& $time; } - private function marshalPositions( array $positions ) { + private function marshalPositions( array $positions ): array { foreach ( $positions[ self::FLD_POSITIONS ] as $key => $pos ) { $positions[ self::FLD_POSITIONS ][ $key ] = $pos->toArray(); } diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 6904f654ead4..4c2e9495d265 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -877,7 +877,9 @@ abstract class Database implements Stringable, IDatabaseForOwner, IMaintainableD return $status; } - private function handleErroredQuery( QueryStatus $status, $sql, $fname, $queryRuntime, $priorSessInfo ) { + private function handleErroredQuery( + QueryStatus $status, Query $sql, string $fname, float $queryRuntime, CriticalSessionInfo $priorSessInfo + ): int { $errflags = self::ERR_NONE; $error = $status->message; $errno = $status->code; diff --git a/includes/libs/rdbms/database/DatabaseMySQL.php b/includes/libs/rdbms/database/DatabaseMySQL.php index f7afce6b6c6c..2dd9cc904254 100644 --- a/includes/libs/rdbms/database/DatabaseMySQL.php +++ b/includes/libs/rdbms/database/DatabaseMySQL.php @@ -808,7 +808,7 @@ class DatabaseMySQL extends Database { } } - private function mysqlRealEscapeString( $s ) { + private function mysqlRealEscapeString( $s ): string { $conn = $this->getBindingHandle(); return $conn->real_escape_string( (string)$s ); diff --git a/includes/libs/rdbms/database/QueryBuilderFromRawSql.php b/includes/libs/rdbms/database/QueryBuilderFromRawSql.php index 3be8e0e13f69..af268f9cc2e2 100644 --- a/includes/libs/rdbms/database/QueryBuilderFromRawSql.php +++ b/includes/libs/rdbms/database/QueryBuilderFromRawSql.php @@ -99,7 +99,7 @@ class QueryBuilderFromRawSql { ); } - private static function isWriteQuery( $rawSql ) { + private static function isWriteQuery( string $rawSql ): bool { // Treat SELECT queries without FOR UPDATE queries as non-writes. This matches // how MySQL enforces read_only (FOR SHARE and LOCK IN SHADE MODE are allowed). // Handle (SELECT ...) UNION (SELECT ...) queries in a similar fashion. diff --git a/includes/libs/rdbms/dbal/DoctrineAbstractSchemaTrait.php b/includes/libs/rdbms/dbal/DoctrineAbstractSchemaTrait.php index 0f06ee2f4679..ab4b813bfe8c 100644 --- a/includes/libs/rdbms/dbal/DoctrineAbstractSchemaTrait.php +++ b/includes/libs/rdbms/dbal/DoctrineAbstractSchemaTrait.php @@ -31,7 +31,7 @@ trait DoctrineAbstractSchemaTrait { private AbstractPlatform $platform; - private function addTableToSchema( Schema $schema, array $schemaSpec ) { + private function addTableToSchema( Schema $schema, array $schemaSpec ): Schema { $prefix = $this->platform->getName() === 'postgresql' ? '' : '/*_*/'; $table = $schema->createTable( $prefix . $schemaSpec['name'] ); diff --git a/includes/libs/rdbms/expression/LikeValue.php b/includes/libs/rdbms/expression/LikeValue.php index 58b732927887..95bd801defa5 100644 --- a/includes/libs/rdbms/expression/LikeValue.php +++ b/includes/libs/rdbms/expression/LikeValue.php @@ -59,7 +59,7 @@ class LikeValue { return $dbQuoter->addQuotes( $s ) . ' ESCAPE ' . $dbQuoter->addQuotes( $escapeChar ); } - private function escapeLikeInternal( $s, $escapeChar = '`' ) { + private function escapeLikeInternal( string $s, string $escapeChar = '`' ): string { return str_replace( [ $escapeChar, '%', '_' ], [ "{$escapeChar}{$escapeChar}", "{$escapeChar}%", "{$escapeChar}_" ], diff --git a/includes/libs/rdbms/lbfactory/LBFactorySimple.php b/includes/libs/rdbms/lbfactory/LBFactorySimple.php index 4d90b309acd0..80f2eaedd44a 100644 --- a/includes/libs/rdbms/lbfactory/LBFactorySimple.php +++ b/includes/libs/rdbms/lbfactory/LBFactorySimple.php @@ -124,7 +124,7 @@ class LBFactorySimple extends LBFactory { return $lbs; } - private function newLoadBalancer( string $clusterName, array $servers ) { + private function newLoadBalancer( string $clusterName, array $servers ): ILoadBalancerForOwner { $lb = new LoadBalancer( array_merge( $this->baseLoadBalancerParams(), [ diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php b/includes/libs/rdbms/loadbalancer/LoadBalancer.php index 66e3a1ac30b8..db959970be33 100644 --- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php +++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php @@ -233,7 +233,7 @@ class LoadBalancer implements ILoadBalancerForOwner { $this->defaultGroup = isset( $this->groupLoads[ $group ] ) ? $group : self::GROUP_GENERIC; } - private static function newTrackedConnectionsArray() { + private static function newTrackedConnectionsArray(): array { // Note that CATEGORY_GAUGE connections are untracked return [ self::CATEGORY_ROUND => [], diff --git a/includes/libs/rdbms/platform/SQLPlatform.php b/includes/libs/rdbms/platform/SQLPlatform.php index 6ac4f1c07865..a1bc9168485d 100644 --- a/includes/libs/rdbms/platform/SQLPlatform.php +++ b/includes/libs/rdbms/platform/SQLPlatform.php @@ -1596,7 +1596,7 @@ class SQLPlatform implements ISQLPlatform { ); } - private function scrubArray( $array, $listType = self::LIST_AND ) { + private function scrubArray( $array, int $listType = self::LIST_AND ): string { if ( is_array( $array ) ) { $scrubbedArray = []; foreach ( $array as $key => $value ) { |