Addshore has uploaded a new change for review.

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

Change subject: Fix PHPCS issues in api files
......................................................................

Fix PHPCS issues in api files

Change-Id: I223ab5e49992e509e84b0eddfaea3295e06a00a1
---
M api/GetViolationMessages.php
M api/GetViolationTypes.php
M api/ModifyViolation.php
3 files changed, 46 insertions(+), 11 deletions(-)


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

diff --git a/api/GetViolationMessages.php b/api/GetViolationMessages.php
index be78072..5d1caad 100755
--- a/api/GetViolationMessages.php
+++ b/api/GetViolationMessages.php
@@ -66,7 +66,7 @@
         * @param string $prefix
         * @return GetViolationMessages
         */
-       public static function newFromGlobalState( ApiMain $main, $name, 
$prefix = '' ) {
+       public static function newFromGlobalState( ApiMain $main, $name, 
$prefix = '' ) {
                $wikibaseRepo = WikibaseRepo::getDefaultInstance();
                $qualityServices = 
WikibaseQualityServices::getDefaultInstance();
 
@@ -113,7 +113,9 @@
        }
 
        /**
-        * Gets violations from the violations table belonging to given entity 
and outputs them in the form of:
+        * Gets violations from the violations table belonging to the
+        * given entity and outputs them in the form of:
+        *
         * results => array(
         *        claimGuid = array(
         *            violation of this claim,
@@ -163,8 +165,17 @@
        private function checkExceptionPermission( EntityId $entityId ) {
                $user = $this->getUser();
 
-               $canEdit = 
$this->permissionChecker->getPermissionStatusForEntityId( $user, 'edit', 
$entityId )->isOK();
-               $canMarkAsException = 
$this->permissionChecker->getPermissionStatusForEntityId( $user, 
'wikibase-violation-exception', $entityId )->isOK();
+               $canEdit = 
$this->permissionChecker->getPermissionStatusForEntityId(
+                       $user,
+                       'edit',
+                       $entityId
+               )->isOK();
+
+               $canMarkAsException = 
$this->permissionChecker->getPermissionStatusForEntityId(
+                       $user,
+                       'wikibase-violation-exception',
+                       $entityId
+               )->isOK();
 
                return $canEdit && $canMarkAsException;
        }
@@ -184,7 +195,10 @@
                                $shortMessage = 
$this->violationFormatter->getShortMessage( $violation );
                                $longMessage = 
$this->violationFormatter->getLongMessage( $violation, $permissionStatus );
                                $iconClass = 
$this->violationFormatter->getIconClass( $violation );
-                       } catch ( UnexpectedValueException $e ) { }
+                       } catch ( UnexpectedValueException $e )
+                       {
+                               // Ignore
+                       }
 
                        $serialization = array(
                                'constraintId' => $violation->getConstraintId(),
diff --git a/api/GetViolationTypes.php b/api/GetViolationTypes.php
index c73e7fc..a6d62da 100644
--- a/api/GetViolationTypes.php
+++ b/api/GetViolationTypes.php
@@ -60,7 +60,13 @@
         * @param array $violationTypes
         * @param ApiHelperFactory $apiHelperFactory
         */
-       public function __construct( ApiMain $main, $name, $prefix = '', array 
$violationTypes, ApiHelperFactory $apiHelperFactory ) {
+       public function __construct(
+               ApiMain $main,
+               $name,
+               $prefix = '',
+               array $violationTypes,
+               ApiHelperFactory $apiHelperFactory
+       ) {
                parent::__construct( $main, $name, $prefix );
 
                $this->violationTypes = $violationTypes;
diff --git a/api/ModifyViolation.php b/api/ModifyViolation.php
index e849c12..81b55f6 100755
--- a/api/ModifyViolation.php
+++ b/api/ModifyViolation.php
@@ -69,7 +69,7 @@
         * @param string $prefix
         * @return ModifyViolation
         */
-       public static function newFromGlobalState( ApiMain $main, $name, 
$prefix = '' ) {
+       public static function newFromGlobalState( ApiMain $main, $name, 
$prefix = '' ) {
                $wikibaseRepo = WikibaseRepo::getDefaultInstance();
                $qualityServices = 
WikibaseQualityServices::getDefaultInstance();
 
@@ -160,12 +160,18 @@
                }
 
                if ( !$violationsFromDb || count( $violationsFromDb ) !== 1 ) {
-                       $this->errorReporter->dieError( 'Violations with given 
identifiers does not exist!', 'missing-violation' );
+                       $this->errorReporter->dieError(
+                               'Violations with given identifiers does not 
exist!',
+                               'missing-violation'
+                       );
                }
 
                $violationFromDb = $violationsFromDb[0];
                if ( !$this->checkPermission( $violationFromDb ) ) {
-                       $this->errorReporter->dieError( 'You do not have the 
permission to change this violation!', 'permissiondenied' );
+                       $this->errorReporter->dieError(
+                               'You do not have the permission to change this 
violation!',
+                               'permissiondenied'
+                       );
                }
 
                $violation = new Violation(
@@ -197,8 +203,17 @@
                $user = $this->getUser();
                $entityId = $violation->getEntityId();
 
-               $canEdit = 
$this->permissionChecker->getPermissionStatusForEntityId( $user, 'edit', 
$entityId )->isOK();
-               $canMarkAsException = 
$this->permissionChecker->getPermissionStatusForEntityId( $user, 
'wikibase-violation-exception', $entityId )->isOK();
+               $canEdit = 
$this->permissionChecker->getPermissionStatusForEntityId(
+                       $user,
+                       'edit',
+                       $entityId
+               )->isOK();
+
+               $canMarkAsException = 
$this->permissionChecker->getPermissionStatusForEntityId(
+                       $user,
+                       'wikibase-violation-exception',
+                       $entityId
+               )->isOK();
 
                return $canEdit && $canMarkAsException;
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I223ab5e49992e509e84b0eddfaea3295e06a00a1
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