jenkins-bot has submitted this change and it was merged.

Change subject: Enable disabled SpaceAfterKeyword PHPCS sniff
......................................................................


Enable disabled SpaceAfterKeyword PHPCS sniff

This was temporary disabled because we had about 100 of these errors
in our code base. Thanks to Ricordisamoa (see Ibd60c63) and others
almost all these errors are now gone. Time to enable the sniff.

I also did a fulltext search for "};" because I saw this mistake while
working on the spacing sniff. I do not think there is a sniff for that.

Change-Id: Ibfddeb7383f055f356e3d9e7ee34341af7d8fe51
---
M client/includes/Changes/ChangeRunCoalescer.php
M client/includes/Usage/PageEntityUsages.php
M client/includes/store/sql/BulkSubscriptionUpdater.php
M lib/includes/TermIndexEntry.php
M lib/includes/parsers/YearMonthTimeParser.php
M lib/includes/serialization/CallbackFactory.php
M lib/tests/phpunit/parsers/MediaWikiNumberUnlocalizerTest.php
M phpcs.xml
M repo/includes/IO/EntityIdReader.php
M repo/includes/Interactors/TermIndexSearchInteractor.php
M repo/includes/api/SearchEntities.php
M repo/includes/api/SetReference.php
M repo/includes/specials/SpecialModifyTerm.php
M repo/includes/store/sql/ChangesSubscriptionTableBuilder.php
M repo/includes/store/sql/ItemsPerSiteBuilder.php
15 files changed, 27 insertions(+), 24 deletions(-)

Approvals:
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/client/includes/Changes/ChangeRunCoalescer.php 
b/client/includes/Changes/ChangeRunCoalescer.php
index 840148a..8183f5d 100644
--- a/client/includes/Changes/ChangeRunCoalescer.php
+++ b/client/includes/Changes/ChangeRunCoalescer.php
@@ -235,7 +235,7 @@
                                        if ( isset( $siteLinkDiff[ 
$this->localSiteId ] ) ) {
                                                $break = true;
                                                $breakNext = true;
-                                       };
+                                       }
                                }
 
                                // FIXME: We should call changeNeedsRendering() 
and see if the needs-rendering
diff --git a/client/includes/Usage/PageEntityUsages.php 
b/client/includes/Usage/PageEntityUsages.php
index 4f1b276..b6f7f5b 100644
--- a/client/includes/Usage/PageEntityUsages.php
+++ b/client/includes/Usage/PageEntityUsages.php
@@ -127,7 +127,7 @@
        public function equals( PageEntityUsages $other ) {
                if ( !$other->getPageId() === $this->getPageId() ) {
                        return false;
-               } elseif( array_keys( $other->getUsages() ) != array_keys( 
$this->getUsages() ) ) {
+               } elseif ( array_keys( $other->getUsages() ) != array_keys( 
$this->getUsages() ) ) {
                        return false;
                }
 
diff --git a/client/includes/store/sql/BulkSubscriptionUpdater.php 
b/client/includes/store/sql/BulkSubscriptionUpdater.php
index d756a42..22e1c6c 100644
--- a/client/includes/store/sql/BulkSubscriptionUpdater.php
+++ b/client/includes/store/sql/BulkSubscriptionUpdater.php
@@ -151,7 +151,7 @@
                        } else {
                                break;
                        }
