From a822b39d33d382ef8a95f33815884da8564dfebc Mon Sep 17 00:00:00 2001 From: Dayllan Maza Date: Wed, 2 Aug 2023 23:20:34 -0400 Subject: [PATCH] Blocks: Misc changes * Removed un-used property * Simplified return value and swift statement Change-Id: I57db9d2f160bec5d9ae8afd6805e7ce07daf63c1 --- includes/block/AbstractBlock.php | 2 -- includes/block/BlockManager.php | 4 +--- includes/block/BlockPermissionChecker.php | 7 +------ includes/block/DatabaseBlock.php | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/includes/block/AbstractBlock.php b/includes/block/AbstractBlock.php index 699c1ea2992..d7ebdf751cf 100644 --- a/includes/block/AbstractBlock.php +++ b/includes/block/AbstractBlock.php @@ -290,8 +290,6 @@ abstract class AbstractBlock implements Block { $res = $this->isSitewide(); break; case 'read': - $res = false; - break; case 'purge': $res = false; break; diff --git a/includes/block/BlockManager.php b/includes/block/BlockManager.php index 3a0f55458f2..aef68511cf4 100644 --- a/includes/block/BlockManager.php +++ b/includes/block/BlockManager.php @@ -682,8 +682,6 @@ class BlockManager { return $id; } $hmac = MWCryptHash::hmac( $id, $this->options->get( MainConfigNames::SecretKey ), false ); - $cookieValue = $id . '!' . $hmac; - return $cookieValue; + return $id . '!' . $hmac; } - } diff --git a/includes/block/BlockPermissionChecker.php b/includes/block/BlockPermissionChecker.php index 0fbf93468ac..ea8193556ec 100644 --- a/includes/block/BlockPermissionChecker.php +++ b/includes/block/BlockPermissionChecker.php @@ -42,11 +42,6 @@ class BlockPermissionChecker { */ private $target; - /** - * @var int|null One of AbstractBlock::TYPE_* constants, or null when unknown - */ - private $targetType = null; - /** * @var Authority Block performer */ @@ -76,7 +71,7 @@ class BlockPermissionChecker { ) { $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); $this->options = $options; - [ $this->target, $this->targetType ] = $blockUtils->parseBlockTarget( $target ); + [ $this->target, ] = $blockUtils->parseBlockTarget( $target ); $this->performer = $performer; } diff --git a/includes/block/DatabaseBlock.php b/includes/block/DatabaseBlock.php index 5d849f1dea8..d97dd4e91fe 100644 --- a/includes/block/DatabaseBlock.php +++ b/includes/block/DatabaseBlock.php @@ -103,7 +103,7 @@ class DatabaseBlock extends AbstractBlock { $options += $defaults; - if ( $options['by'] && $options['by'] instanceof UserIdentity ) { + if ( $options['by'] instanceof UserIdentity ) { $this->setBlocker( $options['by'] ); }