Addshore has uploaded a new change for review.

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

Change subject: Fix all phpcs issue in /includes
......................................................................

Fix all phpcs issue in /includes

Change-Id: I1164d23c414ca68f87c045ba195a587b17263c35
---
M includes/Html/HtmlTableBuilder.php
M includes/Html/HtmlTableHeaderBuilder.php
M includes/Serializer/ViolationSerializer.php
M includes/Violations/DispatchingViolationFormatter.php
M includes/Violations/SqlViolationRepo.php
M includes/Violations/Violation.php
M includes/Violations/ViolationFormatter.php
M includes/Violations/ViolationLookup.php
M includes/Violations/ViolationStore.php
M includes/WikibaseQualityServices.php
10 files changed, 61 insertions(+), 29 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQuality 
refs/changes/22/231522/1

diff --git a/includes/Html/HtmlTableBuilder.php 
b/includes/Html/HtmlTableBuilder.php
index fec23e4..f89b699 100644
--- a/includes/Html/HtmlTableBuilder.php
+++ b/includes/Html/HtmlTableBuilder.php
@@ -33,7 +33,9 @@
         */
        public function __construct( $headers ) {
                if ( !is_array( $headers ) ) {
-                       throw new InvalidArgumentException( '$headers must be 
an array of strings or HtmlTableHeader elements.' );
+                       throw new InvalidArgumentException(
+                               '$headers must be an array of strings or 
HtmlTableHeader elements.'
+                       );
                }
 
                foreach ( $headers as $header ) {
@@ -54,7 +56,9 @@
                                $this->isSortable = true;
                        }
                } else {
-                       throw new InvalidArgumentException( 'Each element in 
$headers must be a string or an HtmlTableHeader' );
+                       throw new InvalidArgumentException(
+                               'Each element in $headers must be a string or 
an HtmlTableHeader'
+                       );
                }
        }
 
@@ -88,7 +92,7 @@
                foreach ( $cells as $key => $cell ) {
                        if ( is_string( $cell ) ) {
                                $cells[$key] = new HtmlTableCellBuilder( $cell 
);
-                       } else if ( !( $cell instanceof HtmlTableCellBuilder ) 
) {
+                       } elseif ( !( $cell instanceof HtmlTableCellBuilder ) ) 
{
                                throw new InvalidArgumentException( '$cells 
must be array of HtmlTableCell objects.' );
                        }
                }
diff --git a/includes/Html/HtmlTableHeaderBuilder.php 
b/includes/Html/HtmlTableHeaderBuilder.php
index b2726fd..e26b5a7 100644
--- a/includes/Html/HtmlTableHeaderBuilder.php
+++ b/includes/Html/HtmlTableHeaderBuilder.php
@@ -89,7 +89,7 @@
                                $attributes
                        )
                        . $content
-                       . Html::closeElement('th');
+                       . Html::closeElement( 'th' );
        }
 
 }
diff --git a/includes/Serializer/ViolationSerializer.php 
b/includes/Serializer/ViolationSerializer.php
index 59379cf..bfb8d2c 100644
--- a/includes/Serializer/ViolationSerializer.php
+++ b/includes/Serializer/ViolationSerializer.php
@@ -2,11 +2,9 @@
 
 namespace WikibaseQuality\Serializer;
 
-
 use Serializers\DispatchableSerializer;
 use Serializers\Exceptions\UnsupportedObjectException;
 use WikibaseQuality\Violations\Violation;
-
 
 class ViolationSerializer implements DispatchableSerializer {
 
@@ -55,4 +53,4 @@
                );
        }
 
-}
\ No newline at end of file
+}
diff --git a/includes/Violations/DispatchingViolationFormatter.php 
b/includes/Violations/DispatchingViolationFormatter.php
index 65f78cc..86ab576 100644
--- a/includes/Violations/DispatchingViolationFormatter.php
+++ b/includes/Violations/DispatchingViolationFormatter.php
@@ -33,7 +33,9 @@
        private function assertAreViolationFormatters( array 
$violationFormatters ) {
                foreach ( $violationFormatters as $key => $violationFormatter ) 
{
                        if ( !( $violationFormatter instanceof 
ViolationFormatter ) ) {
-                               throw new InvalidArgumentException( 'Got an 
object that is not an instance of ViolationFormatter' );
+                               throw new InvalidArgumentException(
+                                       'Got an object that is not an instance 
of ViolationFormatter'
+                               );
                        }
                }
        }
@@ -46,7 +48,7 @@
         */
        public function isFormatterFor( Violation $violation ) {
                foreach ( $this->violationFormatters as $violationFormatter ) {
-                       if( $violationFormatter->isFormatterFor( $violation ) ) 
{
+                       if ( $violationFormatter->isFormatterFor( $violation ) 
) {
                                return true;
                        }
                }
@@ -107,7 +109,9 @@
                        }
                }
 
-               throw new UnexpectedValueException( 'Formatting of given 
violation is not supported by current formatter.' );
+               throw new UnexpectedValueException(
+                       'Formatting of given violation is not supported by 
current formatter.'
+               );
        }
 
 }
