From 08762b02deb017e53c3d67a8b3f8e983758cb67f Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Tue, 31 Mar 2015 17:13:47 -0700 Subject: [PATCH] Minor cleanups * Declare undeclared variables * Kill unused variables * Fix comments including PHPDoc Change-Id: I60015f6b6740aa9088bda3745f4dc4e65e29fcb1 --- includes/parser/CoreParserFunctions.php | 16 ++++++++++++---- includes/parser/DateFormatter.php | 2 +- includes/parser/Parser.php | 11 +++++++---- includes/parser/ParserOptions.php | 1 + includes/parser/ParserOutput.php | 1 + tests/phpunit/MediaWikiTestCase.php | 5 ++--- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 2b495b1411..830a68fc14 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -893,9 +893,17 @@ class CoreParserFunctions { } } - // Usage {{filepath|300}}, {{filepath|nowiki}}, {{filepath|nowiki|300}} - // or {{filepath|300|nowiki}} or {{filepath|300px}}, {{filepath|200x300px}}, - // {{filepath|nowiki|200x300px}}, {{filepath|200x300px|nowiki}}. + /** + * Usage {{filepath|300}}, {{filepath|nowiki}}, {{filepath|nowiki|300}} + * or {{filepath|300|nowiki}} or {{filepath|300px}}, {{filepath|200x300px}}, + * {{filepath|nowiki|200x300px}}, {{filepath|200x300px|nowiki}}. + * + * @param Parser $parser + * @param string $name + * @param string $argA + * @param string $argB + * @return array|string + */ public static function filepath( $parser, $name = '', $argA = '', $argB = '' ) { $file = wfFindFile( $name ); @@ -934,7 +942,7 @@ class CoreParserFunctions { * Parser function to extension tag adaptor * @param Parser $parser * @param PPFrame $frame - * @param array $args + * @param PPNode[] $args * @return string */ public static function tagObj( $parser, $frame, $args ) { diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php index 3db8d1e6fe..ef295ab217 100644 --- a/includes/parser/DateFormatter.php +++ b/includes/parser/DateFormatter.php @@ -33,7 +33,7 @@ class DateFormatter { public $regexes, $pDays, $pMonths, $pYears; public $rules, $xMonths, $preferences; - protected $lang; + protected $lang, $mLinked; const ALL = -1; const NONE = 0; diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 40b0a4f459..7c221d8d02 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -147,7 +147,11 @@ class Parser { */ public $mSubstWords; # Initialised in constructor - public $mConf, $mPreprocessor, $mExtLinkBracketedRegex, $mUrlProtocols; + public $mConf, $mExtLinkBracketedRegex, $mUrlProtocols; + + # Initialized in getPreprocessor() + /** @var Preprocessor */ + public $mPreprocessor; # Cleared with clearState(): /** @@ -393,7 +397,6 @@ class Parser { */ global $wgShowHostnames; - $fname = __METHOD__ . '-' . wfGetCaller(); if ( $clearState ) { $magicScopeVariable = $this->lock(); @@ -1199,7 +1202,7 @@ class Parser { * * @param string $text * @param bool $isMain - * @param bool $frame + * @param PPFrame|bool $frame * * @return string */ @@ -5427,7 +5430,7 @@ class Parser { } /** - * @param string $handler + * @param MediaHandler $handler * @return array */ public function getImageParams( $handler ) { diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 9e06ee2d64..5fa52ff39e 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -669,6 +669,7 @@ class ParserOptions { * * This ignores report limit settings that only affect HTML comments * + * @param ParserOptions $other * @return bool * @since 1.25 */ diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index bae3eaa598..65b527c8a8 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -57,6 +57,7 @@ class ParserOutput extends CacheTime { private $mLimitReportData = array(); # Parser limit report data private $mParseStartTime = array(); # Timestamps for getTimeSinceStart() private $mPreventClickjacking = false; # Whether to emit X-Frame-Options: DENY + private $mFlags = array(); # Generic flags const EDITSECTION_REGEX = '#<(?:mw:)?editsection page="(.*?)" section="(.*?)"(?:/>|>(.*?)())#'; diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 0253284753..72cac05194 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -104,7 +104,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { ObjectCache::$instances[CACHE_DB] = new HashBagOStuff; $needsResetDB = false; - $logName = get_class( $this ) . '::' . $this->getName( false ); if ( $this->needsDB() ) { // set up a DB connection for this test to use @@ -632,7 +631,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { * @param string $msg */ private function assertEmpty2( $value, $msg ) { - return $this->assertTrue( $value == '', $msg ); + $this->assertTrue( $value == '', $msg ); } private static function unprefixTable( $tableName ) { @@ -648,7 +647,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { /** * @since 1.18 * - * @param DataBaseBase $db + * @param DatabaseBase $db * * @return array */ -- 2.20.1