jenkins-bot has submitted this change and it was merged. Change subject: Improve docs, fix deprecated functons usage, rm unused method ......................................................................
Improve docs, fix deprecated functons usage, rm unused method Change-Id: Ic79ace426cb4dd377750966d7ce6722202c4c8b0 --- M includes/CoordinatesParserFunction.php M includes/GeoData.body.php M includes/GeoDataHooks.php M includes/api/ApiQueryGeoSearchElastic.php 4 files changed, 23 insertions(+), 33 deletions(-) Approvals: Yurik: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/CoordinatesParserFunction.php b/includes/CoordinatesParserFunction.php index 5f989f4..dfb4d8a 100644 --- a/includes/CoordinatesParserFunction.php +++ b/includes/CoordinatesParserFunction.php @@ -31,7 +31,7 @@ * * @param Parser $parser * @param PPFrame $frame - * @param Array $args + * @param PPNode[] $args * @throws MWException * @return Mixed */ @@ -71,7 +71,7 @@ /** * Parses parser function input * @param PPFrame $frame - * @param Array $args + * @param PPNode[] $args */ private function parseArgs( $frame, $args ) { $first = trim( $frame->expand( array_shift( $args ) ) ); @@ -89,7 +89,7 @@ /** * Add an unnamed parameter to the list, turining it into a named one if needed - * @param String $value: Parameter + * @param string $value Parameter */ private function addArg( $value ) { $primary = MagicWord::get( 'primary' ); @@ -106,7 +106,7 @@ * Applies a coordinate to parser output * * @param Coord $coord - * @return Status: whether save went OK + * @return Status whether save went OK */ private function applyCoord( Coord $coord ) { global $wgMaxCoordinatesPerPage, $wgContLang; @@ -228,7 +228,7 @@ * Returns wikitext of status error message in content language * * @param Status $s - * @return String + * @return string */ private function errorText( Status $s ) { $errors = array_merge( $s->getErrorsArray(), $s->getWarningsArray() ); diff --git a/includes/GeoData.body.php b/includes/GeoData.body.php index 605be8f..5bee492 100644 --- a/includes/GeoData.body.php +++ b/includes/GeoData.body.php @@ -23,7 +23,7 @@ /** * Returns primary coordinates of the given page, if any * @param Title $title - * @return Coord|bool: Coordinates or false + * @return Coord|bool Coordinates or false */ public static function getPageCoordinates( Title $title ) { $coords = self::getAllCoordinates( $title->getArticleID(), array( 'gt_primary' => 1 ) ); @@ -36,10 +36,10 @@ /** * Retrieves all coordinates for the given page id * - * @param int $pageId: ID of the page - * @param Array $conds: Conditions for Database::select() - * @param int $dbType: Database to select from DM_MASTER or DB_SLAVE - * @return Array: Array of Coord objects + * @param int $pageId ID of the page + * @param array $conds Conditions for Database::select() + * @param int $dbType Database to select from DM_MASTER or DB_SLAVE + * @return Coord[] */ public static function getAllCoordinates( $pageId, $conds = array(), $dbType = DB_SLAVE ) { $db = wfGetDB( $dbType ); @@ -56,9 +56,9 @@ * Parses coordinates * See https://en.wikipedia.org/wiki/Template:Coord for sample inputs * - * @param Array $parts: Array of coordinate components - * @param String $globe: Globe name - * @return Status: Status object, in case of success its value is a Coord object. + * @param array $parts Array of coordinate components + * @param string $globe Globe name + * @return Status Status object, in case of success its value is a Coord object. */ public static function parseCoordinates( $parts, $globe ) { global $wgGlobes; @@ -142,9 +142,9 @@ /** * Parses coordinate suffix such as N, S, E or W * - * @param String $str: String to test - * @param Array $coordInfo - * @return int: Sign modifier or 0 if not a suffix + * @param string $str String to test + * @param array $coordInfo + * @return int Sign modifier or 0 if not a suffix */ public static function parseSuffix( $str, $coordInfo ) { global $wgContLang; @@ -167,17 +167,5 @@ ); } return $result; - } - - /** - * Given an array of non-normalised probabilities, this function will select - * an element and return the appropriate key. - * - * @param $weights array - * - * @return int - */ - public static function pickRandom( $weights ) { - return ArrayUtils::pickRandom( $weights ); } } diff --git a/includes/GeoDataHooks.php b/includes/GeoDataHooks.php index 4280ec4..fb7a79b 100644 --- a/includes/GeoDataHooks.php +++ b/includes/GeoDataHooks.php @@ -54,7 +54,7 @@ * UnitTestsList hook handler * @see https://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList * - * @param Array $files + * @param array $files * @return bool */ public static function onUnitTestsList( &$files ) { @@ -84,7 +84,7 @@ * * @param Article $article * @param User $user - * @param String $reason + * @param string $reason * @param int $id * @return bool */ @@ -132,9 +132,11 @@ return null; } $metadata = $file->getMetadata(); - wfSuppressWarnings(); + + MediaWiki\suppressWarnings(); $metadata = unserialize( $metadata ); - wfRestoreWarnings(); + MediaWiki\restoreWarnings(); + if ( isset( $metadata ) && isset( $metadata['GPSLatitude'] ) && isset( $metadata['GPSLongitude'] ) ) { $lat = $metadata['GPSLatitude']; $lon = $metadata['GPSLongitude']; diff --git a/includes/api/ApiQueryGeoSearchElastic.php b/includes/api/ApiQueryGeoSearchElastic.php index 2a9f2d4..00312e5 100644 --- a/includes/api/ApiQueryGeoSearchElastic.php +++ b/includes/api/ApiQueryGeoSearchElastic.php @@ -14,7 +14,7 @@ global $wgDefaultGlobe, $wgGeoDataIndexLatLon; parent::run( $resultPageSet ); - $this->resetQueryParams(); + $this->resetQueryParams(); //@fixme: refactor to make this unnecessary try { $params = $this->params = $this->extractRequestParams(); -- To view, visit https://gerrit.wikimedia.org/r/262729 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic79ace426cb4dd377750966d7ce6722202c4c8b0 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/GeoData Gerrit-Branch: master Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: Yurik <yu...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits