Merge "Simplify Block::getBy and Block::getByName"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 25 Mar 2019 22:21:05 +0000 (22:21 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 25 Mar 2019 22:21:05 +0000 (22:21 +0000)
includes/Block.php

index 04a5a15..060eebd 100644 (file)
@@ -1036,10 +1036,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();
        }
 
        /**
@@ -1048,10 +1045,7 @@ class Block {
         * @return string
         */
        public function getByName() {
-               $blocker = $this->getBlocker();
-               return ( $blocker instanceof User )
-                       ? $blocker->getName()
-                       : (string)$blocker; // username
+               return $this->getBlocker()->getName();
        }
 
        /**