diff --git a/composer.json b/composer.json index 49c2a1c38..55507beec 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,13 @@ { "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "mediawiki/mediawiki-codesniffer": "0.10.0", + "mediawiki/mediawiki-codesniffer": "0.10.1", "jakub-onderka/php-console-highlighter": "0.3.2" }, "scripts": { "test": [ "parallel-lint . --exclude vendor", - "phpcs -p" + "phpcs -p -s" ], "fix": [ "phpcbf" diff --git a/includes/AttributeManager.php b/includes/AttributeManager.php index 8d30bdae2..7c9fb4c21 100644 --- a/includes/AttributeManager.php +++ b/includes/AttributeManager.php @@ -227,7 +227,7 @@ class EchoAttributeManager { * * @param User * @param string A notification category defined in $wgEchoNotificationCategories - * @return boolean + * @return bool */ public function getCategoryEligibility( $user, $category ) { $usersGroups = $user->getGroups(); @@ -245,7 +245,7 @@ class EchoAttributeManager { * Get the priority for a specific notification type * * @param string A notification type defined in $wgEchoNotifications - * @return integer From 1 to 10 (10 is default) + * @return int From 1 to 10 (10 is default) */ public function getNotificationPriority( $notificationType ) { $category = $this->getNotificationCategory( $notificationType ); @@ -257,7 +257,7 @@ class EchoAttributeManager { * Get the priority for a notification category * * @param string A notification category defined in $wgEchoNotificationCategories - * @return integer From 1 to 10 (10 is default) + * @return int From 1 to 10 (10 is default) */ public function getCategoryPriority( $category ) { if ( isset( $this->categories[$category]['priority'] ) ) { diff --git a/includes/ContainmentSet.php b/includes/ContainmentSet.php index 6bde0883e..70f2ef0d0 100644 --- a/includes/ContainmentSet.php +++ b/includes/ContainmentSet.php @@ -107,7 +107,7 @@ class EchoContainmentSet { * Test the wrapped lists for existence of $value * * @param $value mixed The value to look for - * @return boolean True when the set contains the provided value + * @return bool True when the set contains the provided value */ public function contains( $value ) { foreach ( $this->lists as $list ) { diff --git a/includes/NotifUser.php b/includes/NotifUser.php index 751263fdb..72a13e5f9 100644 --- a/includes/NotifUser.php +++ b/includes/NotifUser.php @@ -232,7 +232,7 @@ class MWEchoNotifUser { $eventTypesToLoad = $attributeManager->getUserEnabledEventsbySections( $this->mUser, 'web', [ $section ] ); } - $count = (int)$this->userNotifGateway->getCappedNotificationCount( $dbSource, $eventTypesToLoad, MWEchoNotifUser::MAX_BADGE_COUNT + 1 ); + $count = (int)$this->userNotifGateway->getCappedNotificationCount( $dbSource, $eventTypesToLoad, self::MAX_BADGE_COUNT + 1 ); if ( $global ) { $count = self::capNotificationCount( $count + $this->getForeignCount( $section ) ); @@ -349,7 +349,7 @@ class MWEchoNotifUser { /** * Mark one or more notifications read for a user. * @param $eventIds Array of event IDs to mark read - * @return boolean + * @return bool */ public function markRead( $eventIds ) { $eventIds = array_filter( (array)$eventIds, 'is_numeric' ); @@ -381,7 +381,7 @@ class MWEchoNotifUser { /** * Mark one or more notifications unread for a user. * @param $eventIds Array of event IDs to mark unread - * @return boolean + * @return bool */ public function markUnRead( $eventIds ) { $eventIds = array_filter( (array)$eventIds, 'is_numeric' ); @@ -418,7 +418,7 @@ class MWEchoNotifUser { * across multiple tables, we would visit this later * * @param string[] $sections - * @return boolean + * @return bool */ public function markAllRead( array $sections = [ EchoAttributeManager::ALL ] ) { if ( wfReadOnly() ) { @@ -789,6 +789,6 @@ class MWEchoNotifUser { * @return int Capped notification count */ public static function capNotificationCount( $number ) { - return min( $number, MWEchoNotifUser::MAX_BADGE_COUNT + 1 ); + return min( $number, self::MAX_BADGE_COUNT + 1 ); } } diff --git a/includes/controller/NotificationController.php b/includes/controller/NotificationController.php index 1706bcbc0..3e95d9d77 100644 --- a/includes/controller/NotificationController.php +++ b/includes/controller/NotificationController.php @@ -209,7 +209,7 @@ class EchoNotificationController { * * @param EchoEvent $event The event to test for exclusion * @param User $user recipient of the notification for per-user blacklists - * @return boolean True when the event agent is blacklisted + * @return bool True when the event agent is blacklisted */ public static function isBlacklistedByUser( EchoEvent $event, User $user ) { global $wgEchoAgentBlacklist, $wgEchoPerUserBlacklist; @@ -277,7 +277,7 @@ class EchoNotificationController { * * @param EchoEvent $event The event to test for inclusion in whitelist * @param User $user The user that owns the whitelist - * @return boolean True when the event agent is in the user whitelist + * @return bool True when the event agent is in the user whitelist */ public static function isWhitelistedByUser( EchoEvent $event, User $user ) { $clusterCache = ObjectCache::getLocalClusterInstance(); diff --git a/includes/formatters/PresentationModelSectionTrait.php b/includes/formatters/PresentationModelSectionTrait.php index bce88236a..7d0e6b9fe 100644 --- a/includes/formatters/PresentationModelSectionTrait.php +++ b/includes/formatters/PresentationModelSectionTrait.php @@ -57,7 +57,7 @@ trait EchoPresentationModelSectionTrait { * This also returns false if the revision is deleted, * even if there is a section, because the section can't * be viewed in that case. - * @return boolean Whether there is a section + * @return bool Whether there is a section */ protected function hasSection() { return (bool)$this->getRawSectionTitle(); diff --git a/includes/gateway/UserNotificationGateway.php b/includes/gateway/UserNotificationGateway.php index e47e3b207..28261a7c6 100644 --- a/includes/gateway/UserNotificationGateway.php +++ b/includes/gateway/UserNotificationGateway.php @@ -35,7 +35,7 @@ class EchoUserNotificationGateway { /** * Mark notifications as read * @param $eventIDs array - * @return boolean + * @return bool */ public function markRead( array $eventIDs ) { if ( !$eventIDs ) { @@ -59,7 +59,7 @@ class EchoUserNotificationGateway { /** * Mark notifications as unread * @param $eventIDs array - * @return boolean + * @return bool */ public function markUnRead( array $eventIDs ) { if ( !$eventIDs ) { diff --git a/includes/mapper/NotificationMapper.php b/includes/mapper/NotificationMapper.php index 13f1295c3..6ec00a9a0 100644 --- a/includes/mapper/NotificationMapper.php +++ b/includes/mapper/NotificationMapper.php @@ -347,7 +347,7 @@ class EchoNotificationMapper extends EchoAbstractMapper { * Batch delete notifications by user and eventId offset * @param User $user * @param int $eventId - * @return boolean + * @return bool */ public function deleteByUserEventOffset( User $user, $eventId ) { $dbw = $this->dbFactory->getEchoDb( DB_MASTER ); diff --git a/includes/mapper/TargetPageMapper.php b/includes/mapper/TargetPageMapper.php index b0160d037..33dd7bc5b 100644 --- a/includes/mapper/TargetPageMapper.php +++ b/includes/mapper/TargetPageMapper.php @@ -18,7 +18,7 @@ class EchoTargetPageMapper extends EchoAbstractMapper { * Insert an EchoTargetPage instance into the database * * @param EchoTargetPage $targetPage - * @return boolean + * @return bool */ public function insert( EchoTargetPage $targetPage ) { $dbw = $this->dbFactory->getEchoDb( DB_MASTER ); diff --git a/includes/model/Event.php b/includes/model/Event.php index 06ebf054f..be8b092bc 100644 --- a/includes/model/Event.php +++ b/includes/model/Event.php @@ -575,7 +575,7 @@ class EchoEvent extends EchoAbstractEntity implements Bundleable { /** * Determine whether an event can use the job queue, or should be immediate - * @return boolean + * @return bool */ public function getUseJobQueue() { global $wgEchoNotifications; diff --git a/phpcs.xml b/phpcs.xml index 4b5d28ce0..fa1967a39 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -14,8 +14,7 @@ - + - vendor