From faffad7cf802ac4d4344b9fb1b8e9d1258bf6871 Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Tue, 28 May 2019 16:07:50 +0200 Subject: [PATCH] =?utf8?q?Inline=20trivial=20=E2=80=A6=5Finternal()=20meth?= =?utf8?q?ods=20in=20Title/UserArray=20classes?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This code is quite old. I can't tell why it was written this way. But I can see these methods are never used anywhere else. We can as well inline them. Change-Id: I252f4d2b2b2da822c8d43ffc1f088f5848034c5e --- includes/TitleArray.php | 14 +------------- includes/user/UserArray.php | 13 +------------ 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/includes/TitleArray.php b/includes/TitleArray.php index a1eabe5b25..f6969851d5 100644 --- a/includes/TitleArray.php +++ b/includes/TitleArray.php @@ -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 ); } } diff --git a/includes/user/UserArray.php b/includes/user/UserArray.php index 66d9c7a1f8..c398e4904e 100644 --- a/includes/user/UserArray.php +++ b/includes/user/UserArray.php @@ -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 ); - } } -- 2.20.1