From 8b77749599823bb1294f0dd36b5898961857723e Mon Sep 17 00:00:00 2001 From: Thalia Date: Thu, 21 Mar 2019 22:23:31 +0000 Subject: [PATCH] Simplify Block::getBy and Block::getByName Block::getBlocker always returns a User, so there is no need for these methods to check. Change-Id: I0319f0aee8d3fb3c89e8f63ee2f4ba05c8d36482 --- includes/Block.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/includes/Block.php b/includes/Block.php index 0693650238..40a48ceb20 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -1032,10 +1032,7 @@ class Block { * @return int (0 for foreign users) */ public function getBy() { - $blocker = $this->getBlocker(); - return ( $blocker instanceof User ) - ? $blocker->getId() - : 0; + return $this->getBlocker()->getId(); } /** @@ -1044,10 +1041,7 @@ class Block { * @return string */ public function getByName() { - $blocker = $this->getBlocker(); - return ( $blocker instanceof User ) - ? $blocker->getName() - : (string)$blocker; // username + return $this->getBlocker()->getName(); } /** -- 2.20.1