-               };
+               }
        }
 
        /**
@@ -292,7 +292,7 @@
                        } else {
                                break;
                        }
-               };
+               }
        }
 
        /**
diff --git a/lib/includes/TermIndexEntry.php b/lib/includes/TermIndexEntry.php
index cbcce48..a3a1cf5 100644
--- a/lib/includes/TermIndexEntry.php
+++ b/lib/includes/TermIndexEntry.php
@@ -259,7 +259,7 @@
         * @throws MWException
         */
        public function getTerm() {
-               try{
+               try {
                        return new Term( $this->getLanguage(), $this->getText() 
);
                } catch ( InvalidArgumentException $e ) {
                        throw new MWException( 'Can not construct Term from 
partial TermIndexEntry' );
diff --git a/lib/includes/parsers/YearMonthTimeParser.php 
b/lib/includes/parsers/YearMonthTimeParser.php
index bced388..519cd80 100644
--- a/lib/includes/parsers/YearMonthTimeParser.php
+++ b/lib/includes/parsers/YearMonthTimeParser.php
@@ -106,7 +106,7 @@
 
                if ( !$this->canBeMonth( $a ) && $this->canBeMonth( $b ) ) {
                        return $this->getTimeFromYearMonth( $a, $b );
-               } elseif( $this->canBeMonth( $a ) ) {
+               } elseif ( $this->canBeMonth( $a ) ) {
                        return $this->getTimeFromYearMonth( $b, $a );
                }
 
diff --git a/lib/includes/serialization/CallbackFactory.php 
b/lib/includes/serialization/CallbackFactory.php
index 5dafeb5..10c591a 100644
--- a/lib/includes/serialization/CallbackFactory.php
+++ b/lib/includes/serialization/CallbackFactory.php
@@ -53,7 +53,7 @@
        ) {
                return function ( $array ) use ( $dataTypeLookup ) {
                        foreach ( $array as $propertyIdGroupKey => &$snakGroup 
) {
-                               try{
+                               try {
                                        $dataType = 
$dataTypeLookup->getDataTypeIdForProperty( new PropertyId( $propertyIdGroupKey 
) );
                                        foreach ( $snakGroup as &$snak ) {
                                                $snak['datatype'] = $dataType;
@@ -68,7 +68,7 @@
 
        public function getCallbackToAddDataTypeToSnak( PropertyDataTypeLookup 
$dataTypeLookup ) {
                return function ( $array ) use ( $dataTypeLookup ) {
-                       try{
+                       try {
                                $dataType = 
$dataTypeLookup->getDataTypeIdForProperty( new PropertyId( $array['property'] ) 
);
                                $array['datatype'] = $dataType;
                        } catch ( PropertyNotFoundException $e ) {
diff --git a/lib/tests/phpunit/parsers/MediaWikiNumberUnlocalizerTest.php 
b/lib/tests/phpunit/parsers/MediaWikiNumberUnlocalizerTest.php
index fd46b1a..96d330d 100644
--- a/lib/tests/phpunit/parsers/MediaWikiNumberUnlocalizerTest.php
+++ b/lib/tests/phpunit/parsers/MediaWikiNumberUnlocalizerTest.php
@@ -67,7 +67,7 @@
                        foreach ( $numbers as $num ) {
                                $cases[] = array( $num, $lang );
                        }
-               };
+               }
 
                return $cases;
        }
diff --git a/phpcs.xml b/phpcs.xml
index 9c0017b..0552968 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -74,10 +74,6 @@
                
<exclude-pattern>DataAccess*Scribunto*Scribunto_LuaWikibase*Library</exclude-pattern>
        </rule>
        <rule ref="Squiz.ControlStructures.ControlSignature" />
-       <!-- FIXME: This indicates an error in the Wikibase codebase that 
should be fixed. -->
-       <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword">
-               <severity>0</severity>
-       </rule>
        <rule ref="Squiz.Scope.MethodScope">
                <!-- FIXME: This indicates an error in the QueryPage base class 
that should be fixed. -->
                <exclude-pattern>SpecialUnconnectedPages\.php</exclude-pattern>
diff --git a/repo/includes/IO/EntityIdReader.php 
b/repo/includes/IO/EntityIdReader.php
index e04cbff..d46f098 100644
--- a/repo/includes/IO/EntityIdReader.php
+++ b/repo/includes/IO/EntityIdReader.php
@@ -115,7 +115,7 @@
                                $id = null;
                                continue;
                        }
-               };
+               }
 
                return $id;
        }
diff --git a/repo/includes/Interactors/TermIndexSearchInteractor.php 
b/repo/includes/Interactors/TermIndexSearchInteractor.php
index c73d230..ef9890a 100644
--- a/repo/includes/Interactors/TermIndexSearchInteractor.php
+++ b/repo/includes/Interactors/TermIndexSearchInteractor.php
@@ -320,7 +320,7 @@
         * @return null|Term
         */
        private function getLabelDisplayTerm( EntityId $entityId ) {
-               try{
+               try {
                        return $this->labelDescriptionLookup->getLabel( 
$entityId );
                } catch ( OutOfBoundsException $e ) {
                        return null;
@@ -333,7 +333,7 @@
         * @return null|Term
         */
        private function getDescriptionDisplayTerm( EntityId $entityId ) {
-               try{
+               try {
                        return $this->labelDescriptionLookup->getDescription( 
$entityId );
                } catch ( OutOfBoundsException $e ) {
                        return null;
diff --git a/repo/includes/api/SearchEntities.php 
b/repo/includes/api/SearchEntities.php
index 3b3f76a..da6745f 100644
--- a/repo/includes/api/SearchEntities.php
+++ b/repo/includes/api/SearchEntities.php
@@ -301,17 +301,21 @@
         */
        private function mergeSearchResults( $searchResults, $newSearchResults, 
$limit ) {
                $searchResultEntityIdSerializations = array_keys( 
$searchResults );
+
                foreach ( $newSearchResults as $searchResultToAdd ) {
                        $entityIdString = 
$searchResultToAdd->getEntityId()->getSerialization();
+
                        if ( !in_array( $entityIdString, 
$searchResultEntityIdSerializations ) ) {
                                $searchResults[$entityIdString] = 
$searchResultToAdd;
                                $searchResultEntityIdSerializations[] = 
$entityIdString;
                                $missing = $limit - count( $searchResults );
+
                                if ( $missing <= 0 ) {
                                        return $searchResults;
                                }
                        }
                }
+
                return $searchResults;
        }
 
@@ -322,16 +326,19 @@
         */
        private function getDisplayTerms( EntityId $entityId ) {
                $displayTerms = array();
-               try{
+
+               try {
                        $displayTerms['label'] = 
$this->labelDescriptionLookup->getLabel( $entityId );
                } catch ( OutOfBoundsException $e ) {
                        $displayTerms['label'] = null;
-               };
-               try{
+               }
+
+               try {
                        $displayTerms['description'] = 
$this->labelDescriptionLookup->getDescription( $entityId );
                } catch ( OutOfBoundsException $e ) {
                        $displayTerms['description'] = null;
-               };
+               }
+
                return $displayTerms;
        }
 
diff --git a/repo/includes/api/SetReference.php 
b/repo/includes/api/SetReference.php
index 7214009..376d003 100644
--- a/repo/includes/api/SetReference.php
+++ b/repo/includes/api/SetReference.php
@@ -91,7 +91,7 @@
 
                $deserializer = 
$this->deserializerFactory->newSnakListDeserializer();
                /** @var SnakList $snakList */
-               try{
+               try {
                        $snakList = $deserializer->deserialize( 
$this->getArrayFromParam( $params['snaks'] ) );
                } catch ( DeserializationException $e ) {
                        $this->errorReporter->dieError(
diff --git a/repo/includes/specials/SpecialModifyTerm.php 
b/repo/includes/specials/SpecialModifyTerm.php
index 1d7a44e..143d03b 100644
--- a/repo/includes/specials/SpecialModifyTerm.php
+++ b/repo/includes/specials/SpecialModifyTerm.php
@@ -120,7 +120,7 @@
                        return false;
                }
 
-               try{
+               try {
                        $this->checkTermChangePermissions( 
$this->entityRevision->getEntity() );
                } catch ( PermissionsError $e ) {
                        $this->showErrorHTML( $this->msg( 'permissionserrors' ) 
. ': ' . $e->permission );
diff --git a/repo/includes/store/sql/ChangesSubscriptionTableBuilder.php 
b/repo/includes/store/sql/ChangesSubscriptionTableBuilder.php
index d69beaa..84f2ca3 100644
--- a/repo/includes/store/sql/ChangesSubscriptionTableBuilder.php
+++ b/repo/includes/store/sql/ChangesSubscriptionTableBuilder.php
@@ -128,7 +128,7 @@
                        } else {
                                break;
                        }
-               };
+               }
        }
 
        /**
diff --git a/repo/includes/store/sql/ItemsPerSiteBuilder.php 
b/repo/includes/store/sql/ItemsPerSiteBuilder.php
index 4072602..bf61e2d 100644
--- a/repo/includes/store/sql/ItemsPerSiteBuilder.php
+++ b/repo/includes/store/sql/ItemsPerSiteBuilder.php
@@ -87,7 +87,7 @@
                        $i = $i + $this->rebuildSiteLinks( $ids );
 
                        $this->report( 'Processed ' . $i . ' entities.' );
-               };
+               }
 
                $this->report( 'Rebuild done.' );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/230984
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibfddeb7383f055f356e3d9e7ee34341af7d8fe51
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Ricordisamoa <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to