Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/250651

Change subject: Enable a few code sniffs from the DataModel rule set
......................................................................

Enable a few code sniffs from the DataModel rule set

This adds a few PHPCS rules that are currently in the Wikibase DataModel
rule set. One mistake is found by these new rules.

Change-Id: Ie7989c7ee54ac1396683cbe89922111dd7cf8012
---
M lib/includes/store/sql/ChangeLookup.php
M phpcs.xml
2 files changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/51/250651/1

diff --git a/lib/includes/store/sql/ChangeLookup.php 
b/lib/includes/store/sql/ChangeLookup.php
index 609de28..abcac02 100644
--- a/lib/includes/store/sql/ChangeLookup.php
+++ b/lib/includes/store/sql/ChangeLookup.php
@@ -93,11 +93,11 @@
 
        /**
         * @param int $revisionId
-        * @param string $mode (ChangeLookup::FROM_SLAVE or 
ChangeLookup::FROM_MASTER)
+        * @param string $mode One of the self::FROM_... constants.
         *
         * @return Change|null
         */
-       public function loadByRevisionId( $revisionId, $mode = 
ChangeLookup::FROM_SLAVE ) {
+       public function loadByRevisionId( $revisionId, $mode = self::FROM_SLAVE 
) {
                Assert::parameterType( 'integer', $revisionId, '$revisionId' );
 
                $change = $this->loadChanges(
@@ -106,7 +106,7 @@
                                'LIMIT' => 1
                        ),
                        __METHOD__,
-                       $mode === ChangeLookup::FROM_MASTER ? DB_MASTER : 
DB_SLAVE
+                       $mode === self::FROM_MASTER ? DB_MASTER : DB_SLAVE
                );
 
                if ( isset( $change[0] ) ) {
diff --git a/phpcs.xml b/phpcs.xml
index b27c288..50ce4ed 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -45,16 +45,21 @@
 
        <rule ref="PSR2.Files" />
 
+       <rule ref="Squiz.Classes.DuplicateProperty" />
+       <rule ref="Squiz.Classes.SelfMemberReference" />
        <!-- This sniff is included in PSR1 but needs an exception. -->
        <rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
                
<exclude-pattern>DataAccess.Scribunto.Scribunto_LuaWikibase*Library</exclude-pattern>
        </rule>
        <rule ref="Squiz.ControlStructures.ControlSignature" />
+       <rule ref="Squiz.Functions.FunctionDuplicateArgument" />
+       <rule ref="Squiz.Functions.GlobalFunction" />
        <rule ref="Squiz.Scope" />
        <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>
        </rule>
+       <rule ref="Squiz.WhiteSpace.CastSpacing" />
        <rule ref="Squiz.WhiteSpace.FunctionSpacing">
                <properties>
                        <property name="spacing" value="1" />

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7989c7ee54ac1396683cbe89922111dd7cf8012
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

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

Reply via email to