jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/371295 )
Change subject: build: Updating mediawiki/mediawiki-codesniffer to 0.11.0 ...................................................................... build: Updating mediawiki/mediawiki-codesniffer to 0.11.0 The following sniffs are failing and were disabled: * MediaWiki.Commenting.FunctionComment.ExtraParamComment * MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected * MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic * MediaWiki.Commenting.FunctionComment.MissingParamComment * MediaWiki.Commenting.FunctionComment.MissingParamName * MediaWiki.Commenting.FunctionComment.MissingParamTag * MediaWiki.Commenting.FunctionComment.MissingReturn * MediaWiki.Commenting.FunctionComment.ParamNameNoCaseMatch * MediaWiki.Commenting.FunctionComment.ParamNameNoMatch * MediaWiki.Commenting.FunctionComment.WrongStyle * MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures The following sniffs now pass and were enabled: * MediaWiki.Commenting.FunctionComment * MediaWiki.ControlStructures.AssignmentInControlStructures Change-Id: I09fc9032ab2560826fddfad87f76938ae7be19fe --- M Hooks.php M composer.json M includes/Block/Block.php M includes/Conversion/Utils.php M includes/Data/Index/TopKIndex.php M includes/Data/Listener/ReferenceRecorder.php M includes/Data/Listener/TopicPageCreationListener.php M includes/Data/Pager/Pager.php M includes/Data/Storage/BasicDbStorage.php M includes/Data/Storage/DbStorage.php M includes/Data/Utils/UserMerger.php M includes/DbFactory.php M includes/Formatter/AbstractQuery.php M includes/Formatter/RevisionFormatter.php M includes/Import/Importer.php M includes/Import/LiquidThreadsApi/CachedData.php M includes/Import/LiquidThreadsApi/Iterators.php M includes/Import/LiquidThreadsApi/Objects.php M includes/Import/LiquidThreadsApi/Source.php M includes/Model/AbstractRevision.php M includes/Model/PostRevision.php M includes/Model/Reference.php M includes/Model/URLReference.php M includes/Model/UUID.php M includes/Model/WikiReference.php M includes/Model/Workflow.php M includes/Notifications/Controller.php M includes/Repository/RootPostLoader.php M includes/Repository/TreeRepository.php M includes/Repository/UserNameBatch.php M includes/Search/Iterators/AbstractIterator.php M includes/TemplateHelper.php M includes/Templating.php M includes/WorkflowLoaderFactory.php M phpcs.xml 35 files changed, 157 insertions(+), 148 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/Hooks.php b/Hooks.php index 309e27c..c1b7529 100644 --- a/Hooks.php +++ b/Hooks.php @@ -328,7 +328,7 @@ * Loads RecentChanges list metadata into a temporary cache for later use. * * @param ChangesList $changesList - * @param array $rows + * @param array $rows */ public static function onChangesListInitRows( ChangesList $changesList, $rows ) { if ( !( $changesList instanceof OldChangesList || $changesList instanceof EnhancedChangesList ) ) { @@ -352,12 +352,12 @@ /** * Updates the given Flow topic line in an enhanced changes list (grouped RecentChanges). * - * @param ChangesList $changesList - * @param string $articlelink - * @param string $s - * @param RecentChange $rc - * @param bool $unpatrolled - * @param bool $isWatchlist + * @param ChangesList $changesList + * @param string $articlelink + * @param string $s + * @param RecentChange $rc + * @param bool $unpatrolled + * @param bool $isWatchlist * @return bool */ public static function onChangesListInsertArticleLink( @@ -381,10 +381,10 @@ /** * Updates a Flow line in the old changes list (standard RecentChanges). * - * @param ChangesList $changesList - * @param string $s + * @param ChangesList $changesList + * @param string $s * @param RecentChange $rc - * @param array $classes + * @param array $classes * @return bool */ public static function onOldChangesListRecentChangesLine( @@ -402,11 +402,11 @@ * line with meta info (old changes), or simply updates the link to * the topic (enhanced). * - * @param ChangesList $changesList - * @param string $s - * @param RecentChange $rc - * @param array|null $classes - * @param bool $topicOnly + * @param ChangesList $changesList + * @param string $s + * @param RecentChange $rc + * @param array|null $classes + * @param bool $topicOnly * @return bool */ protected static function processRecentChangesLine( @@ -726,7 +726,7 @@ * Adds Flow entries to watchlists * * @param array &$types Type array to modify - * @return boolean true + * @return bool true */ public static function onSpecialWatchlistGetNonRevisionTypes( &$types ) { $types[] = RC_FLOW; @@ -1676,7 +1676,7 @@ Container::get( 'factory.loader.workflow' )->pageMoveInProgress(); // open a database transaction and prepare everything for the move, but // don't commit yet. That is done below in self::onTitleMoveCompleting - $boardMover =Container::get( 'board_mover' ); + $boardMover = Container::get( 'board_mover' ); $boardMover->move( $oldTitle->getArticleID(), $bogusTitle ); } diff --git a/composer.json b/composer.json index d8f2b6a..aa64999 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "symfony/css-selector": "~2.5", "jakub-onderka/php-parallel-lint": "0.9.2", "jakub-onderka/php-console-highlighter": "0.3.2", - "mediawiki/mediawiki-codesniffer": "0.10.1" + "mediawiki/mediawiki-codesniffer": "0.11.0" }, "scripts": { "fix": "phpcbf", diff --git a/includes/Block/Block.php b/includes/Block/Block.php index 184e208..de47e73 100644 --- a/includes/Block/Block.php +++ b/includes/Block/Block.php @@ -314,7 +314,7 @@ * * @param AbstractRevision|null $old null when $new is first revision * @param AbstractRevision $new - * @return boolean True when content is allowed by spam filter + * @return bool True when content is allowed by spam filter */ protected function checkSpamFilters( AbstractRevision $old = null, AbstractRevision $new ) { /** @var SpamFilterController $spamFilter */ diff --git a/includes/Conversion/Utils.php b/includes/Conversion/Utils.php index b805c82..4a7cc0b 100644 --- a/includes/Conversion/Utils.php +++ b/includes/Conversion/Utils.php @@ -212,7 +212,7 @@ /** * Check to see whether a Parsoid or RESTBase service is configured. * - * @return boolean + * @return bool */ public static function isParsoidConfigured() { try { diff --git a/includes/Data/Index/TopKIndex.php b/includes/Data/Index/TopKIndex.php index 21c9ef2..b2e5759 100644 --- a/includes/Data/Index/TopKIndex.php +++ b/includes/Data/Index/TopKIndex.php @@ -162,7 +162,7 @@ * want all rows before/after that timestamp. This consists of values for each field * we sort by, delimited by |. * - * @return integer An integer less than, equal to, or greater than zero + * @return int An integer less than, equal to, or greater than zero * if $row is considered to be respectively less than, equal to, or * greater than $offsetValue * diff --git a/includes/Data/Listener/ReferenceRecorder.php b/includes/Data/Listener/ReferenceRecorder.php index ad1f780..7482696 100644 --- a/includes/Data/Listener/ReferenceRecorder.php +++ b/includes/Data/Listener/ReferenceRecorder.php @@ -254,7 +254,7 @@ * Retrieves references that are already stored in the database for a given revision * * @param string $revType The value returned from Revision::getRevisionType() for the revision. - * @param UUID $objectId The revision's Object ID. + * @param UUID $objectId The revision's Object ID. * @return Reference[] Array of References. */ public function getExistingReferences( $revType, UUID $objectId ) { diff --git a/includes/Data/Listener/TopicPageCreationListener.php b/includes/Data/Listener/TopicPageCreationListener.php index 56bcbe6..ff4e6bb 100644 --- a/includes/Data/Listener/TopicPageCreationListener.php +++ b/includes/Data/Listener/TopicPageCreationListener.php @@ -16,7 +16,7 @@ /** * @param OccupationController $occupationController The OccupationController to create the page with. - * @param SplQueue $deferredQueue Queue of callbacks to run only if commit succeeds + * @param SplQueue $deferredQueue Queue of callbacks to run only if commit succeeds */ public function __construct( OccupationController $occupationController, diff --git a/includes/Data/Pager/Pager.php b/includes/Data/Pager/Pager.php index 72c444e..e1be716 100644 --- a/includes/Data/Pager/Pager.php +++ b/includes/Data/Pager/Pager.php @@ -226,7 +226,7 @@ /** * @param string $direction * @param object $object - * @param integer $pageLimit + * @param int $pageLimit * @return array */ protected function makePagingLink( $direction, $object, $pageLimit ) { diff --git a/includes/Data/Storage/BasicDbStorage.php b/includes/Data/Storage/BasicDbStorage.php index d206f92..fe26a6e 100644 --- a/includes/Data/Storage/BasicDbStorage.php +++ b/includes/Data/Storage/BasicDbStorage.php @@ -46,7 +46,7 @@ /** * Inserts a set of rows into the database * - * @param array $rows The rows to insert. Also accepts a single row. + * @param array $rows The rows to insert. Also accepts a single row. * @return array|false An array of the rows that now exist * in the database. Integrity of keys is guaranteed. * False if we failed. @@ -76,9 +76,9 @@ /** * Update a single row in the database. * - * @param array $old The current state of the row. - * @param array $new The desired new state of the row. - * @return boolean Whether or not the operation was successful. + * @param array $old The current state of the row. + * @param array $new The desired new state of the row. + * @return bool Whether or not the operation was successful. * @throws DataPersistenceException */ public function update( array $old, array $new ) { @@ -107,7 +107,7 @@ /** * @param array $row - * @return boolean success + * @return bool success * @throws DataPersistenceException */ public function remove( array $row ) { diff --git a/includes/Data/Storage/DbStorage.php b/includes/Data/Storage/DbStorage.php index 545b8d5..b483a09 100644 --- a/includes/Data/Storage/DbStorage.php +++ b/includes/Data/Storage/DbStorage.php @@ -49,7 +49,7 @@ /** * Runs preprocessSqlArray on each element of an array. * - * @param array $outer The array to check + * @param array $outer The array to check * @return array Preprocessed SQL array. * @throws DataModelException */ @@ -99,7 +99,7 @@ * potentially unsafe characters. * * @param array $row The row to check. - * @return boolean True if raw SQL is found + * @return bool True if raw SQL is found */ protected function hasUnescapedSQL( array $row ) { foreach ( $row as $key => $value ) { @@ -134,7 +134,7 @@ * SQL injection and other funkiness * @todo Currently only supports LIMIT, OFFSET and ORDER BY * @param array $options An options array passed to a query. - * @return boolean + * @return bool */ protected function validateOptions( $options ) { static $validUnaryOptions = [ diff --git a/includes/Data/Utils/UserMerger.php b/includes/Data/Utils/UserMerger.php index 99849b6..b4ee0ec 100644 --- a/includes/Data/Utils/UserMerger.php +++ b/includes/Data/Utils/UserMerger.php @@ -78,8 +78,8 @@ * Called after all databases have been updated. Needs to purge any * cache that contained data about $oldUser * - * @param integer $oldUserId - * @param integer $newUserId + * @param int $oldUserId + * @param int $newUserId */ public function finalizeMerge( $oldUserId, $newUserId ) { $dbw = $this->dbFactory->getDb( DB_MASTER ); @@ -98,7 +98,7 @@ /** * @param Iterator $it - * @param integer $oldUserId + * @param int $oldUserId * @param callable $callback Receives a single row, returns domain object or null * @param string $userTupleGetter Method to call on domain object that will return * a UserTuple instance. diff --git a/includes/DbFactory.php b/includes/DbFactory.php index 095fc30..f17c69f 100644 --- a/includes/DbFactory.php +++ b/includes/DbFactory.php @@ -46,7 +46,7 @@ /** * Gets a database connection for the Flow-specific database. * - * @param integer $db index of the connection to get. DB_MASTER|DB_SLAVE. + * @param int $db index of the connection to get. DB_MASTER|DB_SLAVE. * @return \Database */ public function getDB( $db ) { @@ -69,7 +69,7 @@ /** * Gets a database connection for the main wiki database. Mockable version of wfGetDB. * - * @param integer $db index of the connection to get. DB_MASTER|DB_SLAVE. + * @param int $db index of the connection to get. DB_MASTER|DB_SLAVE. * @param string|boolean $wiki The wiki ID, or false for the current wiki * @return \DatabaseBase */ diff --git a/includes/Formatter/AbstractQuery.php b/includes/Formatter/AbstractQuery.php index c11ad25..a13dab8 100644 --- a/includes/Formatter/AbstractQuery.php +++ b/includes/Formatter/AbstractQuery.php @@ -292,7 +292,7 @@ /** * Decides if the given abstract revision needs its prior revision for formatting * @param AbstractRevision $revision - * @return boolean true when the previous revision to this should be loaded + * @return bool true when the previous revision to this should be loaded */ protected function needsPreviousRevision( AbstractRevision $revision ) { // crappy special case needs the previous object so it can show the title @@ -386,7 +386,7 @@ /** * Gets a Workflow object given its ID - * @param UUID $workflowId The Workflow ID to retrieve. + * @param UUID $workflowId The Workflow ID to retrieve. * @return Workflow The Workflow. */ protected function getWorkflowById( UUID $workflowId ) { diff --git a/includes/Formatter/RevisionFormatter.php b/includes/Formatter/RevisionFormatter.php index 774d154..8a90445 100644 --- a/includes/Formatter/RevisionFormatter.php +++ b/includes/Formatter/RevisionFormatter.php @@ -285,7 +285,7 @@ $summary = $this->formatApi( $row->summary, $ctx, $action ); if ( $summary ) { $res['summary'] = [ - 'revision' => $summary, + 'revision' => $summary, ]; } } diff --git a/includes/Import/Importer.php b/includes/Import/Importer.php index 0490bec..da0da21 100644 --- a/includes/Import/Importer.php +++ b/includes/Import/Importer.php @@ -101,8 +101,8 @@ /** * Imports topics from a data source to a given page. * - * @param IImportSource $source - * @param Title $targetPage + * @param IImportSource $source + * @param Title $targetPage * @param User User doing the conversion actions (e.g. initial description, * wikitext archive edit). However, actions will be attributed to the original * user when possible (e.g. the user who did the original LQT reply) @@ -266,7 +266,7 @@ /** * @param object|object[] $object - * @param array $metadata + * @param array $metadata */ public function put( $object, array $metadata ) { $metadata['imported'] = true; @@ -284,7 +284,7 @@ * given in clearManagerGroup. * * @param string $type Class name to retrieve - * @param UUID $id ID of the object to retrieve + * @param UUID $id ID of the object to retrieve * @return Object|false */ public function get( $type, UUID $id ) { @@ -309,7 +309,7 @@ * Gets the top revision of an item by ID * * @param string $type The type of the object to return (e.g. PostRevision). - * @param UUID $id The ID (e.g. post ID, topic ID, etc) + * @param UUID $id The ID (e.g. post ID, topic ID, etc) * @return object|false The top revision of the requested object, or false if not found. */ public function getTopRevision( $type, UUID $id ) { @@ -340,7 +340,7 @@ * Update the id of the workflow to match the provided timestamp * * @param Workflow $workflow - * @param string $timestamp + * @param string $timestamp */ public function setWorkflowTimestamp( Workflow $workflow, $timestamp ) { $uid = $this->getTimestampId( $timestamp ); @@ -370,8 +370,8 @@ /** * Records an association between a created object and its source. * - * @param UUID $objectId UUID representing the object that was created. - * @param IImportObject $object Output from getObjectKey + * @param UUID $objectId UUID representing the object that was created. + * @param IImportObject $object Output from getObjectKey */ public function recordAssociation( UUID $objectId, IImportObject $object ) { $this->sourceStore->setAssociation( $objectId, $object->getObjectKey() ); @@ -634,7 +634,7 @@ /** * @param PageImportState $pageState - * @param IImportHeader $importHeader + * @param IImportHeader $importHeader */ public function importHeader( PageImportState $pageState, IImportHeader $importHeader ) { $pageState->logger->info( 'Importing header' ); @@ -687,7 +687,7 @@ /** * @param TopicImportState $topicState - * @param IImportTopic $importTopic + * @param IImportTopic $importTopic */ public function importTopic( TopicImportState $topicState, IImportTopic $importTopic ) { $summary = $importTopic->getTopicSummary(); @@ -705,7 +705,7 @@ /** * @param PageImportState $state - * @param IImportTopic $importTopic + * @param IImportTopic $importTopic * @return TopicImportState */ protected function getTopicState( PageImportState $state, IImportTopic $importTopic ) { @@ -727,7 +727,7 @@ /** * @param PageImportState $state - * @param IImportTopic $importTopic + * @param IImportTopic $importTopic * @return TopicImportState */ protected function createTopicState( PageImportState $state, IImportTopic $importTopic ) { @@ -781,7 +781,7 @@ /** * @param PageImportState $state - * @param IImportTopic $importTopic + * @param IImportTopic $importTopic * @return TopicImportState|null */ protected function getExistingTopicState( PageImportState $state, IImportTopic $importTopic ) { @@ -799,7 +799,7 @@ /** * @param TopicImportState $state - * @param IImportSummary $importSummary + * @param IImportSummary $importSummary */ public function importSummary( TopicImportState $state, IImportSummary $importSummary ) { $state->parent->logger->info( "Importing summary" ); @@ -845,9 +845,9 @@ /** * @param TopicImportState $state - * @param IImportPost $post - * @param PostRevision $replyTo - * @param string $logPrefix + * @param IImportPost $post + * @param PostRevision $replyTo + * @param string $logPrefix */ public function importPost( TopicImportState $state, @@ -908,11 +908,11 @@ /** * Imports an object with all its revisions * - * @param IRevisionableObject $object Object to import. - * @param callable $importFirstRevision Function which, given the appropriate import revision, creates the Flow revision. - * @param string $editChangeType The Flow change type (from FlowActions.php) for each new operation. - * @param PageImportState $state State of the import operation. - * @param Title $title Title content is rendered against + * @param IRevisionableObject $object Object to import. + * @param callable $importFirstRevision Function which, given the appropriate import revision, creates the Flow revision. + * @param string $editChangeType The Flow change type (from FlowActions.php) for each new operation. + * @param PageImportState $state State of the import operation. + * @param Title $title Title content is rendered against * @return AbstractRevision[] Objects to insert into the database. * @throws ImportException */ diff --git a/includes/Import/LiquidThreadsApi/CachedData.php b/includes/Import/LiquidThreadsApi/CachedData.php index 36a814b..0bbe82e 100644 --- a/includes/Import/LiquidThreadsApi/CachedData.php +++ b/includes/Import/LiquidThreadsApi/CachedData.php @@ -139,8 +139,8 @@ * Retrieve data for threads from the given page starting with the provided * offset. * - * @param string $pageName - * @param integer $startId + * @param string $pageName + * @param int $startId * @return array Associative result array */ public function getFromPage( $pageName, $startId = 0 ) { diff --git a/includes/Import/LiquidThreadsApi/Iterators.php b/includes/Import/LiquidThreadsApi/Iterators.php index 30e7d74..788ab2e 100644 --- a/includes/Import/LiquidThreadsApi/Iterators.php +++ b/includes/Import/LiquidThreadsApi/Iterators.php @@ -44,9 +44,9 @@ protected $maxId; /** - * @param ImportSource $source + * @param ImportSource $source * @param CachedThreadData $threadData - * @param string $pageName + * @param string $pageName */ public function __construct( ImportSource $source, CachedThreadData $threadData, $pageName ) { $this->importSource = $source; @@ -67,7 +67,7 @@ } /** - * @return integer + * @return int */ public function key() { return $this->current; @@ -165,7 +165,7 @@ } /** - * @return integer + * @return int */ public function key() { return $this->replyIndex; diff --git a/includes/Import/LiquidThreadsApi/Objects.php b/includes/Import/LiquidThreadsApi/Objects.php index ba44f13..7d2bd46 100644 --- a/includes/Import/LiquidThreadsApi/Objects.php +++ b/includes/Import/LiquidThreadsApi/Objects.php @@ -29,7 +29,7 @@ /** * @param ImportSource $source - * @param int $pageId ID of the remote page + * @param int $pageId ID of the remote page */ function __construct( $source, $pageId ) { $this->importSource = $source; @@ -73,7 +73,7 @@ /** * @param ImportSource $source - * @param array $apiResponse + * @param array $apiResponse */ public function __construct( ImportSource $source, array $apiResponse ) { parent::__construct( $source, $apiResponse['rootid'] ); @@ -259,7 +259,7 @@ } /** - * @return integer + * @return int */ protected function getSummaryId() { return $this->apiResponse['summaryid']; @@ -295,7 +295,7 @@ protected $source; /** - * @param array $apiResponse + * @param array $apiResponse * @param ImportSource $source * @throws ImportException */ @@ -323,9 +323,9 @@ /** * Creates an ImportRevision based on a MW page revision * - * @param array $apiResponse An element from api.query.revisions + * @param array $apiResponse An element from api.query.revisions * @param IImportObject $parentObject - * @param User $scriptUser Account used when the imported revision is by a suppressed user + * @param User $scriptUser Account used when the imported revision is by a suppressed user */ function __construct( array $apiResponse, IImportObject $parentObject, User $scriptUser ) { $this->apiResponse = $apiResponse; diff --git a/includes/Import/LiquidThreadsApi/Source.php b/includes/Import/LiquidThreadsApi/Source.php index 7728f30..b35eb75 100644 --- a/includes/Import/LiquidThreadsApi/Source.php +++ b/includes/Import/LiquidThreadsApi/Source.php @@ -95,7 +95,7 @@ } /** - * @param integer $id + * @param int $id * @return ImportTopic|null */ public function getTopic( $id ) { @@ -134,7 +134,7 @@ } /** - * @param integer $id + * @param int $id * @return ImportPost */ public function getPost( $id ) { @@ -142,7 +142,7 @@ } /** - * @param integer $id + * @param int $id * @return array */ public function getThreadData( $id ) { @@ -167,7 +167,7 @@ /** * @param string $pageName - * @param integer $startId + * @param int $startId * @return array */ public function getFromPage( $pageName, $startId = 0 ) { @@ -217,7 +217,7 @@ /** * Retrieves LiquidThreads data from the API * - * @param array $conditions The parameters to pass to select the threads. Usually used in two ways: with thstartid/thpage, or with ththreadid + * @param array $conditions The parameters to pass to select the threads. Usually used in two ways: with thstartid/thpage, or with ththreadid * @return array Data as returned under query.threads by the API * @throws ApiNotFoundException Thrown when the remote api reports that the provided conditions * have no matching records. @@ -257,7 +257,7 @@ /** * Retrieves data about a set of pages from the API * - * @param array $pageIds Page IDs to return data for. + * @param array $pageIds Page IDs to return data for. * @return array The query.pages part of the API response. * @throws \MWException */ @@ -295,8 +295,8 @@ /** * Retrieves data about a set of pages from the API * - * @param array $conditions Conditions to retrieve pages by; to be sent to the API. - * @param bool $expectContinue Pass true here when caller expects more revisions to exist than + * @param array $conditions Conditions to retrieve pages by; to be sent to the API. + * @param bool $expectContinue Pass true here when caller expects more revisions to exist than they are requesting information about. * they are requesting information about. * @return array The query.pages part of the API response. * @throws ApiNotFoundException Thrown when the remote api reports that the provided conditions @@ -338,7 +338,7 @@ * Calls the remote API * * @param array $params The API request to send - * @param int $retry Retry the request on failure this many times + * @param int $retry Retry the request on failure this many times * @return array API return value, decoded from JSON into an array. */ abstract function apiCall( array $params, $retry = 1 ); diff --git a/includes/Model/AbstractRevision.php b/includes/Model/AbstractRevision.php index 8a44ad2..555d7f4 100644 --- a/includes/Model/AbstractRevision.php +++ b/includes/Model/AbstractRevision.php @@ -321,7 +321,7 @@ /** * @param string $state - * @return boolean + * @return bool */ public function isValidModerationState( $state ) { return in_array( $state, self::$perms ); @@ -335,7 +335,7 @@ } /** - * @return boolean + * @return bool */ public function hasHiddenContent() { return $this->moderationState === self::MODERATED_HIDDEN; @@ -449,7 +449,7 @@ } /** - * @return integer + * @return int */ public function getUserId() { return $this->user->id; @@ -610,35 +610,35 @@ } /** - * @return boolean + * @return bool */ public function isModerated() { return $this->moderationState !== self::MODERATED_NONE; } /** - * @return boolean + * @return bool */ public function isHidden() { return $this->moderationState === self::MODERATED_HIDDEN; } /** - * @return boolean + * @return bool */ public function isDeleted() { return $this->moderationState === self::MODERATED_DELETED; } /** - * @return boolean + * @return bool */ public function isSuppressed() { return $this->moderationState === self::MODERATED_SUPPRESSED; } /** - * @return boolean + * @return bool */ public function isLocked() { return $this->moderationState === self::MODERATED_LOCKED; @@ -653,7 +653,7 @@ /** * @param string|array $flags - * @return boolean True when at least one flag in $flags is set + * @return bool True when at least one flag in $flags is set */ public function isFlaggedAny( $flags ) { foreach ( (array)$flags as $flag ) { @@ -666,7 +666,7 @@ /** * @param string|array $flags - * @return boolean + * @return bool */ public function isFlaggedAll( $flags ) { foreach ( (array)$flags as $flag ) { @@ -678,14 +678,14 @@ } /** - * @return boolean + * @return bool */ public function isFirstRevision() { return $this->prevRevision === null; } /** - * @return boolean + * @return bool */ public function isOriginalContent() { return $this->lastEditId === null; @@ -706,7 +706,7 @@ } /** - * @return integer + * @return int */ public function getLastContentEditUserId() { return $this->lastEditUser ? $this->lastEditUser->id : null; @@ -776,7 +776,7 @@ } /** - * @return integer + * @return int */ public function getContentLength() { return $this->contentLength; @@ -786,14 +786,14 @@ /** * Determines the content length by measuring the actual content. * - * @return integer + * @return int */ public function calculateContentLength() { return mb_strlen( $this->getContentInWikitext() ); } /** - * @return integer + * @return int */ public function getPreviousContentLength() { return $this->previousContentLength; @@ -871,7 +871,7 @@ /** * Get the user ID of the user who created this summary. * - * @return integer The user ID + * @return int The user ID */ public function getCreatorId() { return $this->getCreatorTuple()->id; diff --git a/includes/Model/PostRevision.php b/includes/Model/PostRevision.php index 39bb2e4..774443e 100644 --- a/includes/Model/PostRevision.php +++ b/includes/Model/PostRevision.php @@ -201,7 +201,7 @@ } /** - * @return boolean + * @return bool */ public function isTopicTitle() { return $this->replyToId === null; @@ -293,14 +293,14 @@ } /** - * @param integer $depth + * @param int $depth */ public function setDepth( $depth ) { $this->depth = (int)$depth; } /** - * @return integer + * @return int * @throws DataModelException */ public function getDepth() { @@ -386,7 +386,7 @@ /** * @param User $user - * @return boolean + * @return bool */ public function isCreator( User $user ) { if ( $user->isAnon() ) { diff --git a/includes/Model/Reference.php b/includes/Model/Reference.php index d7b42ba..f3f330c 100644 --- a/includes/Model/Reference.php +++ b/includes/Model/Reference.php @@ -48,13 +48,13 @@ /** * Standard constructor. Called from subclasses only * - * @param UUID $id Id of the reference - * @param string $wiki Wiki ID of the reference source - * @param UUID $srcWorkflow Source Workflow's ID - * @param Title $srcTitle Title of the Workflow from which this reference comes. - * @param string $objectType Output of getRevisionType for the AbstractRevision that this reference comes from. - * @param UUID $objectId Unique identifier for the revisioned object containing the reference. - * @param string $type The type of reference + * @param UUID $id Id of the reference + * @param string $wiki Wiki ID of the reference source + * @param UUID $srcWorkflow Source Workflow's ID + * @param Title $srcTitle Title of the Workflow from which this reference comes. + * @param string $objectType Output of getRevisionType for the AbstractRevision that this reference comes from. + * @param UUID $objectId Unique identifier for the revisioned object containing the reference. + * @param string $type The type of reference * @throws InvalidParameterException */ protected function __construct( UUID $id, $wiki, UUID $srcWorkflow, Title $srcTitle, $objectType, UUID $objectId, $type ) { diff --git a/includes/Model/URLReference.php b/includes/Model/URLReference.php index ba35cf3..73bcdad 100644 --- a/includes/Model/URLReference.php +++ b/includes/Model/URLReference.php @@ -9,14 +9,14 @@ protected $url; /** - * @param UUID $id Id of the reference - * @param string $wiki Wiki ID of the reference source - * @param UUID $srcWorkflow ID of the source Workflow - * @param Title $srcTitle Title of the page that the Workflow exists on - * @param string $objectType Output of getRevisionType for the AbstractRevision that this reference comes from. - * @param UUID $objectId Unique identifier for the revisioned object containing the reference. - * @param string $type Type of reference - * @param string $url URL of the reference's target. + * @param UUID $id Id of the reference + * @param string $wiki Wiki ID of the reference source + * @param UUID $srcWorkflow ID of the source Workflow + * @param Title $srcTitle Title of the page that the Workflow exists on + * @param string $objectType Output of getRevisionType for the AbstractRevision that this reference comes from. + * @param UUID $objectId Unique identifier for the revisioned object containing the reference. + * @param string $type Type of reference + * @param string $url URL of the reference's target. * @throws InvalidReferenceException */ public function __construct( UUID $id, $wiki, UUID $srcWorkflow, Title $srcTitle, $objectType, UUID $objectId, $type, $url ) { diff --git a/includes/Model/UUID.php b/includes/Model/UUID.php index f4bef47..d36837d 100644 --- a/includes/Model/UUID.php +++ b/includes/Model/UUID.php @@ -377,7 +377,7 @@ /** * @param UUID|null $other - * @return boolean + * @return bool */ public function equals( UUID $other = null ) { return $other && $other->getAlphadecimal() === $this->getAlphadecimal(); @@ -449,7 +449,7 @@ * been generated with \UIDGenerator::newTimestampedUID88. * * @param string $hex - * @return integer Number of seconds since epoch + * @return int Number of seconds since epoch */ public static function hex2timestamp( $hex ) { $msTimestamp = hexdec( substr( $hex, 0, 12 ) ) >> 2; diff --git a/includes/Model/WikiReference.php b/includes/Model/WikiReference.php index 39b8db8..88fc79b 100644 --- a/includes/Model/WikiReference.php +++ b/includes/Model/WikiReference.php @@ -13,14 +13,14 @@ protected $target; /** - * @param UUID $id Id of the reference - * @param string $wiki Wiki ID of the reference source - * @param UUID $srcWorkflow ID of the source Workflow - * @param Title $srcTitle Title of the Workflow from which this reference comes. - * @param string $objectType Output of getRevisionType for the AbstractRevision that this reference comes from. - * @param UUID $objectId Unique identifier for the revisioned object containing the reference. - * @param string $type Type of reference - * @param Title $targetTitle Title of the reference's target. + * @param UUID $id Id of the reference + * @param string $wiki Wiki ID of the reference source + * @param UUID $srcWorkflow ID of the source Workflow + * @param Title $srcTitle Title of the Workflow from which this reference comes. + * @param string $objectType Output of getRevisionType for the AbstractRevision that this reference comes from. + * @param UUID $objectId Unique identifier for the revisioned object containing the reference. + * @param string $type Type of reference + * @param Title $targetTitle Title of the reference's target. */ public function __construct( UUID $id, $wiki, UUID $srcWorkflow, Title $srcTitle, $objectType, UUID $objectId, $type, Title $targetTitle ) { $this->target = $targetTitle; diff --git a/includes/Model/Workflow.php b/includes/Model/Workflow.php index 6ff1aa2..374d0cf 100644 --- a/includes/Model/Workflow.php +++ b/includes/Model/Workflow.php @@ -294,7 +294,7 @@ /** * Returns true if the workflow is new as of this request. * - * @return boolean + * @return bool */ public function isNew() { return $this->pageId === 0; @@ -344,7 +344,7 @@ * it should return false later on to allow wider use. * * @param Title $title - * @return boolean + * @return bool * @throws InvalidInputException * @throws InvalidInputException */ diff --git a/includes/Notifications/Controller.php b/includes/Notifications/Controller.php index b7ccef5..10fdd23 100644 --- a/includes/Notifications/Controller.php +++ b/includes/Notifications/Controller.php @@ -65,7 +65,7 @@ /** * Causes notifications to be fired for a Header-related event. - * @param array $data Associative array of parameters. + * @param array $data Associative array of parameters. * revision: The PostRevision created by the action. Always required. * board-workflow: The Workflow object for the board. Always required. * timestamp: Original event timestamp, for imports. Optional. * extra-data: Additional data to pass along to Event extra. * * revision: The PostRevision created by the action. Always required. * * board-workflow: The Workflow object for the board. Always required. * * timestamp: Original event timestamp, for imports. Optional. @@ -140,7 +140,7 @@ * * flow-post-reply * * flow-topic-renamed * * flow-post-edited - * @param array $data Associative array of parameters. + * @param array $data Associative array of parameters. * user: The user who made the change. Always required. * revision: The PostRevision created by the action. Always required. * title: The Title on which this Topic sits. Always required. * topic-workflow: The Workflow object for the topic. Always required. * topic-title: The Title of the Topic that the post belongs to. Required except for topic renames. * old-subject: The old subject of a Topic. Required for topic renames. * new-subject: The new subject of a Topic. Required for topic renames. * * user: The user who made the change. Always required. * * revision: The PostRevision created by the action. Always required. * * title: The Title on which this Topic sits. Always required. @@ -268,7 +268,7 @@ /** * Causes notifications to be fired for a Summary-related event. - * @param array $data Associative array of parameters. + * @param array $data Associative array of parameters. * revision: The PostRevision created by the action. Always required. * topic-title: The PostRevision object for the topic title. Always required. * topic-workflow: The Workflow object for the board. Always required. * extra-data: Additional data to pass along to Event extra. * * revision: The PostRevision created by the action. Always required. * * topic-title: The PostRevision object for the topic title. Always required. * * topic-workflow: The Workflow object for the board. Always required. @@ -669,7 +669,7 @@ * * @param $event EchoEvent * @param $bundleString string Determines how the notification should be bundled - * @return boolean True for success + * @return bool True for success */ public static function onEchoGetBundleRules( $event, &$bundleString ) { switch ( $event->getType() ) { diff --git a/includes/Repository/RootPostLoader.php b/includes/Repository/RootPostLoader.php index b9d8346..cfaf111 100644 --- a/includes/Repository/RootPostLoader.php +++ b/includes/Repository/RootPostLoader.php @@ -98,7 +98,7 @@ return []; } // load posts for all located post ids - $allPostIds = $this->fetchRelatedPostIds( $topicIds ); + $allPostIds = $this->fetchRelatedPostIds( $topicIds ); $queries = []; foreach ( $allPostIds as $postId ) { $queries[] = [ 'rev_type_id' => $postId ]; diff --git a/includes/Repository/TreeRepository.php b/includes/Repository/TreeRepository.php index 8f738c7..9b6552b 100644 --- a/includes/Repository/TreeRepository.php +++ b/includes/Repository/TreeRepository.php @@ -282,7 +282,7 @@ /** * Finds the root path for a single post ID. - * @param UUID $descendant Post ID + * @param UUID $descendant Post ID * @return UUID[]|null Path to the root of that node. */ public function findRootPath( UUID $descendant ) { @@ -293,7 +293,7 @@ /** * Finds the root posts of a list of posts. - * @param UUID[] $descendants Array of PostRevision objects to find roots for. + * @param UUID[] $descendants Array of PostRevision objects to find roots for. * @return UUID[] Associative array of post ID (as hex) to UUID object representing its root. */ public function findRoots( array $descendants ) { diff --git a/includes/Repository/UserNameBatch.php b/includes/Repository/UserNameBatch.php index 08195c5..85f1666 100644 --- a/includes/Repository/UserNameBatch.php +++ b/includes/Repository/UserNameBatch.php @@ -61,7 +61,7 @@ /** * @param string $wiki - * @param integer $userId + * @param int $userId * @param string $userName Non null to set known usernames like $wgUser */ public function add( $wiki, $userId, $userName = null ) { @@ -86,7 +86,7 @@ * Get the displayable username * * @param string $wiki - * @param integer $userId + * @param int $userId * @param string|boolean $userIp * @return string|boolean false if username is not found or display is suppressed * @todo Return something better for not found / suppressed, but what? Making diff --git a/includes/Search/Iterators/AbstractIterator.php b/includes/Search/Iterators/AbstractIterator.php index 94fad0d..4fb1fc5 100644 --- a/includes/Search/Iterators/AbstractIterator.php +++ b/includes/Search/Iterators/AbstractIterator.php @@ -118,7 +118,7 @@ } /** - * @return integer 0-indexed count of the page number fetched + * @return int 0-indexed count of the page number fetched */ public function key() { return $this->key; diff --git a/includes/TemplateHelper.php b/includes/TemplateHelper.php index 287dd7c..d13baa0 100644 --- a/includes/TemplateHelper.php +++ b/includes/TemplateHelper.php @@ -32,7 +32,7 @@ /** * @param string $templateDir - * @param boolean $forceRecompile + * @param bool $forceRecompile */ public function __construct( $templateDir, $forceRecompile = false ) { $this->templateDir = $templateDir; @@ -231,7 +231,7 @@ } /** - * @param integer $timestamp milliseconds since the unix epoch + * @param int $timestamp milliseconds since the unix epoch * * @return string|false */ diff --git a/includes/Templating.php b/includes/Templating.php index a0f79d1..3c8eefb 100644 --- a/includes/Templating.php +++ b/includes/Templating.php @@ -83,7 +83,7 @@ * * Moderation-aware. * - * @param AbstractRevision $revision Revision to display + * @param AbstractRevision $revision Revision to display * @return string HTML * @throws PermissionException */ diff --git a/includes/WorkflowLoaderFactory.php b/includes/WorkflowLoaderFactory.php index 5350e2f..47ea19c 100644 --- a/includes/WorkflowLoaderFactory.php +++ b/includes/WorkflowLoaderFactory.php @@ -143,7 +143,7 @@ /** * Create a UUID for a ns/dbkey title pair * - * @param integer $ns + * @param int $ns * @param string $dbKey * @return UUID * @throws InvalidInputException When the pair does not represent a valid uuid diff --git a/phpcs.xml b/phpcs.xml index 1d8dc7a..6383750 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,12 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <ruleset> <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> - <exclude name="Generic.Files.LineLength.TooLong"/> + <exclude name="Generic.Files.LineLength.TooLong" /> + <exclude name="MediaWiki.Commenting.FunctionComment.ExtraParamComment" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamComment" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamName" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingReturn" /> + <exclude name="MediaWiki.Commenting.FunctionComment.ParamNameNoCaseMatch" /> + <exclude name="MediaWiki.Commenting.FunctionComment.ParamNameNoMatch" /> + <exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle" /> + <exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures" /> <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment"/> - <exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures"/> <exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound"/> <exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage"/> - <exclude name="MediaWiki.Commenting.FunctionComment"/> </rule> <rule ref="MediaWiki.NamingConventions.PrefixedGlobalFunctions"> <properties> -- To view, visit https://gerrit.wikimedia.org/r/371295 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I09fc9032ab2560826fddfad87f76938ae7be19fe Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits