From: Max Semenik Date: Thu, 27 Jun 2019 20:42:54 +0000 (-0700) Subject: MediaWiki\Block namespace minor tweaks X-Git-Tag: 1.34.0-rc.0~1265^2 X-Git-Url: http://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=48d355de818353e6ce4b05c024f43aab11824ed2 MediaWiki\Block namespace minor tweaks * Visibility * Parameter type hints and docs * Minor doc fixes Change-Id: I46d4b99e18cffdf8323fb01b7ed30f3eda2906d1 --- diff --git a/includes/block/AbstractBlock.php b/includes/block/AbstractBlock.php index c7ba68daa2..0357f8d29d 100644 --- a/includes/block/AbstractBlock.php +++ b/includes/block/AbstractBlock.php @@ -84,7 +84,7 @@ abstract class AbstractBlock { * timestamp string The time at which the block comes into effect * byText string Username of the blocker (for foreign users) */ - function __construct( $options = [] ) { + public function __construct( array $options = [] ) { $defaults = [ 'address' => '', 'by' => null, diff --git a/includes/block/BlockManager.php b/includes/block/BlockManager.php index abd2db24af..dc07364e15 100644 --- a/includes/block/BlockManager.php +++ b/includes/block/BlockManager.php @@ -76,23 +76,23 @@ class BlockManager { * @param bool $applyIpBlocksToXff * @param bool $cookieSetOnAutoblock * @param bool $cookieSetOnIpBlock - * @param array $dnsBlacklistUrls + * @param string[] $dnsBlacklistUrls * @param bool $enableDnsBlacklist - * @param array $proxyList - * @param array $proxyWhitelist + * @param string[] $proxyList + * @param string[] $proxyWhitelist * @param string $secretKey * @param array $softBlockRanges */ public function __construct( - $currentUser, - $currentRequest, + User $currentUser, + WebRequest $currentRequest, $applyIpBlocksToXff, $cookieSetOnAutoblock, $cookieSetOnIpBlock, - $dnsBlacklistUrls, + array $dnsBlacklistUrls, $enableDnsBlacklist, - $proxyList, - $proxyWhitelist, + array $proxyList, + array $proxyWhitelist, $secretKey, $softBlockRanges ) { @@ -232,7 +232,7 @@ class BlockManager { * @param AbstractBlock[] $blocks * @return AbstractBlock[] */ - private function getUniqueBlocks( $blocks ) { + private function getUniqueBlocks( array $blocks ) { $systemBlocks = []; $databaseBlocks = []; diff --git a/includes/block/BlockRestrictionStore.php b/includes/block/BlockRestrictionStore.php index 88c0951b03..df09eadc8f 100644 --- a/includes/block/BlockRestrictionStore.php +++ b/includes/block/BlockRestrictionStore.php @@ -26,6 +26,7 @@ use MediaWiki\Block\Restriction\NamespaceRestriction; use MediaWiki\Block\Restriction\PageRestriction; use MediaWiki\Block\Restriction\Restriction; use MWException; +use stdClass; use Wikimedia\Rdbms\IResultWrapper; use Wikimedia\Rdbms\IDatabase; use Wikimedia\Rdbms\ILoadBalancer; @@ -45,8 +46,8 @@ class BlockRestrictionStore { */ private $loadBalancer; - /* - * @param LoadBalancer $loadBalancer load balancer for acquiring database connections + /** + * @param ILoadBalancer $loadBalancer load balancer for acquiring database connections */ public function __construct( ILoadBalancer $loadBalancer ) { $this->loadBalancer = $loadBalancer; @@ -224,7 +225,7 @@ class BlockRestrictionStore { * Delete the restrictions. * * @since 1.33 - * @param Restriction[]|null $restrictions + * @param Restriction[] $restrictions * @throws MWException * @return bool */ @@ -435,10 +436,10 @@ class BlockRestrictionStore { /** * Convert a result row from the database into a restriction object. * - * @param \stdClass $row + * @param stdClass $row * @return Restriction|null */ - private function rowToRestriction( \stdClass $row ) { + private function rowToRestriction( stdClass $row ) { if ( array_key_exists( (int)$row->ir_type, $this->types ) ) { $class = $this->types[ (int)$row->ir_type ]; return call_user_func( [ $class, 'newFromRow' ], $row ); diff --git a/includes/block/CompositeBlock.php b/includes/block/CompositeBlock.php index 8efd7de956..e0f69dda8a 100644 --- a/includes/block/CompositeBlock.php +++ b/includes/block/CompositeBlock.php @@ -43,7 +43,7 @@ class CompositeBlock extends AbstractBlock { * @param array $options Parameters of the block: * originalBlocks Block[] Blocks that this block is composed from */ - function __construct( $options = [] ) { + public function __construct( array $options = [] ) { parent::__construct( $options ); $defaults = [ diff --git a/includes/block/DatabaseBlock.php b/includes/block/DatabaseBlock.php index 0f193240a0..fbf9a073ca 100644 --- a/includes/block/DatabaseBlock.php +++ b/includes/block/DatabaseBlock.php @@ -265,7 +265,7 @@ class DatabaseBlock extends AbstractBlock { * Load blocks from the database which target the specific target exactly, or which cover the * vague target. * - * @param User|String|null $specificTarget + * @param User|string|null $specificTarget * @param int|null $specificType * @param bool $fromMaster * @param User|string|null $vagueTarget Also search for blocks affecting this target. Doesn't @@ -369,7 +369,7 @@ class DatabaseBlock extends AbstractBlock { * @param DatabaseBlock[] $blocks These should not include autoblocks or ID blocks * @return DatabaseBlock|null The block with the most specific target */ - protected static function chooseMostSpecificBlock( $blocks ) { + protected static function chooseMostSpecificBlock( array $blocks ) { if ( count( $blocks ) === 1 ) { return $blocks[0]; } @@ -535,7 +535,7 @@ class DatabaseBlock extends AbstractBlock { * @return bool|array False on failure, assoc array on success: * ('id' => block ID, 'autoIds' => array of autoblock IDs) */ - public function insert( $dbw = null ) { + public function insert( IDatabase $dbw = null ) { global $wgBlockDisablesLogin; if ( !$this->getBlocker() || $this->getBlocker()->getName() === '' ) { diff --git a/includes/block/SystemBlock.php b/includes/block/SystemBlock.php index 2a8c663b8b..029e0b8741 100644 --- a/includes/block/SystemBlock.php +++ b/includes/block/SystemBlock.php @@ -45,7 +45,7 @@ class SystemBlock extends AbstractBlock { * in the database. Value is a string to return * from self::getSystemBlockType(). */ - function __construct( $options = [] ) { + public function __construct( array $options = [] ) { parent::__construct( $options ); $defaults = [