diff --git a/includes/Violations/SqlViolationRepo.php 
b/includes/Violations/SqlViolationRepo.php
index b7b14be..dfa91dd 100644
--- a/includes/Violations/SqlViolationRepo.php
+++ b/includes/Violations/SqlViolationRepo.php
@@ -84,7 +84,9 @@
                        throw new InvalidArgumentException( '$constraintId must 
be string.' );
                }
                if ( $query->getClaimGuid() || $query->getConstraintId() ) {
-                       throw new InvalidArgumentException( 'Filtering by claim 
guid or constraint id is not supported.' );
+                       throw new InvalidArgumentException(
+                               'Filtering by claim guid or constraint id is 
not supported.'
+                       );
                }
 
                $db = wfGetDB( DB_SLAVE );
diff --git a/includes/Violations/Violation.php 
b/includes/Violations/Violation.php
index 1a3746f..c587c16 100644
--- a/includes/Violations/Violation.php
+++ b/includes/Violations/Violation.php
@@ -96,8 +96,17 @@
         * @param string $updatedAt
         */
        // TODO: Argument 5 --> EntityId as TypeHint
-       public function __construct( EntityId $entityId, PropertyId 
$propertyId, $claimGuid, $constraintId, $constraintTypeEntityId,
-                                                                $revisionId, 
$status, array $additionalInfo = array(), $updatedAt = null ) {
+       public function __construct(
+               EntityId $entityId,
+               PropertyId $propertyId,
+               $claimGuid,
+               $constraintId,
+               $constraintTypeEntityId,
+               $revisionId,
+               $status,
+               array $additionalInfo = array(),
+               $updatedAt = null
+       ) {
                $this->entityId = $entityId;
                $this->propertyId = $propertyId;
                $this->setClaimGuid( $claimGuid );
@@ -202,7 +211,7 @@
                }
 
                $timestamp = wfTimestamp( TS_MW, $updatedAt );
-               if( !$timestamp ) {
+               if ( !$timestamp ) {
                        throw new InvalidArgumentException( '$updatedAt has 
invalid timestamp format!' );
                }
 
diff --git a/includes/Violations/ViolationFormatter.php 
b/includes/Violations/ViolationFormatter.php
index 289fbd2..63fde98 100644
--- a/includes/Violations/ViolationFormatter.php
+++ b/includes/Violations/ViolationFormatter.php
@@ -2,7 +2,6 @@
 
 namespace WikibaseQuality\Violations;
 
-
 /**
  * Interface ViolationFormatter
  * @package WikibaseQuality\Violations
@@ -51,4 +50,5 @@
         * @return string HTML
         */
        public function getLongMessage( Violation $violation, 
$canManageExceptions );
-}
\ No newline at end of file
+
+}
diff --git a/includes/Violations/ViolationLookup.php 
b/includes/Violations/ViolationLookup.php
index c925f26..b6a9d1e 100644
--- a/includes/Violations/ViolationLookup.php
+++ b/includes/Violations/ViolationLookup.php
@@ -2,7 +2,6 @@
 
 namespace WikibaseQuality\Violations;
 
-
 /**
  * Interface ViolationLookup
  * @package WikibaseQuality\Violations
@@ -15,6 +14,7 @@
         * Gets violations for a given query.
         *
         * @param ViolationQuery $query
+        *
         * @return Violation[]
         */
        public function get( ViolationQuery $query );
@@ -27,7 +27,15 @@
         * @param string $direction
         * @param string $claimGuid
         * @param string $constraintId
+        *
         * @return array
         */
-       public function getForPage( ViolationQuery $query, $maxNumber, 
$direction, $claimGuid, $constraintId );
+       public function getForPage(
+               ViolationQuery $query,
+               $maxNumber,
+               $direction,
+               $claimGuid,
+               $constraintId
+       );
+
 }
\ No newline at end of file
diff --git a/includes/Violations/ViolationStore.php 
b/includes/Violations/ViolationStore.php
index 0c586e8..7a25fa9 100644
--- a/includes/Violations/ViolationStore.php
+++ b/includes/Violations/ViolationStore.php
@@ -2,7 +2,6 @@
 
 namespace WikibaseQuality\Violations;
 
-
 /**
  * Interface ViolationStore
  * @package WikibaseQuality\Violations
@@ -16,6 +15,7 @@
         *
         * @param Violation $violation
         * @param bool $overwriteExisting
+        *
         * @return mixed
         */
        public function insert( Violation $violation, $overwriteExisting = 
false );
@@ -25,6 +25,7 @@
         *
         * @param Violation $violation
         * @param bool $overwriteException
+        *
         * @return mixed
         */
        public function update( Violation $violation, $overwriteException = 
false );
@@ -33,6 +34,7 @@
         * Deletes given violation from database.
         *
         * @param Violation $violation
+        *
         * @return bool|\ResultWrapper
         * @throws \DBUnexpectedError
         */
diff --git a/includes/WikibaseQualityServices.php 
b/includes/WikibaseQualityServices.php
index 6d90d78..2b11b96 100644
--- a/includes/WikibaseQualityServices.php
+++ b/includes/WikibaseQualityServices.php
@@ -86,11 +86,13 @@
        public function getDispatchingViolationFormatter() {
                $registeredFormatters = array();
 
-               foreach( $this->getRegisteredSubExtensions() as $subExtension ) 
{
-                       if( isset( $subExtension['violationFormatter'] ) ) {
+               foreach ( $this->getRegisteredSubExtensions() as $subExtension 
) {
+                       if ( isset( $subExtension['violationFormatter'] ) ) {
                                $formatter = call_user_func( 
$subExtension['violationFormatter'] );
                                if ( !( $formatter instanceof 
ViolationFormatter ) ) {
-                                       throw new UnexpectedValueException( 
'Registered formatters must implement ViolationFormatter interface.' );
+                                       throw new UnexpectedValueException(
+                                               'Registered formatters must 
implement ViolationFormatter interface.'
+                                       );
                                }
                                $registeredFormatters[] = $formatter;
                        }
@@ -111,14 +113,17 @@
        public function getViolationTypes( $subExtensionId = null ) {
                $registeredTypes = array();
                foreach ( $this->getRegisteredSubExtensions() as $id => 
$subExtension ) {
-                       if( isset( $subExtension['violationTypes'] ) &&
-                               ( $subExtensionId === null || $subExtensionId 
=== $id ) ) {
+                       if ( isset( $subExtension['violationTypes'] ) &&
+                               ( $subExtensionId === null || $subExtensionId 
=== $id )
+                       ) {
                                if ( is_callable( 
$subExtension['violationTypes'] ) ) {
                                        $types = call_user_func( 
$subExtension['violationTypes'] );
-                                       if( !is_array( $types ) ) {
-                                               throw new 
UnexpectedValueException( 'Registered violation types callback must return 
array.' );
+                                       if ( !is_array( $types ) ) {
+                                               throw new 
UnexpectedValueException(
+                                                       'Registered violation 
types callback must return array.'
+                                               );
                                        }
-                               } else if ( is_array( 
$subExtension['violationTypes'] ) ) {
+                               } elseif ( is_array( 
$subExtension['violationTypes'] ) ) {
                                        $types = 
$subExtension['violationTypes'];
                                } else {
                                        throw new UnexpectedValueException( 
'Registered violation types are invalid.' );
@@ -128,7 +133,7 @@
                        }
                }
 
-               if( $subExtensionId ) {
+               if ( $subExtensionId ) {
                        return $registeredTypes[$subExtensionId];
                }
 
@@ -148,7 +153,7 @@
         * @return array
         */
        private function getRegisteredSubExtensions() {
-               if( isset( $GLOBALS['wbqSubExtensions'] ) ) {
+               if ( isset( $GLOBALS['wbqSubExtensions'] ) ) {
                        return $GLOBALS['wbqSubExtensions'];
                }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1164d23c414ca68f87c045ba195a587b17263c35
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQuality
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>

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

Reply via email to