Completed
Push — master ( 4c5602...13c0ce )
by
unknown
06:07 queued 55s
created
src/ConstraintCheck/Checker/SymmetricChecker.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @return CheckResult
81 81
 	 */
82
-	public function checkConstraint( Context $context, Constraint $constraint ) {
83
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
84
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
82
+	public function checkConstraint(Context $context, Constraint $constraint) {
83
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
84
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
85 85
 		}
86 86
 
87 87
 		$parameters = [];
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 		$snak = $context->getSnak();
90 90
 		$propertyId = $context->getSnak()->getPropertyId();
91 91
 
92
-		if ( !$snak instanceof PropertyValueSnak ) {
92
+		if (!$snak instanceof PropertyValueSnak) {
93 93
 			// nothing to check
94
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
94
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
95 95
 		}
96 96
 
97 97
 		$dataValue = $snak->getDataValue();
@@ -100,22 +100,22 @@  discard block
 block discarded – undo
100 100
 		 * error handling:
101 101
 		 *   type of $dataValue for properties with 'Symmetric' constraint has to be 'wikibase-entityid'
102 102
 		 */
103
-		if ( $dataValue->getType() !== 'wikibase-entityid' ) {
104
-			$message = wfMessage( "wbqc-violation-message-value-needed-of-type" )
103
+		if ($dataValue->getType() !== 'wikibase-entityid') {
104
+			$message = wfMessage("wbqc-violation-message-value-needed-of-type")
105 105
 					 ->rawParams(
106
-						 $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ),
106
+						 $this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM),
107 107
 						 'wikibase-entityid' // TODO is there a message for this type so we can localize it?
108 108
 					 )
109 109
 					 ->escaped();
110
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
110
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
111 111
 		}
112 112
 		/** @var EntityIdValue $dataValue */
113 113
 
114 114
 		$targetEntityId = $dataValue->getEntityId();
115
-		$targetEntity = $this->entityLookup->getEntity( $targetEntityId );
116
-		if ( $targetEntity === null ) {
117
-			$message = wfMessage( "wbqc-violation-message-target-entity-must-exist" )->escaped();
118
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
115
+		$targetEntity = $this->entityLookup->getEntity($targetEntityId);
116
+		if ($targetEntity === null) {
117
+			$message = wfMessage("wbqc-violation-message-target-entity-must-exist")->escaped();
118
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
119 119
 		}
120 120
 
121 121
 		$symmetricStatement = $this->connectionCheckerHelper->findStatementWithPropertyAndEntityIdValue(
@@ -123,26 +123,26 @@  discard block
 block discarded – undo
123 123
 			$propertyId,
124 124
 			$context->getEntity()->getId()
125 125
 		);
126
-		if ( $symmetricStatement !== null ) {
126
+		if ($symmetricStatement !== null) {
127 127
 			$message = null;
128 128
 			$status = CheckResult::STATUS_COMPLIANCE;
129 129
 		} else {
130
-			$message = wfMessage( 'wbqc-violation-message-symmetric' )
130
+			$message = wfMessage('wbqc-violation-message-symmetric')
131 131
 					 ->rawParams(
132
-						 $this->constraintParameterRenderer->formatEntityId( $targetEntityId, Role::SUBJECT ),
133
-						 $this->constraintParameterRenderer->formatEntityId( $propertyId, Role::PREDICATE ),
134
-						 $this->constraintParameterRenderer->formatEntityId( $context->getEntity()->getId(), Role::OBJECT )
132
+						 $this->constraintParameterRenderer->formatEntityId($targetEntityId, Role::SUBJECT),
133
+						 $this->constraintParameterRenderer->formatEntityId($propertyId, Role::PREDICATE),
134
+						 $this->constraintParameterRenderer->formatEntityId($context->getEntity()->getId(), Role::OBJECT)
135 135
 					 )
136 136
 					 ->escaped();
137 137
 			$status = CheckResult::STATUS_VIOLATION;
138 138
 		}
139 139
 
140
-		return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) )
141
-			->withMetadata( Metadata::ofDependencyMetadata(
142
-				DependencyMetadata::ofEntityId( $targetEntityId ) ) );
140
+		return (new CheckResult($context, $constraint, $parameters, $status, $message))
141
+			->withMetadata(Metadata::ofDependencyMetadata(
142
+				DependencyMetadata::ofEntityId($targetEntityId) ));
143 143
 	}
144 144
 
