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
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 );
}
}
if ( !Hooks::run( 'UserArrayFromResult', [ &$userArray, $res ] ) ) {
return null;
}
- if ( $userArray === null ) {
- $userArray = self::newFromResult_internal( $res );
- }
- return $userArray;
+ return $userArray ?? new UserArrayFromResult( $res );
}
/**
);
return self::newFromResult( $res );
}
-
- /**
- * @param IResultWrapper $res
- * @return UserArrayFromResult
- */
- protected static function newFromResult_internal( $res ) {
- return new UserArrayFromResult( $res );
- }
}