[MediaWiki-commits] [Gerrit] Improve docs, fix deprecated functons usage, rm unused method - change (mediawiki...GeoData)
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
[MediaWiki-commits] [Gerrit] Improve docs, fix deprecated functons usage, rm unused method - change (mediawiki...GeoData)
MaxSem has uploaded a new change for review. https://gerrit.wikimedia.org/r/262729 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, 21 insertions(+), 31 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GeoData refs/changes/29/262729/1 diff --git a/includes/CoordinatesParserFunction.php b/includes/CoordinatesParserFunction.php index 5f989f4..25dce4a 100644 --- a/includes/CoordinatesParserFunction.php +++ b/includes/CoordinatesParserFunction.php @@ -31,7 +31,7 @@ * * @param Parser $parser * @param PPFrame $frame -* @param Array $args +* @param array $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 ) ) ); @@ -231,7 +231,7 @@ * @return String */ private function errorText( Status $s ) { - $errors = array_merge( $s->getErrorsArray(), $s->getWarningsArray() ); + $errors = $s->getStatusArray(); if ( !count( $errors ) ) { return ''; } diff --git a/includes/GeoData.body.php b/includes/GeoData.body.php index 605be8f..9ead1f2 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 array Array of Coord objects */ 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 +*