145
-	public function checkConstraintParameters( Constraint $constraint ) {
145
+	public function checkConstraintParameters(Constraint $constraint) {
146 146
 		// no parameters
147 147
 		return [];
148 148
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/MandatoryQualifiersChecker.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -70,43 +70,43 @@
 block discarded – undo
70 70
 	 * @throws ConstraintParameterException
71 71
 	 * @return CheckResult
72 72
 	 */
73
-	public function checkConstraint( Context $context, Constraint $constraint ) {
74
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
75
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
73
+	public function checkConstraint(Context $context, Constraint $constraint) {
74
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
75
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
76 76
 		}
77 77
 
78 78
 		$parameters = [];
79 79
 		$constraintParameters = $constraint->getConstraintParameters();
80 80
 
81
-		$propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
82
-		$parameters['property'] = [ $propertyId ];
81
+		$propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
82
+		$parameters['property'] = [$propertyId];
83 83
 
84
-		$message = wfMessage( "wbqc-violation-message-mandatory-qualifier" )
84
+		$message = wfMessage("wbqc-violation-message-mandatory-qualifier")
85 85
 				 ->rawParams(
86
-					 $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
87
-					 $this->constraintParameterRenderer->formatEntityId( $propertyId, Role::QUALIFIER_PREDICATE )
86
+					 $this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
87
+					 $this->constraintParameterRenderer->formatEntityId($propertyId, Role::QUALIFIER_PREDICATE)
88 88
 				 )
89 89
 				 ->escaped();
90 90
 		$status = CheckResult::STATUS_VIOLATION;
91 91
 
92 92
 		/** @var Snak $qualifier */
93
-		foreach ( $context->getSnakStatement()->getQualifiers() as $qualifier ) {
94
-			if ( $propertyId->equals( $qualifier->getPropertyId() ) ) {
93
+		foreach ($context->getSnakStatement()->getQualifiers() as $qualifier) {
94
+			if ($propertyId->equals($qualifier->getPropertyId())) {
95 95
 				$message = null;
96 96
 				$status = CheckResult::STATUS_COMPLIANCE;
97 97
 				break;
98 98
 			}
99 99
 		}
100 100
 
101
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
101
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
102 102
 	}
103 103
 
104
-	public function checkConstraintParameters( Constraint $constraint ) {
104
+	public function checkConstraintParameters(Constraint $constraint) {
105 105
 		$constraintParameters = $constraint->getConstraintParameters();
106 106
 		$exceptions = [];
107 107
 		try {
108
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
109
-		} catch ( ConstraintParameterException $e ) {
108
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
109
+		} catch (ConstraintParameterException $e) {
110 110
 			$exceptions[] = $e;
111 111
 		}
112 112
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/TargetRequiredClaimChecker.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -87,25 +87,25 @@  discard block
 block discarded – undo
87 87
 	 * @throws ConstraintParameterException
88 88
 	 * @return CheckResult
89 89
 	 */
90
-	public function checkConstraint( Context $context, Constraint $constraint ) {
91
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
92
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
90
+	public function checkConstraint(Context $context, Constraint $constraint) {
91
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
92
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
93 93
 		}
94 94
 
95 95
 		$parameters = [];
96 96
 		$constraintParameters = $constraint->getConstraintParameters();
97 97
 
98
-		$propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
99
-		$parameters['property'] = [ $propertyId ];
98
+		$propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
99
+		$parameters['property'] = [$propertyId];
100 100
 
101
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
101
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
102 102
 		$parameters['items'] = $items;
103 103
 
104 104
 		$snak = $context->getSnak();
105 105
 
106
-		if ( !$snak instanceof PropertyValueSnak ) {
106
+		if (!$snak instanceof PropertyValueSnak) {
107 107
 			// nothing to check
108
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
108
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
109 109
 		}
110 110
 
111 111
 		$dataValue = $snak->getDataValue();
@@ -114,22 +114,22 @@  discard block
 block discarded – undo
114 114
 		 * error handling:
115 115
 		 *   type of $dataValue for properties with 'Target required claim' constraint has to be 'wikibase-entityid'
116 116
 		 */
117
-		if ( $dataValue->getType() !== 'wikibase-entityid' ) {
118
-			$message = wfMessage( "wbqc-violation-message-value-needed-of-type" )
117
+		if ($dataValue->getType() !== 'wikibase-entityid') {
118
+			$message = wfMessage("wbqc-violation-message-value-needed-of-type")
119 119
 				->rawParams(
120
-					$this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ),
120
+					$this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM),
121 121
 					'wikibase-entityid' // TODO is there a message for this type so we can localize it?
122 122
 				)
123 123
 				->escaped();
124
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
124
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
125 125
 		}
126 126
 		/** @var EntityIdValue $dataValue */
127 127
 
128 128
 		$targetEntityId = $dataValue->getEntityId();
129
-		$targetEntity = $this->entityLookup->getEntity( $targetEntityId );
130
-		if ( $targetEntity === null ) {
131
-			$message = wfMessage( "wbqc-violation-message-target-entity-must-exist" )->escaped();
132
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
129
+		$targetEntity = $this->entityLookup->getEntity($targetEntityId);
130
+		if ($targetEntity === null) {
131
+			$message = wfMessage("wbqc-violation-message-target-entity-must-exist")->escaped();
132
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
133 133
 		}
134 134
 
135 135
 		/*
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		 *   a) a property only
138 138
 		 *   b) a property and a number of items (each combination forming an individual claim)
139 139
 		 */
140
-		if ( $items === [] ) {
140
+		if ($items === []) {
141 141
 			$requiredStatement = $this->connectionCheckerHelper->findStatementWithProperty(
142 142
 				$targetEntity->getStatements(),
143 143
 				$propertyId
@@ -150,37 +150,37 @@  discard block
 block discarded – undo
150 150
 			);
151 151
 		}
152 152
 
153
-		if ( $requiredStatement !== null ) {
153
+		if ($requiredStatement !== null) {
154 154
 			$status = CheckResult::STATUS_COMPLIANCE;
155 155
 			$message = null;
156 156
 		} else {
157 157
 			$status = CheckResult::STATUS_VIOLATION;
158
-			$message = wfMessage( 'wbqc-violation-message-target-required-claim' );
158
+			$message = wfMessage('wbqc-violation-message-target-required-claim');
159 159
 			$message->rawParams(
160
-				$this->constraintParameterRenderer->formatEntityId( $targetEntityId, Role::SUBJECT ),
161
-				$this->constraintParameterRenderer->formatEntityId( $propertyId, Role::PREDICATE )
160
+				$this->constraintParameterRenderer->formatEntityId($targetEntityId, Role::SUBJECT),
161
+				$this->constraintParameterRenderer->formatEntityId($propertyId, Role::PREDICATE)
162 162
 			);
163
-			$message->numParams( count( $items ) );
164
-			$message->rawParams( $this->constraintParameterRenderer->formatItemIdSnakValueList( $items, Role::OBJECT ) );
163
+			$message->numParams(count($items));
164
+			$message->rawParams($this->constraintParameterRenderer->formatItemIdSnakValueList($items, Role::OBJECT));
165 165
 			$message = $message->escaped();
166 166
 		}
167 167
 
168
-		return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) )
169
-			->withMetadata( Metadata::ofDependencyMetadata(
170
-				DependencyMetadata::ofEntityId( $targetEntityId ) ) );
168
+		return (new CheckResult($context, $constraint, $parameters, $status, $message))
169
+			->withMetadata(Metadata::ofDependencyMetadata(
170
+				DependencyMetadata::ofEntityId($targetEntityId) ));
171 171
 	}
172 172
 
173
-	public function checkConstraintParameters( Constraint $constraint ) {
173
+	public function checkConstraintParameters(Constraint $constraint) {
174 174
 		$constraintParameters = $constraint->getConstraintParameters();
175 175
 		$exceptions = [];
176 176
 		try {
177
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
178
-		} catch ( ConstraintParameterException $e ) {
177
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
178
+		} catch (ConstraintParameterException $e) {
179 179
 			$exceptions[] = $e;
180 180
 		}
181 181
 		try {
182
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
183
-		} catch ( ConstraintParameterException $e ) {
182
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
183
+		} catch (ConstraintParameterException $e) {
184 184
 			$exceptions[] = $e;
185 185
 		}
186 186
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/RangeChecker.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 	 * @throws ConstraintParameterException
85 85
 	 * @return CheckResult
86 86
 	 */
87
-	public function checkConstraint( Context $context, Constraint $constraint ) {
88
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
89
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
87
+	public function checkConstraint(Context $context, Constraint $constraint) {
88
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
89
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
90 90
 		}
91 91
 
92 92
 		$parameters = [];
@@ -94,42 +94,42 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$snak = $context->getSnak();
96 96
 
97
-		if ( !$snak instanceof PropertyValueSnak ) {
97
+		if (!$snak instanceof PropertyValueSnak) {
98 98
 			// nothing to check
99
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
99
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
100 100
 		}
101 101
 
102 102
 		$dataValue = $snak->getDataValue();
103 103
 
104
-		list( $min, $max ) = $this->constraintParameterParser->parseRangeParameter(
104
+		list($min, $max) = $this->constraintParameterParser->parseRangeParameter(
105 105
 			$constraintParameters,
106 106
 			$constraint->getConstraintTypeItemId(),
107 107
 			$dataValue->getType()
108 108
 		);
109 109
 		$parameterKey = $dataValue->getType() === 'quantity' ? 'quantity' : 'date';
110
-		if ( $min !== null ) {
111
-			$parameters['minimum_' . $parameterKey] = [ $min ];
110
+		if ($min !== null) {
111
+			$parameters['minimum_'.$parameterKey] = [$min];
112 112
 		}
113
-		if ( $max !== null ) {
114
-			$parameters['maximum_' . $parameterKey] = [ $max ];
113
+		if ($max !== null) {
114
+			$parameters['maximum_'.$parameterKey] = [$max];
115 115
 		}
116 116
 
117
-		if ( $this->rangeCheckerHelper->getComparison( $min, $dataValue ) > 0 ||
118
-			 $this->rangeCheckerHelper->getComparison( $dataValue, $max ) > 0
117
+		if ($this->rangeCheckerHelper->getComparison($min, $dataValue) > 0 ||
118
+			 $this->rangeCheckerHelper->getComparison($dataValue, $max) > 0
119 119
 		) {
120 120
 			// at least one of $min, $max is set at this point, otherwise there could be no violation
121 121
 			$type = $dataValue->getType();
122
-			$openness = $min !== null ? ( $max !== null ? 'closed' : 'rightopen' ) : 'leftopen';
123
-			$message = wfMessage( "wbqc-violation-message-range-$type-$openness" );
122
+			$openness = $min !== null ? ($max !== null ? 'closed' : 'rightopen') : 'leftopen';
123
+			$message = wfMessage("wbqc-violation-message-range-$type-$openness");
124 124
 			$message->rawParams(
125
-				$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE ),
126
-				$this->constraintParameterRenderer->formatDataValue( $dataValue, Role::OBJECT )
125
+				$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE),
126
+				$this->constraintParameterRenderer->formatDataValue($dataValue, Role::OBJECT)
127 127
 			);
128
-			if ( $min !== null ) {
129
-				$message->rawParams( $this->constraintParameterRenderer->formatDataValue( $min, Role::OBJECT ) );
128
+			if ($min !== null) {
129
+				$message->rawParams($this->constraintParameterRenderer->formatDataValue($min, Role::OBJECT));
130 130
 			}
131
-			if ( $max !== null ) {
132
-				$message->rawParams( $this->constraintParameterRenderer->formatDataValue( $max, Role::OBJECT ) );
131
+			if ($max !== null) {
132
+				$message->rawParams($this->constraintParameterRenderer->formatDataValue($max, Role::OBJECT));
133 133
 			}
134 134
 			$message = $message->escaped();
135 135
 			$status = CheckResult::STATUS_VIOLATION;
@@ -138,22 +138,22 @@  discard block
 block discarded – undo
138 138
 			$status = CheckResult::STATUS_COMPLIANCE;
139 139
 		}
140 140
 
141
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
141
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
142 142
 	}
143 143
 
144
-	public function checkConstraintParameters( Constraint $constraint ) {
144
+	public function checkConstraintParameters(Constraint $constraint) {
145 145
 		$constraintParameters = $constraint->getConstraintParameters();
146 146
 		$exceptions = [];
147 147
 		try {
148 148
 			// we don’t have a data value here, so get the type from the property instead
149 149
 			// (the distinction between data type and data value type is irrelevant for 'quantity' and 'time')
150
-			$type = $this->propertyDataTypeLookup->getDataTypeIdForProperty( $constraint->getPropertyId() );
150
+			$type = $this->propertyDataTypeLookup->getDataTypeIdForProperty($constraint->getPropertyId());
151 151
 			$this->constraintParameterParser->parseRangeParameter(
152 152
 				$constraintParameters,
153 153
 				$constraint->getConstraintTypeItemId(),
154 154
 				$type
155 155
 			);
156
-		} catch ( ConstraintParameterException $e ) {
156
+		} catch (ConstraintParameterException $e) {
157 157
 			$exceptions[] = $e;
158 158
 		}
159 159
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/DiffWithinRangeChecker.php 1 patch
Spacing   +43 added lines, -44 removed lines patch added patch discarded remove patch
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 	 * @throws ConstraintParameterException
84 84
 	 * @return array [ DataValue|null $min, DataValue|null $max, PropertyId $property, array $parameters ]
85 85
 	 */
86
-	private function parseConstraintParameters( Constraint $constraint ) {
87
-		list( $min, $max ) = $this->constraintParameterParser->parseRangeParameter(
86
+	private function parseConstraintParameters(Constraint $constraint) {
87
+		list($min, $max) = $this->constraintParameterParser->parseRangeParameter(
88 88
 			$constraint->getConstraintParameters(),
89 89
 			$constraint->getConstraintTypeItemId(),
90 90
 			'quantity'
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 			$constraint->getConstraintTypeItemId()
95 95
 		);
96 96
 
97
-		if ( $min !== null ) {
98
-			$parameters['minimum_quantity'] = [ $min ];
97
+		if ($min !== null) {
98
+			$parameters['minimum_quantity'] = [$min];
99 99
 		}
100
-		if ( $max !== null ) {
101
-			$parameters['maximum_quantity'] = [ $max ];
100
+		if ($max !== null) {
101
+			$parameters['maximum_quantity'] = [$max];
102 102
 		}
103
-		$parameters['property'] = [ $property ];
103
+		$parameters['property'] = [$property];
104 104
 
105
-		return [ $min, $max, $property, $parameters ];
105
+		return [$min, $max, $property, $parameters];
106 106
 	}
107 107
 
108 108
 	/**
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return bool
114 114
 	 */
115
-	private function rangeInYears( $min, $max ) {
116
-		$yearUnit = $this->config->get( 'WBQualityConstraintsYearUnit' );
115
+	private function rangeInYears($min, $max) {
116
+		$yearUnit = $this->config->get('WBQualityConstraintsYearUnit');
117 117
 
118
-		if ( $min !== null && $min->getUnit() === $yearUnit ) {
118
+		if ($min !== null && $min->getUnit() === $yearUnit) {
119 119
 			return true;
120 120
 		}
121
-		if ( $max !== null && $max->getUnit() === $yearUnit ) {
121
+		if ($max !== null && $max->getUnit() === $yearUnit) {
122 122
 			return true;
123 123
 		}
124 124
 
@@ -134,57 +134,56 @@  discard block
 block discarded – undo
134 134
 	 * @throws ConstraintParameterException
135 135
 	 * @return CheckResult
136 136
 	 */
137
-	public function checkConstraint( Context $context, Constraint $constraint ) {
138
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
139
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
137
+	public function checkConstraint(Context $context, Constraint $constraint) {
138
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
139
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
140 140
 		}
141 141
 
142 142
 		$parameters = [];
143 143
 
144 144
 		$snak = $context->getSnak();
145 145
 
146
-		if ( !$snak instanceof PropertyValueSnak ) {
146
+		if (!$snak instanceof PropertyValueSnak) {
147 147
 			// nothing to check
148
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
148
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
149 149
 		}
150 150
 
151 151
 		$minuend = $snak->getDataValue();
152 152
 
153 153
 		/** @var PropertyId $property */
154
-		list( $min, $max, $property, $parameters ) = $this->parseConstraintParameters( $constraint );
154
+		list($min, $max, $property, $parameters) = $this->parseConstraintParameters($constraint);
155 155
 
156 156
 		// checks only the first occurrence of the referenced property (this constraint implies a single value constraint on that property)
157
-		foreach ( $context->getSnakGroup() as $otherSnak ) {
157
+		foreach ($context->getSnakGroup() as $otherSnak) {
158 158
 			if (
159
-				!$property->equals( $otherSnak->getPropertyId() ) ||
159
+				!$property->equals($otherSnak->getPropertyId()) ||
160 160
 				!$otherSnak instanceof PropertyValueSnak
161 161
 			) {
162 162
 				continue;
163 163
 			}
164 164
 
165 165
 			$subtrahend = $otherSnak->getDataValue();
166
-			if ( $subtrahend->getType() === $minuend->getType() ) {
167
-				$diff = $this->rangeInYears( $min, $max ) ?
168
-					$this->rangeCheckerHelper->getDifferenceInYears( $minuend, $subtrahend ) :
169
-					$this->rangeCheckerHelper->getDifference( $minuend, $subtrahend );
166
+			if ($subtrahend->getType() === $minuend->getType()) {
167
+				$diff = $this->rangeInYears($min, $max) ?
168
+					$this->rangeCheckerHelper->getDifferenceInYears($minuend, $subtrahend) : $this->rangeCheckerHelper->getDifference($minuend, $subtrahend);
170 169
 
171
-				if ( $this->rangeCheckerHelper->getComparison( $min, $diff ) > 0 ||
172
-					$this->rangeCheckerHelper->getComparison( $diff, $max ) > 0
170
+				if ($this->rangeCheckerHelper->getComparison($min, $diff) > 0 ||
171
+					$this->rangeCheckerHelper->getComparison($diff, $max) > 0
173 172
 				) {
174 173
 					// at least one of $min, $max is set at this point, otherwise there could be no violation
175
-					$openness = $min !== null ? ( $max !== null ? '' : '-rightopen' ) : '-leftopen';
176
-					$message = wfMessage( "wbqc-violation-message-diff-within-range$openness" );
174
+					$openness = $min !== null ? ($max !== null ? '' : '-rightopen') : '-leftopen';
175
+					$message = wfMessage("wbqc-violation-message-diff-within-range$openness");
177 176
 					$message->rawParams(
178
-						$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE ),
179
-						$this->constraintParameterRenderer->formatDataValue( $minuend, Role::OBJECT ),
180
-						$this->constraintParameterRenderer->formatEntityId( $otherSnak->getPropertyId(), Role::PREDICATE ),
181
-						$this->constraintParameterRenderer->formatDataValue( $subtrahend, Role::OBJECT )
177
+						$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE),
178
+						$this->constraintParameterRenderer->formatDataValue($minuend, Role::OBJECT),
179
+						$this->constraintParameterRenderer->formatEntityId($otherSnak->getPropertyId(), Role::PREDICATE),
180
+						$this->constraintParameterRenderer->formatDataValue($subtrahend, Role::OBJECT)
182 181
 					);
183
-					if ( $min !== null ) {
184
-						$message->rawParams( $this->constraintParameterRenderer->formatDataValue( $min, Role::OBJECT ) );
182
+					if ($min !== null) {
183
+						$message->rawParams($this->constraintParameterRenderer->formatDataValue($min, Role::OBJECT));
185 184
 					}
186
-					if ( $max !== null ) {
187
-						$message->rawParams( $this->constraintParameterRenderer->formatDataValue( $max, Role::OBJECT ) );
185
+					if ($max !== null) {
186
+						$message->rawParams($this->constraintParameterRenderer->formatDataValue($max, Role::OBJECT));
188 187
 					}
189 188
 					$message = $message->escaped();
190 189
 					$status = CheckResult::STATUS_VIOLATION;
@@ -193,19 +192,19 @@  discard block
 block discarded – undo
193 192
 					$status = CheckResult::STATUS_COMPLIANCE;
194 193
 				}
195 194
 			} else {
196
-				$message = wfMessage( "wbqc-violation-message-diff-within-range-must-have-equal-types" )->escaped();
195
+				$message = wfMessage("wbqc-violation-message-diff-within-range-must-have-equal-types")->escaped();
197 196
 				$status = CheckResult::STATUS_VIOLATION;
198 197
 			}
199 198
 
200
-			return new CheckResult( $context, $constraint, $parameters, $status, $message );
199
+			return new CheckResult($context, $constraint, $parameters, $status, $message);
201 200
 		}
202 201
 
203
-		$message = wfMessage( "wbqc-violation-message-diff-within-range-property-must-exist" )->escaped();
202
+		$message = wfMessage("wbqc-violation-message-diff-within-range-property-must-exist")->escaped();
204 203
 		$status = CheckResult::STATUS_VIOLATION;
205
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
204
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
206 205
 	}
207 206
 
208
-	public function checkConstraintParameters( Constraint $constraint ) {
207
+	public function checkConstraintParameters(Constraint $constraint) {
209 208
 		$constraintParameters = $constraint->getConstraintParameters();
210 209
 		$exceptions = [];
211 210
 		try {
@@ -214,12 +213,12 @@  discard block
 block discarded – undo
214 213
 				$constraint->getConstraintTypeItemId(),
215 214
 				'quantity'
216 215
 			);
217
-		} catch ( ConstraintParameterException $e ) {
216
+		} catch (ConstraintParameterException $e) {
218 217
 			$exceptions[] = $e;
219 218
 		}
220 219
 		try {
221
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
222
-		} catch ( ConstraintParameterException $e ) {
220
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
221
+		} catch (ConstraintParameterException $e) {
223 222
 			$exceptions[] = $e;
224 223
 		}
225 224
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ReferenceChecker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 		];
36 36
 	}
37 37
 
38
-	public function checkConstraint( Context $context, Constraint $constraint ) {
39
-		if ( $context->getType() === Context::TYPE_REFERENCE ) {
40
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
38
+	public function checkConstraint(Context $context, Constraint $constraint) {
39
+		if ($context->getType() === Context::TYPE_REFERENCE) {
40
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
41 41
 		} else {
42
-			$message = wfMessage( 'wbqc-violation-message-reference' )->escaped();
43
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
42
+			$message = wfMessage('wbqc-violation-message-reference')->escaped();
43
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
44 44
 		}
45 45
 	}
46 46
 
47
-	public function checkConstraintParameters( Constraint $constraint ) {
47
+	public function checkConstraintParameters(Constraint $constraint) {
48 48
 		// no parameters
49 49
 		return [];
50 50
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/CommonsLinkChecker.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -77,22 +77,22 @@  discard block
 block discarded – undo
77 77
 	 * @return array first element is the namespace number (default namespace for TitleParser),
78 78
 	 * second element is a string to prepend to the title before giving it to the TitleParser
79 79
 	 */
80
-	private function getCommonsNamespace( $namespace ) {
80
+	private function getCommonsNamespace($namespace) {
81 81
 		// for namespace numbers see mediawiki-config repo, wmf-config/InitialiseSettings.php,
82 82
 		// 'wgExtraNamespaces' key, 'commonswiki' subkey
83
-		switch ( $namespace ) {
83
+		switch ($namespace) {
84 84
 			case '':
85
-				return [ NS_MAIN, '' ];
85
+				return [NS_MAIN, ''];
86 86
 			case 'Creator':
87
-				return [ 100, '' ];
87
+				return [100, ''];
88 88
 			case 'TimedText':
89
-				return [ 102, '' ];
89
+				return [102, ''];
90 90
 			case 'Sequence':
91
-				return [ 104, '' ];
91
+				return [104, ''];
92 92
 			case 'Institution':
93
-				return [ 106, '' ];
93
+				return [106, ''];
94 94
 			default:
95
-				return [ NS_MAIN, $namespace . ':' ];
95
+				return [NS_MAIN, $namespace.':'];
96 96
 		}
97 97
 	}
98 98
 
@@ -105,17 +105,17 @@  discard block
 block discarded – undo
105 105
 	 * @throws ConstraintParameterException
106 106
 	 * @return CheckResult
107 107
 	 */
108
-	public function checkConstraint( Context $context, Constraint $constraint ) {
108
+	public function checkConstraint(Context $context, Constraint $constraint) {
109 109
 		$parameters = [];
110 110
 		$constraintParameters = $constraint->getConstraintParameters();
111
-		$namespace = $this->constraintParameterParser->parseNamespaceParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
112
-		$parameters['namespace'] = [ $namespace ];
111
+		$namespace = $this->constraintParameterParser->parseNamespaceParameter($constraintParameters, $constraint->getConstraintTypeItemId());
112
+		$parameters['namespace'] = [$namespace];
113 113
 
114 114
 		$snak = $context->getSnak();
115 115
 
116
-		if ( !$snak instanceof PropertyValueSnak ) {
116
+		if (!$snak instanceof PropertyValueSnak) {
117 117
 			// nothing to check
118
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
118
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
119 119
 		}
120 120
 
121 121
 		$dataValue = $snak->getDataValue();
@@ -125,49 +125,49 @@  discard block
 block discarded – undo
125 125
 		 *   type of $dataValue for properties with 'Commons link' constraint has to be 'string'
126 126
 		 *   parameter $namespace can be null, works for commons galleries
127 127
 		 */
128
-		if ( $dataValue->getType() !== 'string' ) {
129
-			$message = wfMessage( "wbqc-violation-message-value-needed-of-type" )
128
+		if ($dataValue->getType() !== 'string') {
129
+			$message = wfMessage("wbqc-violation-message-value-needed-of-type")
130 130
 					 ->rawParams(
131
-						 $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ),
132
-						 wfMessage( 'datatypes-type-string' )->escaped()
131
+						 $this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM),
132
+						 wfMessage('datatypes-type-string')->escaped()
133 133
 					 )
134 134
 					 ->escaped();
135
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
135
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
136 136
 		}
137 137
 
138 138
 		$commonsLink = $dataValue->getValue();
139 139
 
140 140
 		try {
141
-			if ( !$this->commonsLinkIsWellFormed( $commonsLink ) ) {
142
-				throw new MalformedTitleException( 'wbqc-violation-message-commons-link-not-well-formed', $commonsLink ); // caught below
141
+			if (!$this->commonsLinkIsWellFormed($commonsLink)) {
142
+				throw new MalformedTitleException('wbqc-violation-message-commons-link-not-well-formed', $commonsLink); // caught below
143 143
 			}
144
-			list( $defaultNamespace, $prefix ) = $this->getCommonsNamespace( $namespace );
145
-			$title = $this->titleParser->parseTitle( $prefix . $commonsLink, $defaultNamespace );
146
-			if ( $this->pageExists( $title ) ) {
144
+			list($defaultNamespace, $prefix) = $this->getCommonsNamespace($namespace);
145
+			$title = $this->titleParser->parseTitle($prefix.$commonsLink, $defaultNamespace);
146
+			if ($this->pageExists($title)) {
147 147
 				$message = null;
148 148
 				$status = CheckResult::STATUS_COMPLIANCE;
149 149
 			} else {
150
-				if ( $this->valueIncludesNamespace( $commonsLink, $namespace ) ) {
151
-					throw new MalformedTitleException( 'wbqc-violation-message-commons-link-not-well-formed', $commonsLink ); // caught below
150
+				if ($this->valueIncludesNamespace($commonsLink, $namespace)) {
151
+					throw new MalformedTitleException('wbqc-violation-message-commons-link-not-well-formed', $commonsLink); // caught below
152 152
 				} else {
153
-					$message = wfMessage( "wbqc-violation-message-commons-link-no-existent" )->escaped();
153
+					$message = wfMessage("wbqc-violation-message-commons-link-no-existent")->escaped();
154 154
 					$status = CheckResult::STATUS_VIOLATION;
155 155
 				}
156 156
 			}
157
-		} catch ( MalformedTitleException $e ) {
158
-			$message = wfMessage( "wbqc-violation-message-commons-link-not-well-formed" )->escaped();
157
+		} catch (MalformedTitleException $e) {
158
+			$message = wfMessage("wbqc-violation-message-commons-link-not-well-formed")->escaped();
159 159
 			$status = CheckResult::STATUS_VIOLATION;
160 160
 		}
161 161
 
162
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
162
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
163 163
 	}
164 164
 
165
-	public function checkConstraintParameters( Constraint $constraint ) {
165
+	public function checkConstraintParameters(Constraint $constraint) {
166 166
 		$constraintParameters = $constraint->getConstraintParameters();
167 167
 		$exceptions = [];
168 168
 		try {
169
-			$this->constraintParameterParser->parseNamespaceParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
170
-		} catch ( ConstraintParameterException $e ) {
169
+			$this->constraintParameterParser->parseNamespaceParameter($constraintParameters, $constraint->getConstraintTypeItemId());
170
+		} catch (ConstraintParameterException $e) {
171 171
 			$exceptions[] = $e;
172 172
 		}
173 173
 		return $exceptions;
@@ -178,19 +178,19 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return bool
180 180
 	 */
181
-	private function pageExists( TitleValue $title ) {
181
+	private function pageExists(TitleValue $title) {
182 182
 		$commonsWikiId = 'commonswiki';
183
-		if ( defined( 'MW_PHPUNIT_TEST' ) ) {
183
+		if (defined('MW_PHPUNIT_TEST')) {
184 184
 			$commonsWikiId = false;
185 185
 		}
186 186
 
187
-		$dbLoadBalancer = wfGetLB( $commonsWikiId );
187
+		$dbLoadBalancer = wfGetLB($commonsWikiId);
188 188
 		$dbConnection = $dbLoadBalancer->getConnection(
189 189
 			DB_REPLICA, false, $commonsWikiId );
190
-		$row = $dbConnection->selectRow( 'page', '*', [
190
+		$row = $dbConnection->selectRow('page', '*', [
191 191
 			'page_title' => $title->getDBkey(),
192 192
 			'page_namespace' => $title->getNamespace()
193
-		] );
193
+		]);
194 194
 
195 195
 		return $row !== false;
196 196
 	}
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return bool
202 202
 	 */
203
-	private function commonsLinkIsWellFormed( $commonsLink ) {
204
-		$toReplace = [ "_", "%20" ];
205
-		$compareString = trim( str_replace( $toReplace, '', $commonsLink ) );
203
+	private function commonsLinkIsWellFormed($commonsLink) {
204
+		$toReplace = ["_", "%20"];
205
+		$compareString = trim(str_replace($toReplace, '', $commonsLink));
206 206
 		return $commonsLink === $compareString;
207 207
 	}
208 208
 
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return bool
217 217
 	 */
218
-	private function valueIncludesNamespace( $value, $namespace ) {
218
+	private function valueIncludesNamespace($value, $namespace) {
219 219
 		return $namespace !== '' &&
220
-			strncasecmp( $value, $namespace . ':', strlen( $namespace ) + 1 ) === 0;
220
+			strncasecmp($value, $namespace.':', strlen($namespace) + 1) === 0;
221 221
 	}
222 222
 
223 223
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ValueOnlyChecker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 		];
36 36
 	}
37 37
 
38
-	public function checkConstraint( Context $context, Constraint $constraint ) {
39
-		if ( $context->getType() === Context::TYPE_STATEMENT ) {
40
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
38
+	public function checkConstraint(Context $context, Constraint $constraint) {
39
+		if ($context->getType() === Context::TYPE_STATEMENT) {
40
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
41 41
 		} else {
42
-			$message = wfMessage( 'wbqc-violation-message-valueOnly' )->escaped();
43
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
42
+			$message = wfMessage('wbqc-violation-message-valueOnly')->escaped();
43
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
44 44
 		}
45 45
 	}
46 46
 
47
-	public function checkConstraintParameters( Constraint $constraint ) {
47
+	public function checkConstraintParameters(Constraint $constraint) {
48 48
 		// no parameters
49 49
 		return [];
50 50
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/TypeChecker.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -83,34 +83,34 @@  discard block
 block discarded – undo
83 83
 	 * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs
84 84
 	 * @return CheckResult
85 85
 	 */
86
-	public function checkConstraint( Context $context, Constraint $constraint ) {
87
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
88
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
86
+	public function checkConstraint(Context $context, Constraint $constraint) {
87
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
88
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
89 89
 		}
90
-		if ( $context->getType() === Context::TYPE_REFERENCE ) {
91
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE );
90
+		if ($context->getType() === Context::TYPE_REFERENCE) {
91
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE);
92 92
 		}
93 93
 
94 94
 		$parameters = [];
95 95
 		$constraintParameters = $constraint->getConstraintParameters();
96 96
 
97
-		$classes = $this->constraintParameterParser->parseClassParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
97
+		$classes = $this->constraintParameterParser->parseClassParameter($constraintParameters, $constraint->getConstraintTypeItemId());
98 98
 		$parameters['class'] = array_map(
99
-			function( $id ) {
100
-				return new ItemId( $id );
99
+			function($id) {
100
+				return new ItemId($id);
101 101
 			},
102 102
 			$classes
103 103
 		);
104 104
 
105
-		$relation = $this->constraintParameterParser->parseRelationParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
105
+		$relation = $this->constraintParameterParser->parseRelationParameter($constraintParameters, $constraint->getConstraintTypeItemId());
106 106
 		$relationIds = [];
107
-		if ( $relation === 'instance' || $relation === 'instanceOrSubclass' ) {
108
-			$relationIds[] = $this->config->get( 'WBQualityConstraintsInstanceOfId' );
107
+		if ($relation === 'instance' || $relation === 'instanceOrSubclass') {
108
+			$relationIds[] = $this->config->get('WBQualityConstraintsInstanceOfId');
109 109
 		}
110
-		if ( $relation === 'subclass' || $relation === 'instanceOrSubclass' ) {
111
-			$relationIds[] = $this->config->get( 'WBQualityConstraintsSubclassOfId' );
110
+		if ($relation === 'subclass' || $relation === 'instanceOrSubclass') {
111
+			$relationIds[] = $this->config->get('WBQualityConstraintsSubclassOfId');
112 112
 		}
113
-		$parameters['relation'] = [ $relation ];
113
+		$parameters['relation'] = [$relation];
114 114
 
115 115
 		$result = $this->typeCheckerHelper->hasClassInRelation(
116 116
 			$context->getEntity()->getStatements(),
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 			$classes
119 119
 		);
120 120
 
121
-		if ( $result->getBool() ) {
121
+		if ($result->getBool()) {
122 122
 			$message = null;
123 123
 			$status = CheckResult::STATUS_COMPLIANCE;
124 124
 		} else {
@@ -132,21 +132,21 @@  discard block
 block discarded – undo
132 132
 			$status = CheckResult::STATUS_VIOLATION;
133 133
 		}
134 134
 
135
-		return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) )
136
-			->withMetadata( $result->getMetadata() );
135
+		return (new CheckResult($context, $constraint, $parameters, $status, $message))
136
+			->withMetadata($result->getMetadata());
137 137
 	}
138 138
 
139
-	public function checkConstraintParameters( Constraint $constraint ) {
139
+	public function checkConstraintParameters(Constraint $constraint) {
140 140
 		$constraintParameters = $constraint->getConstraintParameters();
141 141
 		$exceptions = [];
142 142
 		try {
143
-			$this->constraintParameterParser->parseClassParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
144
-		} catch ( ConstraintParameterException $e ) {
143
+			$this->constraintParameterParser->parseClassParameter($constraintParameters, $constraint->getConstraintTypeItemId());
144
+		} catch (ConstraintParameterException $e) {
145 145
 			$exceptions[] = $e;
146 146
 		}
147 147
 		try {
148
-			$this->constraintParameterParser->parseRelationParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
149
-		} catch ( ConstraintParameterException $e ) {
148
+			$this->constraintParameterParser->parseRelationParameter($constraintParameters, $constraint->getConstraintTypeItemId());
149
+		} catch (ConstraintParameterException $e) {
150 150
 			$exceptions[] = $e;
151 151
 		}
152 152
 		return $exceptions;
Please login to merge, or discard this patch.