From 9b8b314992ea7d11ee77e6f3cfe180f647e3cb0f Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Fri, 11 Aug 2017 23:45:25 +0200 Subject: [PATCH] Fix spacing for @param and indent of function comments In phpcs.xml rename renamed sniffs and add the failing sniffs, because now the whole sniff is no longer excluded. Change-Id: If5b0bd16028761abc2c47ace9e97d37ad14bb36f --- includes/content/ContentHandler.php | 10 +++++----- includes/content/TextContentHandler.php | 2 +- includes/debug/logger/LegacyLogger.php | 16 ++++++++-------- includes/exception/MWExceptionHandler.php | 2 +- includes/filerepo/file/File.php | 2 +- includes/filerepo/file/UnregisteredLocalFile.php | 4 ++-- includes/libs/objectcache/RESTBagOStuff.php | 10 +++++----- includes/libs/stats/NullStatsdDataFactory.php | 2 -- includes/media/MediaHandler.php | 2 +- includes/page/WikiPage.php | 8 ++++---- .../ResourceLoaderJqueryMsgModule.php | 6 +++--- includes/search/NullIndexField.php | 2 +- includes/search/SearchEngine.php | 2 +- includes/search/SearchIndexField.php | 8 +++++++- includes/search/SearchIndexFieldDefinition.php | 8 ++++++-- includes/search/SearchResult.php | 2 +- includes/skins/QuickTemplate.php | 10 +++++----- includes/specials/SpecialMediaStatistics.php | 10 ++++++---- includes/utils/BatchRowUpdate.php | 4 ++-- includes/utils/BatchRowWriter.php | 4 ++-- phpcs.xml | 16 +++++++++++----- tests/phpunit/MediaWikiTestCase.php | 1 - 22 files changed, 73 insertions(+), 58 deletions(-) diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index 90364f397f..0509e29215 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -1135,9 +1135,9 @@ abstract class ContentHandler { /** * Add new field definition to array. * @param SearchIndexField[] &$fields - * @param SearchEngine $engine - * @param string $name - * @param int $type + * @param SearchEngine $engine + * @param string $name + * @param int $type * @return SearchIndexField[] new field defs * @since 1.28 */ @@ -1151,7 +1151,7 @@ abstract class ContentHandler { * as representation of this document. * Overriding class should call parent function or take care of calling * the SearchDataForIndex hook. - * @param WikiPage $page Page to index + * @param WikiPage $page Page to index * @param ParserOutput $output * @param SearchEngine $engine Search engine for which we are indexing * @return array Map of name=>value for fields @@ -1190,7 +1190,7 @@ abstract class ContentHandler { * * Specific content handlers may override it if they need different content handling. * - * @param WikiPage $page + * @param WikiPage $page * @param ParserCache $cache * @return ParserOutput */ diff --git a/includes/content/TextContentHandler.php b/includes/content/TextContentHandler.php index 698a37b6fe..ced2a665ac 100644 --- a/includes/content/TextContentHandler.php +++ b/includes/content/TextContentHandler.php @@ -40,7 +40,7 @@ class TextContentHandler extends ContentHandler { * Returns the content's text as-is. * * @param Content $content - * @param string $format The serialization format to check + * @param string $format The serialization format to check * * @return mixed */ diff --git a/includes/debug/logger/LegacyLogger.php b/includes/debug/logger/LegacyLogger.php index 6359509088..06ec5743fc 100644 --- a/includes/debug/logger/LegacyLogger.php +++ b/includes/debug/logger/LegacyLogger.php @@ -454,14 +454,14 @@ class LegacyLogger extends AbstractLogger { } /** - * Log to a file without getting "file size exceeded" signals. - * - * Can also log to UDP with the syntax udp://host:port/prefix. This will send - * lines to the specified port, prefixed by the specified prefix and a space. - * - * @param string $text - * @param string $file Filename - */ + * Log to a file without getting "file size exceeded" signals. + * + * Can also log to UDP with the syntax udp://host:port/prefix. This will send + * lines to the specified port, prefixed by the specified prefix and a space. + * + * @param string $text + * @param string $file Filename + */ public static function emit( $text, $file ) { if ( substr( $file, 0, 4 ) == 'udp:' ) { $transport = UDPTransport::newFromString( $file ); diff --git a/includes/exception/MWExceptionHandler.php b/includes/exception/MWExceptionHandler.php index a2867a1879..bf232e9799 100644 --- a/includes/exception/MWExceptionHandler.php +++ b/includes/exception/MWExceptionHandler.php @@ -616,7 +616,7 @@ TXT; * @param ErrorException $e * @param string $channel * @param string $level - */ + */ protected static function logError( ErrorException $e, $channel, $level = LogLevel::ERROR ) { diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 9aa2b186e5..71e1c63480 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -355,7 +355,7 @@ abstract class File implements IDBAccessObject { return $this->url; } - /* + /** * Get short description URL for a files based on the page ID * * @return string|null diff --git a/includes/filerepo/file/UnregisteredLocalFile.php b/includes/filerepo/file/UnregisteredLocalFile.php index b22f8cb34e..cdad5fcec8 100644 --- a/includes/filerepo/file/UnregisteredLocalFile.php +++ b/includes/filerepo/file/UnregisteredLocalFile.php @@ -171,8 +171,8 @@ class UnregisteredLocalFile extends File { } /** - * @return int - */ + * @return int + */ function getBitDepth() { $gis = $this->getImageSize( $this->getLocalRefPath() ); diff --git a/includes/libs/objectcache/RESTBagOStuff.php b/includes/libs/objectcache/RESTBagOStuff.php index 730eed1e30..5d2577b16e 100644 --- a/includes/libs/objectcache/RESTBagOStuff.php +++ b/includes/libs/objectcache/RESTBagOStuff.php @@ -56,7 +56,7 @@ class RESTBagOStuff extends BagOStuff { } /** - * @param string $key + * @param string $key * @param integer $flags Bitfield of BagOStuff::READ_* constants [optional] * @return mixed Returns false on failure and if the item does not exist */ @@ -82,7 +82,7 @@ class RESTBagOStuff extends BagOStuff { /** * Handle storage error * @param string $msg Error message - * @param int $rcode Error code from client + * @param int $rcode Error code from client * @param string $rerr Error message from client * @return false */ @@ -99,9 +99,9 @@ class RESTBagOStuff extends BagOStuff { * Set an item * * @param string $key - * @param mixed $value - * @param int $exptime Either an interval in seconds or a unix timestamp for expiry - * @param int $flags Bitfield of BagOStuff::WRITE_* constants + * @param mixed $value + * @param int $exptime Either an interval in seconds or a unix timestamp for expiry + * @param int $flags Bitfield of BagOStuff::WRITE_* constants * @return bool Success */ public function set( $key, $value, $exptime = 0, $flags = 0 ) { diff --git a/includes/libs/stats/NullStatsdDataFactory.php b/includes/libs/stats/NullStatsdDataFactory.php index f2e35b67be..75d6b9e7eb 100644 --- a/includes/libs/stats/NullStatsdDataFactory.php +++ b/includes/libs/stats/NullStatsdDataFactory.php @@ -53,7 +53,6 @@ class NullStatsdDataFactory implements IBufferingStatsdDataFactory { * This function creates a 'increment' StatsdData object. * * @param string|array $key The metric(s) to increment. - * @param float|1 $sampleRate The rate (0-1) for sampling. * * @return array */ @@ -66,7 +65,6 @@ class NullStatsdDataFactory implements IBufferingStatsdDataFactory { * * * @param string|array $key The metric(s) to decrement. - * @param float|1 $sampleRate The rate (0-1) for sampling. * * @return mixed */ diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php index 2f721813e8..aa7c62be9d 100644 --- a/includes/media/MediaHandler.php +++ b/includes/media/MediaHandler.php @@ -874,7 +874,7 @@ abstract class MediaHandler { * @param Array $pagesByDimensions * @return String * @since 1.30 - */ + */ public static function getPageRangesByDimensions( $pagesByDimensions ) { $pageRangesByDimensions = []; diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 4f4decfbdd..e60f103f60 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1047,9 +1047,9 @@ class WikiPage implements Page, IDBAccessObject { * * @since 1.19 * @param ParserOptions $parserOptions ParserOptions to use for the parse operation - * @param null|int $oldid Revision ID to get the text from, passing null or 0 will - * get the current revision (default value) - * @param bool $forceParse Force reindexing, regardless of cache settings + * @param null|int $oldid Revision ID to get the text from, passing null or 0 will + * get the current revision (default value) + * @param bool $forceParse Force reindexing, regardless of cache settings * @return bool|ParserOutput ParserOutput or false if the revision was not found */ public function getParserOutput( @@ -3633,7 +3633,7 @@ class WikiPage implements Page, IDBAccessObject { return $this->getTitle()->getCanonicalURL(); } - /* + /** * @param WANObjectCache $cache * @return string[] * @since 1.28 diff --git a/includes/resourceloader/ResourceLoaderJqueryMsgModule.php b/includes/resourceloader/ResourceLoaderJqueryMsgModule.php index 01476ed17c..bef34f993d 100644 --- a/includes/resourceloader/ResourceLoaderJqueryMsgModule.php +++ b/includes/resourceloader/ResourceLoaderJqueryMsgModule.php @@ -65,9 +65,9 @@ class ResourceLoaderJqueryMsgModule extends ResourceLoaderFileModule { } /** - * @param ResourceLoaderContext $context - * @return array - */ + * @param ResourceLoaderContext $context + * @return array + */ public function getScriptURLsForDebug( ResourceLoaderContext $context ) { // Bypass file module urls return ResourceLoaderModule::getScriptURLsForDebug( $context ); diff --git a/includes/search/NullIndexField.php b/includes/search/NullIndexField.php index 5ecf5c8929..ff1e8cbf74 100644 --- a/includes/search/NullIndexField.php +++ b/includes/search/NullIndexField.php @@ -17,7 +17,7 @@ class NullIndexField implements SearchIndexField { /** * Set global flag for this field. * - * @param int $flag Bit flag to set/unset + * @param int $flag Bit flag to set/unset * @param bool $unset True if flag should be unset, false by default * @return $this */ diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 1b9ee6c5db..7c2f0f25ca 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -728,7 +728,7 @@ abstract class SearchEngine { * Create a search field definition. * Specific search engines should override this method to create search fields. * @param string $name - * @param int $type One of the types in SearchIndexField::INDEX_TYPE_* + * @param int $type One of the types in SearchIndexField::INDEX_TYPE_* * @return SearchIndexField * @since 1.28 */ diff --git a/includes/search/SearchIndexField.php b/includes/search/SearchIndexField.php index eb72662508..6f3b207848 100644 --- a/includes/search/SearchIndexField.php +++ b/includes/search/SearchIndexField.php @@ -30,16 +30,19 @@ interface SearchIndexField { * This field is case-insensitive. */ const FLAG_CASEFOLD = 1; + /** * This field contains secondary information, which is * already present in other fields, but can be used for * scoring. */ const FLAG_SCORING = 2; + /** * This field does not need highlight handling. */ const FLAG_NO_HIGHLIGHT = 4; + /** * Do not index this field, just store it. */ @@ -51,20 +54,23 @@ interface SearchIndexField { * @return array|null Null means this field does not map to anything */ public function getMapping( SearchEngine $engine ); + /** * Set global flag for this field. * - * @param int $flag Bit flag to set/unset + * @param int $flag Bit flag to set/unset * @param bool $unset True if flag should be unset, false by default * @return $this */ public function setFlag( $flag, $unset = false ); + /** * Check if flag is set. * @param int $flag * @return int 0 if unset, !=0 if set */ public function checkFlag( $flag ); + /** * Merge two field definitions if possible. * diff --git a/includes/search/SearchIndexFieldDefinition.php b/includes/search/SearchIndexFieldDefinition.php index 3e008ae66a..a11dff9fc7 100644 --- a/includes/search/SearchIndexFieldDefinition.php +++ b/includes/search/SearchIndexFieldDefinition.php @@ -9,24 +9,28 @@ * @since 1.28 */ abstract class SearchIndexFieldDefinition implements SearchIndexField { + /** * Name of the field * * @var string */ protected $name; + /** * Type of the field, one of the constants above * * @var int */ protected $type; + /** * Bit flags for the field. * * @var int */ protected $flags = 0; + /** * Subfields * @var SearchIndexFieldDefinition[] @@ -40,7 +44,7 @@ abstract class SearchIndexFieldDefinition implements SearchIndexField { /** * @param string $name Field name - * @param int $type Index type + * @param int $type Index type */ public function __construct( $name, $type ) { $this->name = $name; @@ -66,7 +70,7 @@ abstract class SearchIndexFieldDefinition implements SearchIndexField { /** * Set global flag for this field. * - * @param int $flag Bit flag to set/unset + * @param int $flag Bit flag to set/unset * @param bool $unset True if flag should be unset, false by default * @return $this */ diff --git a/includes/search/SearchResult.php b/includes/search/SearchResult.php index 50db84b034..dc294c324e 100644 --- a/includes/search/SearchResult.php +++ b/includes/search/SearchResult.php @@ -65,7 +65,7 @@ class SearchResult { /** * Return a new SearchResult and initializes it with a title. * - * @param Title $title + * @param Title $title * @param SearchResultSet $parentSet * @return SearchResult */ diff --git a/includes/skins/QuickTemplate.php b/includes/skins/QuickTemplate.php index e7120e9703..d1be4bb0df 100644 --- a/includes/skins/QuickTemplate.php +++ b/includes/skins/QuickTemplate.php @@ -62,11 +62,11 @@ abstract class QuickTemplate { } /** - * extends the value of data with name $name with the value $value - * @since 1.25 - * @param string $name - * @param mixed $value - */ + * extends the value of data with name $name with the value $value + * @since 1.25 + * @param string $name + * @param mixed $value + */ public function extend( $name, $value ) { if ( $this->haveData( $name ) ) { $this->data[$name] = $this->data[$name] . $value; diff --git a/includes/specials/SpecialMediaStatistics.php b/includes/specials/SpecialMediaStatistics.php index 1789bb2bda..8d77091dd4 100644 --- a/includes/specials/SpecialMediaStatistics.php +++ b/includes/specials/SpecialMediaStatistics.php @@ -30,13 +30,15 @@ use Wikimedia\Rdbms\IDatabase; */ class MediaStatisticsPage extends QueryPage { protected $totalCount = 0, $totalBytes = 0; + /** - * @var integer $totalPerType Combined file size of all files in a section - */ + * @var integer $totalPerType Combined file size of all files in a section + */ protected $totalPerType = 0; + /** - * @var integer $totalSize Combined file size of all files - */ + * @var integer $totalSize Combined file size of all files + */ protected $totalSize = 0; function __construct( $name = 'MediaStatistics' ) { diff --git a/includes/utils/BatchRowUpdate.php b/includes/utils/BatchRowUpdate.php index fc8bde9ae6..f42b5a072a 100644 --- a/includes/utils/BatchRowUpdate.php +++ b/includes/utils/BatchRowUpdate.php @@ -64,9 +64,9 @@ class BatchRowUpdate { protected $output; /** - * @param BatchRowIterator $reader Iterator that returns an + * @param BatchRowIterator $reader Iterator that returns an * array of database rows - * @param BatchRowWriter $writer Writer capable of pushing + * @param BatchRowWriter $writer Writer capable of pushing * row updates to the database * @param RowUpdateGenerator $generator Generates single row updates * based on the rows content diff --git a/includes/utils/BatchRowWriter.php b/includes/utils/BatchRowWriter.php index 70afb91c1b..59dcbd63f9 100644 --- a/includes/utils/BatchRowWriter.php +++ b/includes/utils/BatchRowWriter.php @@ -41,8 +41,8 @@ class BatchRowWriter { /** * @param IDatabase $db The database to write to - * @param string $table The name of the table to update - * @param string|bool $clusterName A cluster name valid for use with LBFactory + * @param string $table The name of the table to update + * @param string|bool $clusterName A cluster name valid for use with LBFactory */ public function __construct( IDatabase $db, $table, $clusterName = false ) { $this->db = $db; diff --git a/phpcs.xml b/phpcs.xml index 238fc98f1d..cabea093b2 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -2,13 +2,19 @@ - - - + + + + - - + + + + + + + diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 18e6e97d5d..6a1f4b5946 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -1254,7 +1254,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { * * @return Database[] Array of Database master connections */ - protected static function getExternalStoreDatabaseConnections() { global $wgDefaultExternalStore; -- 2.20.1