Merge "Inline trivial …_internal() methods in Title/UserArray classes"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 31 May 2019 20:33:21 +0000 (20:33 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 31 May 2019 20:33:21 +0000 (20:33 +0000)
includes/TitleArray.php
includes/user/UserArray.php

index a1eabe5..f696985 100644 (file)
@@ -42,18 +42,6 @@ abstract class TitleArray implements Iterator {
                if ( !Hooks::run( 'TitleArrayFromResult', [ &$array, $res ] ) ) {
                        return null;
                }
-               if ( $array === null ) {
-                       $array = self::newFromResult_internal( $res );
-               }
-               return $array;
-       }
-
-       /**
-        * @param IResultWrapper $res
-        * @return TitleArrayFromResult
-        */
-       protected static function newFromResult_internal( $res ) {
-               $array = new TitleArrayFromResult( $res );
-               return $array;
+               return $array ?? new TitleArrayFromResult( $res );
        }
 }
index 66d9c7a..c398e49 100644 (file)
@@ -32,10 +32,7 @@ abstract class UserArray implements Iterator {
                if ( !Hooks::run( 'UserArrayFromResult', [ &$userArray, $res ] ) ) {
                        return null;
                }
-               if ( $userArray === null ) {
-                       $userArray = self::newFromResult_internal( $res );
-               }
-               return $userArray;
+               return $userArray ?? new UserArrayFromResult( $res );
        }
 
        /**
@@ -84,12 +81,4 @@ abstract class UserArray implements Iterator {
                );
                return self::newFromResult( $res );
        }
-
-       /**
-        * @param IResultWrapper $res
-        * @return UserArrayFromResult
-        */
-       protected static function newFromResult_internal( $res ) {
-               return new UserArrayFromResult( $res );
-       }
 }