Completed
Push — master ( 4c99e1...c2d5c6 )
by
unknown
02:15 queued 11s
created
src/ConstraintCheck/Helper/TypeCheckerHelper.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
 	 * @return bool
81 81
 	 * @throws OverflowException if $entitiesChecked exceeds the configured limit
82 82
 	 */
83
-	private function isSubclassOf( EntityId $comparativeClass, array $classesToCheck, &$entitiesChecked = 0 ) {
84
-		$maxEntities = $this->config->get( 'WBQualityConstraintsTypeCheckMaxEntities' );
83
+	private function isSubclassOf(EntityId $comparativeClass, array $classesToCheck, &$entitiesChecked = 0) {
84
+		$maxEntities = $this->config->get('WBQualityConstraintsTypeCheckMaxEntities');
85 85
 		if ( ++$entitiesChecked > $maxEntities ) {
86
-			throw new OverflowException( 'Too many entities to check' );
86
+			throw new OverflowException('Too many entities to check');
87 87
 		}
88 88
 
89
-		$item = $this->entityLookup->getEntity( $comparativeClass );
90
-		if ( !( $item instanceof StatementListProvider ) ) {
89
+		$item = $this->entityLookup->getEntity($comparativeClass);
90
+		if (!($item instanceof StatementListProvider)) {
91 91
 			return false; // lookup failed, probably because item doesn't exist
92 92
 		}
93 93
 
94
-		$subclassId = $this->config->get( 'WBQualityConstraintsSubclassOfId' );
94
+		$subclassId = $this->config->get('WBQualityConstraintsSubclassOfId');
95 95
 		/** @var Statement $statement */
96
-		foreach ( $item->getStatements()->getByPropertyId( new PropertyId( $subclassId ) ) as $statement ) {
96
+		foreach ($item->getStatements()->getByPropertyId(new PropertyId($subclassId)) as $statement) {
97 97
 			$mainSnak = $statement->getMainSnak();
98 98
 
99
-			if ( !$this->hasCorrectType( $mainSnak ) ||
100
-				$statement->getRank() === Statement::RANK_DEPRECATED ) {
99
+			if (!$this->hasCorrectType($mainSnak) ||
100
+				$statement->getRank() === Statement::RANK_DEPRECATED) {
101 101
 				continue;
102 102
 			}
103 103
 			/** @var PropertyValueSnak $mainSnak */
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 			'@phan-var EntityIdValue $dataValue';
108 108
 			$comparativeClass = $dataValue->getEntityId();
109 109
 
110
-			if ( in_array( $comparativeClass->getSerialization(), $classesToCheck ) ) {
110
+			if (in_array($comparativeClass->getSerialization(), $classesToCheck)) {
111 111
 				return true;
112 112
 			}
113 113
 
114
-			if ( $this->isSubclassOf( $comparativeClass, $classesToCheck, $entitiesChecked ) ) {
114
+			if ($this->isSubclassOf($comparativeClass, $classesToCheck, $entitiesChecked)) {
115 115
 				return true;
116 116
 			}
117 117
 		}
@@ -132,48 +132,48 @@  discard block
 block discarded – undo
132 132
 	 * @return CachedBool
133 133
 	 * @throws SparqlHelperException if SPARQL is used and the query times out or some other error occurs
134 134
 	 */
135
-	public function isSubclassOfWithSparqlFallback( EntityId $comparativeClass, array $classesToCheck ) {
135
+	public function isSubclassOfWithSparqlFallback(EntityId $comparativeClass, array $classesToCheck) {
136 136
 		try {
137 137
 			$entitiesChecked = 0;
138
-			$start1 = microtime( true );
139
-			$isSubclass = $this->isSubclassOf( $comparativeClass, $classesToCheck, $entitiesChecked );
140
-			$end1 = microtime( true );
138
+			$start1 = microtime(true);
139
+			$isSubclass = $this->isSubclassOf($comparativeClass, $classesToCheck, $entitiesChecked);
140
+			$end1 = microtime(true);
141 141
 			$this->dataFactory->timing(
142 142
 				'wikibase.quality.constraints.type.php.success.timing',
143
-				( $end1 - $start1 ) * 1000
143
+				($end1 - $start1) * 1000
144 144
 			);
145 145
 			$this->dataFactory->timing( // not really a timing, but works like one (we want percentiles etc.)
146 146
 				'wikibase.quality.constraints.type.php.success.entities',
147 147
 				$entitiesChecked
148 148
 			);
149 149
 
150
-			return new CachedBool( $isSubclass, Metadata::blank() );
151
-		} catch ( OverflowException $e ) {
152
-			$end1 = microtime( true );
150
+			return new CachedBool($isSubclass, Metadata::blank());
151
+		} catch (OverflowException $e) {
152
+			$end1 = microtime(true);
153 153
 			$this->dataFactory->timing(
154 154
 				'wikibase.quality.constraints.type.php.overflow.timing',
155
-				( $end1 - $start1 ) * 1000
155
+				($end1 - $start1) * 1000
156 156
 			);
157 157
 
158
-			if ( !( $this->sparqlHelper instanceof DummySparqlHelper ) ) {
158
+			if (!($this->sparqlHelper instanceof DummySparqlHelper)) {
159 159
 				$this->dataFactory->increment(
160 160
 					'wikibase.quality.constraints.sparql.typeFallback'
161 161
 				);
162 162
 
163
-				$start2 = microtime( true );
163
+				$start2 = microtime(true);
164 164
 				$hasType = $this->sparqlHelper->hasType(
165 165
 					$comparativeClass->getSerialization(),
166 166
 					$classesToCheck
167 167
 				);
168
-				$end2 = microtime( true );
168
+				$end2 = microtime(true);
169 169
 				$this->dataFactory->timing(
170 170
 					'wikibase.quality.constraints.type.sparql.success.timing',
171
-					( $end2 - $start2 ) * 1000
171
+					($end2 - $start2) * 1000
172 172
 				);
173 173
 
174 174
 				return $hasType;
175 175
 			} else {
176
-				return new CachedBool( false, Metadata::blank() );
176
+				return new CachedBool(false, Metadata::blank());
177 177
 			}
178 178
 		}
179 179
 	}
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 	 * @return CachedBool
192 192
 	 * @throws SparqlHelperException if SPARQL is used and the query times out or some other error occurs
193 193
 	 */
194
-	public function hasClassInRelation( StatementList $statements, array $relationIds, array $classesToCheck ) {
194
+	public function hasClassInRelation(StatementList $statements, array $relationIds, array $classesToCheck) {
195 195
 		$metadatas = [];
196 196
 
197
-		foreach ( $this->getStatementsByPropertyIds( $statements, $relationIds ) as $statement ) {
197
+		foreach ($this->getStatementsByPropertyIds($statements, $relationIds) as $statement) {
198 198
 			$mainSnak = $statement->getMainSnak();
199 199
 
200
-			if ( !$this->hasCorrectType( $mainSnak ) ||
201
-				$statement->getRank() === Statement::RANK_DEPRECATED ) {
200
+			if (!$this->hasCorrectType($mainSnak) ||
201
+				$statement->getRank() === Statement::RANK_DEPRECATED) {
202 202
 				continue;
203 203
 			}
204 204
 			/** @var PropertyValueSnak $mainSnak */
@@ -208,24 +208,24 @@  discard block
 block discarded – undo
208 208
 			'@phan-var EntityIdValue $dataValue';
209 209
 			$comparativeClass = $dataValue->getEntityId();
210 210
 
211
-			if ( in_array( $comparativeClass->getSerialization(), $classesToCheck ) ) {
211
+			if (in_array($comparativeClass->getSerialization(), $classesToCheck)) {
212 212
 				// discard $metadatas, we know this is fresh
213
-				return new CachedBool( true, Metadata::blank() );
213
+				return new CachedBool(true, Metadata::blank());
214 214
 			}
215 215
 
216
-			$result = $this->isSubclassOfWithSparqlFallback( $comparativeClass, $classesToCheck );
216
+			$result = $this->isSubclassOfWithSparqlFallback($comparativeClass, $classesToCheck);
217 217
 			$metadatas[] = $result->getMetadata();
218
-			if ( $result->getBool() ) {
218
+			if ($result->getBool()) {
219 219
 				return new CachedBool(
220 220
 					true,
221
-					Metadata::merge( $metadatas )
221
+					Metadata::merge($metadatas)
222 222
 				);
223 223
 			}
224 224
 		}
225 225
 
226 226
 		return new CachedBool(
227 227
 			false,
228
-			Metadata::merge( $metadatas )
228
+			Metadata::merge($metadatas)
229 229
 		);
230 230
 	}
231 231
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 * @return bool
235 235
 	 * @phan-assert PropertyValueSnak $mainSnak
236 236
 	 */
237
-	private function hasCorrectType( Snak $mainSnak ) {
237
+	private function hasCorrectType(Snak $mainSnak) {
238 238
 		return $mainSnak instanceof PropertyValueSnak
239 239
 			&& $mainSnak->getDataValue()->getType() === 'wikibase-entityid';
240 240
 	}
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
 	) {
252 252
 		$statementArrays = [];
253 253
 
254
-		foreach ( $propertyIdSerializations as $propertyIdSerialization ) {
255
-			$propertyId = new PropertyId( $propertyIdSerialization );
256
-			$statementArrays[] = $statements->getByPropertyId( $propertyId )->toArray();
254
+		foreach ($propertyIdSerializations as $propertyIdSerialization) {
255
+			$propertyId = new PropertyId($propertyIdSerialization);
256
+			$statementArrays[] = $statements->getByPropertyId($propertyId)->toArray();
257 257
 		}
258 258
 
259
-		return call_user_func_array( 'array_merge', $statementArrays );
259
+		return call_user_func_array('array_merge', $statementArrays);
260 260
 	}
261 261
 
262 262
 	/**
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
 	 *
269 269
 	 * @return ViolationMessage
270 270
 	 */
271
-	public function getViolationMessage( PropertyId $propertyId, EntityId $entityId, array $classes, $checker, $relation ) {
271
+	public function getViolationMessage(PropertyId $propertyId, EntityId $entityId, array $classes, $checker, $relation) {
272 272
 		$classes = array_map(
273
-			static function ( $itemIdSerialization ) {
274
-				return new ItemId( $itemIdSerialization );
273
+			static function($itemIdSerialization) {
274
+				return new ItemId($itemIdSerialization);
275 275
 			},
276 276
 			$classes
277 277
 		);
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
 		// wbqc-violation-message-valueType-instance
284 284
 		// wbqc-violation-message-valueType-subclass
285 285
 		// wbqc-violation-message-valueType-instanceOrSubclass
286
-		return ( new ViolationMessage( 'wbqc-violation-message-' . $checker . '-' . $relation ) )
287
-			->withEntityId( $propertyId, Role::CONSTRAINT_PROPERTY )
288
-			->withEntityId( $entityId, Role::SUBJECT )
289
-			->withEntityIdList( $classes, Role::OBJECT );
286
+		return (new ViolationMessage('wbqc-violation-message-'.$checker.'-'.$relation))
287
+			->withEntityId($propertyId, Role::CONSTRAINT_PROPERTY)
288
+			->withEntityId($entityId, Role::SUBJECT)
289
+			->withEntityIdList($classes, Role::OBJECT);
290 290
 	}
291 291
 
292 292
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/DelegatingConstraintChecker.php 1 patch
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 		callable $defaultResultsPerEntity = null
144 144
 	) {
145 145
 		$checkResults = [];
146
-		$entity = $this->entityLookup->getEntity( $entityId );
146
+		$entity = $this->entityLookup->getEntity($entityId);
147 147
 
148
-		if ( $entity instanceof StatementListProvidingEntity ) {
149
-			$startTime = microtime( true );
148
+		if ($entity instanceof StatementListProvidingEntity) {
149
+			$startTime = microtime(true);
150 150
 
151 151
 			$checkResults = $this->checkEveryStatement(
152 152
 				$entity,
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 				$defaultResultsPerContext
155 155
 			);
156 156
 
157
-			$endTime = microtime( true );
157
+			$endTime = microtime(true);
158 158
 
159
-			if ( $constraintIds === null ) { // only log full constraint checks
159
+			if ($constraintIds === null) { // only log full constraint checks
160 160
 				$this->loggingHelper->logConstraintCheckOnEntity(
161 161
 					$entityId,
162 162
 					$checkResults,
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
 			}
167 167
 		}
168 168
 
169
-		if ( $defaultResultsPerEntity !== null ) {
170
-			$checkResults = array_merge( $defaultResultsPerEntity( $entityId ), $checkResults );
169
+		if ($defaultResultsPerEntity !== null) {
170
+			$checkResults = array_merge($defaultResultsPerEntity($entityId), $checkResults);
171 171
 		}
172 172
 
173
-		return $this->sortResult( $checkResults );
173
+		return $this->sortResult($checkResults);
174 174
 	}
175 175
 
176 176
 	/**
@@ -192,19 +192,19 @@  discard block
 block discarded – undo
192 192
 		callable $defaultResults = null
193 193
 	) {
194 194
 
195
-		$parsedGuid = $this->statementGuidParser->parse( $guid );
195
+		$parsedGuid = $this->statementGuidParser->parse($guid);
196 196
 		$entityId = $parsedGuid->getEntityId();
197
-		$entity = $this->entityLookup->getEntity( $entityId );
198
-		if ( $entity instanceof StatementListProvidingEntity ) {
199
-			$statement = $entity->getStatements()->getFirstStatementWithGuid( $guid );
200
-			if ( $statement ) {
197
+		$entity = $this->entityLookup->getEntity($entityId);
198
+		if ($entity instanceof StatementListProvidingEntity) {
199
+			$statement = $entity->getStatements()->getFirstStatementWithGuid($guid);
200
+			if ($statement) {
201 201
 				$result = $this->checkStatement(
202 202
 					$entity,
203 203
 					$statement,
204 204
 					$constraintIds,
205 205
 					$defaultResults
206 206
 				);
207
-				$output = $this->sortResult( $result );
207
+				$output = $this->sortResult($result);
208 208
 				return $output;
209 209
 			}
210 210
 		}
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 		return [];
213 213
 	}
214 214
 
215
-	private function getAllowedContextTypes( Constraint $constraint ) {
216
-		if ( !array_key_exists( $constraint->getConstraintTypeItemId(), $this->checkerMap ) ) {
215
+	private function getAllowedContextTypes(Constraint $constraint) {
216
+		if (!array_key_exists($constraint->getConstraintTypeItemId(), $this->checkerMap)) {
217 217
 			return [
218 218
 				Context::TYPE_STATEMENT,
219 219
 				Context::TYPE_QUALIFIER,
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
 			];
222 222
 		}
223 223
 
224
-		return array_keys( array_filter(
224
+		return array_keys(array_filter(
225 225
 			$this->checkerMap[$constraint->getConstraintTypeItemId()]->getSupportedContextTypes(),
226
-			static function ( $resultStatus ) {
226
+			static function($resultStatus) {
227 227
 				return $resultStatus !== CheckResult::STATUS_NOT_IN_SCOPE;
228 228
 			}
229
-		) );
229
+		));
230 230
 	}
231 231
 
232 232
 	/**
@@ -237,32 +237,32 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return ConstraintParameterException[]
239 239
 	 */
240
-	private function checkCommonConstraintParameters( Constraint $constraint ) {
240
+	private function checkCommonConstraintParameters(Constraint $constraint) {
241 241
 		$constraintParameters = $constraint->getConstraintParameters();
242 242
 		try {
243
-			$this->constraintParameterParser->checkError( $constraintParameters );
244
-		} catch ( ConstraintParameterException $e ) {
245
-			return [ $e ];
243
+			$this->constraintParameterParser->checkError($constraintParameters);
244
+		} catch (ConstraintParameterException $e) {
245
+			return [$e];
246 246
 		}
247 247
 
248 248
 		$problems = [];
249 249
 		try {
250
-			$this->constraintParameterParser->parseExceptionParameter( $constraintParameters );
251
-		} catch ( ConstraintParameterException $e ) {
250
+			$this->constraintParameterParser->parseExceptionParameter($constraintParameters);
251
+		} catch (ConstraintParameterException $e) {
252 252
 			$problems[] = $e;
253 253
 		}
254 254
 		try {
255
-			$this->constraintParameterParser->parseConstraintStatusParameter( $constraintParameters );
256
-		} catch ( ConstraintParameterException $e ) {
255
+			$this->constraintParameterParser->parseConstraintStatusParameter($constraintParameters);
256
+		} catch (ConstraintParameterException $e) {
257 257
 			$problems[] = $e;
258 258
 		}
259 259
 		try {
260 260
 			$this->constraintParameterParser->parseConstraintScopeParameter(
261 261
 				$constraintParameters,
262 262
 				$constraint->getConstraintTypeItemId(),
263
-				$this->getAllowedContextTypes( $constraint )
263
+				$this->getAllowedContextTypes($constraint)
264 264
 			);
265
-		} catch ( ConstraintParameterException $e ) {
265
+		} catch (ConstraintParameterException $e) {
266 266
 			$problems[] = $e;
267 267
 		}
268 268
 		return $problems;
@@ -275,16 +275,16 @@  discard block
 block discarded – undo
275 275
 	 * @return ConstraintParameterException[][] first level indexed by constraint ID,
276 276
 	 * second level like checkConstraintParametersOnConstraintId (but without possibility of null)
277 277
 	 */
278
-	public function checkConstraintParametersOnPropertyId( PropertyId $propertyId ) {
279
-		$constraints = $this->constraintLookup->queryConstraintsForProperty( $propertyId );
278
+	public function checkConstraintParametersOnPropertyId(PropertyId $propertyId) {
279
+		$constraints = $this->constraintLookup->queryConstraintsForProperty($propertyId);
280 280
 		$result = [];
281 281
 
282
-		foreach ( $constraints as $constraint ) {
283
-			$problems = $this->checkCommonConstraintParameters( $constraint );
282
+		foreach ($constraints as $constraint) {
283
+			$problems = $this->checkCommonConstraintParameters($constraint);
284 284
 
285
-			if ( array_key_exists( $constraint->getConstraintTypeItemId(), $this->checkerMap ) ) {
285
+			if (array_key_exists($constraint->getConstraintTypeItemId(), $this->checkerMap)) {
286 286
 				$checker = $this->checkerMap[$constraint->getConstraintTypeItemId()];
287
-				$problems = array_merge( $problems, $checker->checkConstraintParameters( $constraint ) );
287
+				$problems = array_merge($problems, $checker->checkConstraintParameters($constraint));
288 288
 			}
289 289
 
290 290
 			$result[$constraint->getConstraintId()] = $problems;
@@ -301,18 +301,18 @@  discard block
 block discarded – undo
301 301
 	 * @return ConstraintParameterException[]|null list of constraint parameter exceptions
302 302
 	 * (empty means all parameters okay), or null if constraint is not found
303 303
 	 */
304
-	public function checkConstraintParametersOnConstraintId( $constraintId ) {
305
-		$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
304
+	public function checkConstraintParametersOnConstraintId($constraintId) {
305
+		$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
306 306
 		'@phan-var PropertyId $propertyId';
307
-		$constraints = $this->constraintLookup->queryConstraintsForProperty( $propertyId );
307
+		$constraints = $this->constraintLookup->queryConstraintsForProperty($propertyId);
308 308
 
309
-		foreach ( $constraints as $constraint ) {
310
-			if ( $constraint->getConstraintId() === $constraintId ) {
311
-				$problems = $this->checkCommonConstraintParameters( $constraint );
309
+		foreach ($constraints as $constraint) {
310
+			if ($constraint->getConstraintId() === $constraintId) {
311
+				$problems = $this->checkCommonConstraintParameters($constraint);
312 312
 
313
-				if ( array_key_exists( $constraint->getConstraintTypeItemId(), $this->checkerMap ) ) {
313
+				if (array_key_exists($constraint->getConstraintTypeItemId(), $this->checkerMap)) {
314 314
 					$checker = $this->checkerMap[$constraint->getConstraintTypeItemId()];
315
-					$problems = array_merge( $problems, $checker->checkConstraintParameters( $constraint ) );
315
+					$problems = array_merge($problems, $checker->checkConstraintParameters($constraint));
316 316
 				}
317 317
 
318 318
 				return $problems;
@@ -337,14 +337,14 @@  discard block
 block discarded – undo
337 337
 		$result = [];
338 338
 
339 339
 		/** @var Statement $statement */
340
-		foreach ( $entity->getStatements() as $statement ) {
341
-			$result = array_merge( $result,
340
+		foreach ($entity->getStatements() as $statement) {
341
+			$result = array_merge($result,
342 342
 				$this->checkStatement(
343 343
 					$entity,
344 344
 					$statement,
345 345
 					$constraintIds,
346 346
 					$defaultResultsPerContext
347
-				) );
347
+				));
348 348
 		}
349 349
 
350 350
 		return $result;
@@ -366,32 +366,32 @@  discard block
 block discarded – undo
366 366
 	) {
367 367
 		$result = [];
368 368
 
369
-		$result = array_merge( $result,
369
+		$result = array_merge($result,
370 370
 			$this->checkConstraintsForMainSnak(
371 371
 				$entity,
372 372
 				$statement,
373 373
 				$constraintIds,
374 374
 				$defaultResultsPerContext
375
-			) );
375
+			));
376 376
 
377
-		if ( $this->checkQualifiers ) {
378
-			$result = array_merge( $result,
377
+		if ($this->checkQualifiers) {
378
+			$result = array_merge($result,
379 379
 				$this->checkConstraintsForQualifiers(
380 380
 					$entity,
381 381
 					$statement,
382 382
 					$constraintIds,
383 383
 					$defaultResultsPerContext
384
-				) );
384
+				));
385 385
 		}
386 386
 
387
-		if ( $this->checkReferences ) {
388
-			$result = array_merge( $result,
387
+		if ($this->checkReferences) {
388
+			$result = array_merge($result,
389 389
 				$this->checkConstraintsForReferences(
390 390
 					$entity,
391 391
 					$statement,
392 392
 					$constraintIds,
393 393
 					$defaultResultsPerContext
394
-				) );
394
+				));
395 395
 		}
396 396
 
397 397
 		return $result;
@@ -406,12 +406,12 @@  discard block
 block discarded – undo
406 406
 	 * @param string[]|null $constraintIds
407 407
 	 * @return Constraint[]
408 408
 	 */
409
-	private function getConstraintsToUse( PropertyId $propertyId, array $constraintIds = null ) {
410
-		$constraints = $this->constraintLookup->queryConstraintsForProperty( $propertyId );
411
-		if ( $constraintIds !== null ) {
409
+	private function getConstraintsToUse(PropertyId $propertyId, array $constraintIds = null) {
410
+		$constraints = $this->constraintLookup->queryConstraintsForProperty($propertyId);
411
+		if ($constraintIds !== null) {
412 412
 			$constraintsToUse = [];
413
-			foreach ( $constraints as $constraint ) {
414
-				if ( in_array( $constraint->getConstraintId(), $constraintIds ) ) {
413
+			foreach ($constraints as $constraint) {
414
+				if (in_array($constraint->getConstraintId(), $constraintIds)) {
415 415
 					$constraintsToUse[] = $constraint;
416 416
 				}
417 417
 			}
@@ -435,18 +435,18 @@  discard block
 block discarded – undo
435 435
 		array $constraintIds = null,
436 436
 		callable $defaultResults = null
437 437
 	) {
438
-		$context = new MainSnakContext( $entity, $statement );
438
+		$context = new MainSnakContext($entity, $statement);
439 439
 		$constraints = $this->getConstraintsToUse(
440 440
 			$statement->getPropertyId(),
441 441
 			$constraintIds
442 442
 		);
443
-		$result = $defaultResults !== null ? $defaultResults( $context ) : [];
443
+		$result = $defaultResults !== null ? $defaultResults($context) : [];
444 444
 
445
-		foreach ( $constraints as $constraint ) {
445
+		foreach ($constraints as $constraint) {
446 446
 			$parameters = $constraint->getConstraintParameters();
447 447
 			try {
448
-				$exceptions = $this->constraintParameterParser->parseExceptionParameter( $parameters );
449
-			} catch ( ConstraintParameterException $e ) {
448
+				$exceptions = $this->constraintParameterParser->parseExceptionParameter($parameters);
449
+			} catch (ConstraintParameterException $e) {
450 450
 				$result[] = new CheckResult(
451 451
 					$context,
452 452
 					$constraint,
@@ -456,13 +456,13 @@  discard block
 block discarded – undo
456 456
 				continue;
457 457
 			}
458 458
 
459
-			if ( in_array( $entity->getId(), $exceptions ) ) {
460
-				$message = new ViolationMessage( 'wbqc-violation-message-exception' );
461
-				$result[] = new CheckResult( $context, $constraint, [], CheckResult::STATUS_EXCEPTION, $message );
459
+			if (in_array($entity->getId(), $exceptions)) {
460
+				$message = new ViolationMessage('wbqc-violation-message-exception');
461
+				$result[] = new CheckResult($context, $constraint, [], CheckResult::STATUS_EXCEPTION, $message);
462 462
 				continue;
463 463
 			}
464 464
 
465
-			$result[] = $this->getCheckResultFor( $context, $constraint );
465
+			$result[] = $this->getCheckResultFor($context, $constraint);
466 466
 		}
467 467
 
468 468
 		return $result;
@@ -484,24 +484,24 @@  discard block
 block discarded – undo
484 484
 	) {
485 485
 		$result = [];
486 486
 
487
-		if ( in_array(
487
+		if (in_array(
488 488
 			$statement->getPropertyId()->getSerialization(),
489 489
 			$this->propertiesWithViolatingQualifiers
490
-		) ) {
490
+		)) {
491 491
 			return $result;
492 492
 		}
493 493
 
494
-		foreach ( $statement->getQualifiers() as $qualifier ) {
495
-			$qualifierContext = new QualifierContext( $entity, $statement, $qualifier );
496
-			if ( $defaultResultsPerContext !== null ) {
497
-				$result = array_merge( $result, $defaultResultsPerContext( $qualifierContext ) );
494
+		foreach ($statement->getQualifiers() as $qualifier) {
495
+			$qualifierContext = new QualifierContext($entity, $statement, $qualifier);
496
+			if ($defaultResultsPerContext !== null) {
497
+				$result = array_merge($result, $defaultResultsPerContext($qualifierContext));
498 498
 			}
499 499
 			$qualifierConstraints = $this->getConstraintsToUse(
500 500
 				$qualifierContext->getSnak()->getPropertyId(),
501 501
 				$constraintIds
502 502
 			);
503
-			foreach ( $qualifierConstraints as $qualifierConstraint ) {
504
-				$result[] = $this->getCheckResultFor( $qualifierContext, $qualifierConstraint );
503
+			foreach ($qualifierConstraints as $qualifierConstraint) {
504
+				$result[] = $this->getCheckResultFor($qualifierContext, $qualifierConstraint);
505 505
 			}
506 506
 		}
507 507
 
@@ -525,19 +525,19 @@  discard block
 block discarded – undo
525 525
 		$result = [];
526 526
 
527 527
 		/** @var Reference $reference */
528
-		foreach ( $statement->getReferences() as $reference ) {
529
-			foreach ( $reference->getSnaks() as $snak ) {
528
+		foreach ($statement->getReferences() as $reference) {
529
+			foreach ($reference->getSnaks() as $snak) {
530 530
 				$referenceContext = new ReferenceContext(
531 531
 					$entity, $statement, $reference, $snak
532 532
 				);
533
-				if ( $defaultResultsPerContext !== null ) {
534
-					$result = array_merge( $result, $defaultResultsPerContext( $referenceContext ) );
533
+				if ($defaultResultsPerContext !== null) {
534
+					$result = array_merge($result, $defaultResultsPerContext($referenceContext));
535 535
 				}
536 536
 				$referenceConstraints = $this->getConstraintsToUse(
537 537
 					$referenceContext->getSnak()->getPropertyId(),
538 538
 					$constraintIds
539 539
 				);
540
-				foreach ( $referenceConstraints as $referenceConstraint ) {
540
+				foreach ($referenceConstraints as $referenceConstraint) {
541 541
 					$result[] = $this->getCheckResultFor(
542 542
 						$referenceContext,
543 543
 						$referenceConstraint
@@ -556,20 +556,20 @@  discard block
 block discarded – undo
556 556
 	 * @throws InvalidArgumentException
557 557
 	 * @return CheckResult
558 558
 	 */
559
-	private function getCheckResultFor( Context $context, Constraint $constraint ) {
560
-		if ( array_key_exists( $constraint->getConstraintTypeItemId(), $this->checkerMap ) ) {
559
+	private function getCheckResultFor(Context $context, Constraint $constraint) {
560
+		if (array_key_exists($constraint->getConstraintTypeItemId(), $this->checkerMap)) {
561 561
 			$checker = $this->checkerMap[$constraint->getConstraintTypeItemId()];
562
-			$result = $this->handleScope( $checker, $context, $constraint );
562
+			$result = $this->handleScope($checker, $context, $constraint);
563 563
 
564
-			if ( $result !== null ) {
565
-				$this->addMetadata( $context, $result );
564
+			if ($result !== null) {
565
+				$this->addMetadata($context, $result);
566 566
 				return $result;
567 567
 			}
568 568
 
569
-			$startTime = microtime( true );
569
+			$startTime = microtime(true);
570 570
 			try {
571
-				$result = $checker->checkConstraint( $context, $constraint );
572
-			} catch ( ConstraintParameterException $e ) {
571
+				$result = $checker->checkConstraint($context, $constraint);
572
+			} catch (ConstraintParameterException $e) {
573 573
 				$result = new CheckResult(
574 574
 					$context,
575 575
 					$constraint,
@@ -577,28 +577,28 @@  discard block
 block discarded – undo
577 577
 					CheckResult::STATUS_BAD_PARAMETERS,
578 578
 					$e->getViolationMessage()
579 579
 				);
580
-			} catch ( SparqlHelperException $e ) {
581
-				$message = new ViolationMessage( 'wbqc-violation-message-sparql-error' );
582
-				$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_TODO, $message );
580
+			} catch (SparqlHelperException $e) {
581
+				$message = new ViolationMessage('wbqc-violation-message-sparql-error');
582
+				$result = new CheckResult($context, $constraint, [], CheckResult::STATUS_TODO, $message);
583 583
 			}
584
-			$endTime = microtime( true );
584
+			$endTime = microtime(true);
585 585
 
586
-			$this->addMetadata( $context, $result );
586
+			$this->addMetadata($context, $result);
587 587
 
588
-			$this->downgradeResultStatus( $context, $result );
588
+			$this->downgradeResultStatus($context, $result);
589 589
 
590 590
 			$this->loggingHelper->logConstraintCheck(
591 591
 				$context,
592 592
 				$constraint,
593 593
 				$result,
594
-				get_class( $checker ),
594
+				get_class($checker),
595 595
 				$endTime - $startTime,
596 596
 				__METHOD__
597 597
 			);
598 598
 
599 599
 			return $result;
600 600
 		} else {
601
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_TODO, null );
601
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_TODO, null);
602 602
 		}
603 603
 	}
604 604
 
@@ -612,61 +612,61 @@  discard block
 block discarded – undo
612 612
 				$constraint->getConstraintParameters(),
613 613
 				$constraint->getConstraintTypeItemId()
614 614
 			);
615
-		} catch ( ConstraintParameterException $e ) {
616
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage() );
615
+		} catch (ConstraintParameterException $e) {
616
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage());
617 617
 		}
618
-		if ( $checkedContextTypes === null ) {
618
+		if ($checkedContextTypes === null) {
619 619
 			$checkedContextTypes = $checker->getDefaultContextTypes();
620 620
 		}
621
-		if ( !in_array( $context->getType(), $checkedContextTypes ) ) {
622
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE, null );
621
+		if (!in_array($context->getType(), $checkedContextTypes)) {
622
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE, null);
623 623
 		}
624
-		if ( $checker->getSupportedContextTypes()[$context->getType()] === CheckResult::STATUS_TODO ) {
625
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_TODO, null );
624
+		if ($checker->getSupportedContextTypes()[$context->getType()] === CheckResult::STATUS_TODO) {
625
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_TODO, null);
626 626
 		}
627 627
 		return null;
628 628
 	}
629 629
 
630
-	private function addMetadata( Context $context, CheckResult $result ) {
631
-		$result->withMetadata( Metadata::merge( [
630
+	private function addMetadata(Context $context, CheckResult $result) {
631
+		$result->withMetadata(Metadata::merge([
632 632
 			$result->getMetadata(),
633
-			Metadata::ofDependencyMetadata( DependencyMetadata::merge( [
634
-				DependencyMetadata::ofEntityId( $context->getEntity()->getId() ),
635
-				DependencyMetadata::ofEntityId( $result->getConstraint()->getPropertyId() ),
636
-			] ) ),
637
-		] ) );
633
+			Metadata::ofDependencyMetadata(DependencyMetadata::merge([
634
+				DependencyMetadata::ofEntityId($context->getEntity()->getId()),
635
+				DependencyMetadata::ofEntityId($result->getConstraint()->getPropertyId()),
636
+			])),
637
+		]));
638 638
 	}
639 639
 
640
-	private function downgradeResultStatus( Context $context, CheckResult &$result ) {
640
+	private function downgradeResultStatus(Context $context, CheckResult &$result) {
641 641
 		$constraint = $result->getConstraint();
642 642
 		try {
643 643
 			$constraintStatus = $this->constraintParameterParser
644
-				->parseConstraintStatusParameter( $constraint->getConstraintParameters() );
645
-		} catch ( ConstraintParameterException $e ) {
646
-			$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage() );
644
+				->parseConstraintStatusParameter($constraint->getConstraintParameters());
645
+		} catch (ConstraintParameterException $e) {
646
+			$result = new CheckResult($context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage());
647 647
 			$constraintStatus = null;
648 648
 		}
649
-		if ( $constraintStatus === null ) {
649
+		if ($constraintStatus === null) {
650 650
 			// downgrade violation to warning
651
-			if ( $result->getStatus() === CheckResult::STATUS_VIOLATION ) {
652
-				$result->setStatus( CheckResult::STATUS_WARNING );
651
+			if ($result->getStatus() === CheckResult::STATUS_VIOLATION) {
652
+				$result->setStatus(CheckResult::STATUS_WARNING);
653 653
 			}
654
-		} elseif ( $constraintStatus === 'suggestion' ) {
654
+		} elseif ($constraintStatus === 'suggestion') {
655 655
 			// downgrade violation to suggestion
656
-			if ( $result->getStatus() === CheckResult::STATUS_VIOLATION ) {
657
-				$result->setStatus( CheckResult::STATUS_SUGGESTION );
656
+			if ($result->getStatus() === CheckResult::STATUS_VIOLATION) {
657
+				$result->setStatus(CheckResult::STATUS_SUGGESTION);
658 658
 			}
659
-			$result->addParameter( 'constraint_status', $constraintStatus );
659
+			$result->addParameter('constraint_status', $constraintStatus);
660 660
 		} else {
661
-			if ( $constraintStatus !== 'mandatory' ) {
661
+			if ($constraintStatus !== 'mandatory') {
662 662
 				// @codeCoverageIgnoreStart
663 663
 				throw new LogicException(
664
-					"Unknown constraint status '$constraintStatus', " .
664
+					"Unknown constraint status '$constraintStatus', ".
665 665
 					"only known statuses are 'mandatory' and 'suggestion'"
666 666
 				);
667 667
 				// @codeCoverageIgnoreEnd
668 668
 			}
669
-			$result->addParameter( 'constraint_status', $constraintStatus );
669
+			$result->addParameter('constraint_status', $constraintStatus);
670 670
 		}
671 671
 	}
672 672
 
@@ -675,12 +675,12 @@  discard block
 block discarded – undo
675 675
 	 *
676 676
 	 * @return CheckResult[]
677 677
 	 */
678
-	private function sortResult( array $result ) {
679
-		if ( count( $result ) < 2 ) {
678
+	private function sortResult(array $result) {
679
+		if (count($result) < 2) {
680 680
 			return $result;
681 681
 		}
682 682
 
683
-		$sortFunction = static function ( CheckResult $a, CheckResult $b ) {
683
+		$sortFunction = static function(CheckResult $a, CheckResult $b) {
684 684
 			$orderNum = 0;
685 685
 			$order = [
686 686
 				CheckResult::STATUS_BAD_PARAMETERS => $orderNum++,
@@ -697,55 +697,55 @@  discard block
 block discarded – undo
697 697
 			$statusA = $a->getStatus();
698 698
 			$statusB = $b->getStatus();
699 699
 
700
-			$orderA = array_key_exists( $statusA, $order ) ? $order[ $statusA ] : $order[ 'other' ];
701
-			$orderB = array_key_exists( $statusB, $order ) ? $order[ $statusB ] : $order[ 'other' ];
700
+			$orderA = array_key_exists($statusA, $order) ? $order[$statusA] : $order['other'];
701
+			$orderB = array_key_exists($statusB, $order) ? $order[$statusB] : $order['other'];
702 702
 
703
-			if ( $orderA === $orderB ) {
703
+			if ($orderA === $orderB) {
704 704
 				$cursorA = $a->getContextCursor();
705 705
 				$cursorB = $b->getContextCursor();
706 706
 
707
-				if ( $cursorA instanceof EntityContextCursor ) {
707
+				if ($cursorA instanceof EntityContextCursor) {
708 708
 					return $cursorB instanceof EntityContextCursor ? 0 : -1;
709 709
 				}
710
-				if ( $cursorB instanceof EntityContextCursor ) {
710
+				if ($cursorB instanceof EntityContextCursor) {
711 711
 					return $cursorA instanceof EntityContextCursor ? 0 : 1;
712 712
 				}
713 713
 
714 714
 				$pidA = $cursorA->getSnakPropertyId();
715 715
 				$pidB = $cursorB->getSnakPropertyId();
716 716
 
717
-				if ( $pidA === $pidB ) {
717
+				if ($pidA === $pidB) {
718 718
 					$hashA = $cursorA->getSnakHash();
719 719
 					$hashB = $cursorB->getSnakHash();
720 720
 
721
-					if ( $hashA === $hashB ) {
722
-						if ( $a instanceof NullResult ) {
721
+					if ($hashA === $hashB) {
722
+						if ($a instanceof NullResult) {
723 723
 							return $b instanceof NullResult ? 0 : -1;
724 724
 						}
725
-						if ( $b instanceof NullResult ) {
725
+						if ($b instanceof NullResult) {
726 726
 							return $a instanceof NullResult ? 0 : 1;
727 727
 						}
728 728
 
729 729
 						$typeA = $a->getConstraint()->getConstraintTypeItemId();
730 730
 						$typeB = $b->getConstraint()->getConstraintTypeItemId();
731 731
 
732
-						if ( $typeA == $typeB ) {
732
+						if ($typeA == $typeB) {
733 733
 							return 0;
734 734
 						} else {
735
-							return ( $typeA > $typeB ) ? 1 : -1;
735
+							return ($typeA > $typeB) ? 1 : -1;
736 736
 						}
737 737
 					} else {
738
-						return ( $hashA > $hashB ) ? 1 : -1;
738
+						return ($hashA > $hashB) ? 1 : -1;
739 739
 					}
740 740
 				} else {
741
-					return ( $pidA > $pidB ) ? 1 : -1;
741
+					return ($pidA > $pidB) ? 1 : -1;
742 742
 				}
743 743
 			} else {
744
-				return ( $orderA > $orderB ) ? 1 : -1;
744
+				return ($orderA > $orderB) ? 1 : -1;
745 745
 			}
746 746
 		};
747 747
 
748
-		uasort( $result, $sortFunction );
748
+		uasort($result, $sortFunction);
749 749
 
750 750
 		return $result;
751 751
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Message/ViolationMessageRenderer.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
 	 * @param ViolationMessage $violationMessage
78 78
 	 * @return string
79 79
 	 */
80
-	public function render( ViolationMessage $violationMessage ) {
80
+	public function render(ViolationMessage $violationMessage) {
81 81
 		$messageKey = $violationMessage->getMessageKey();
82
-		$paramsLists = [ [] ];
83
-		foreach ( $violationMessage->getArguments() as $argument ) {
84
-			$params = $this->renderArgument( $argument );
82
+		$paramsLists = [[]];
83
+		foreach ($violationMessage->getArguments() as $argument) {
84
+			$params = $this->renderArgument($argument);
85 85
 			$paramsLists[] = $params;
86 86
 		}
87
-		$allParams = call_user_func_array( 'array_merge', $paramsLists );
87
+		$allParams = call_user_func_array('array_merge', $paramsLists);
88 88
 		return $this->messageLocalizer
89
-			->msg( $messageKey )
90
-			->params( $allParams )
89
+			->msg($messageKey)
90
+			->params($allParams)
91 91
 			->escaped();
92 92
 	}
93 93
 
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 	 * @param string|null $role one of the Role::* constants
97 97
 	 * @return string HTML
98 98
 	 */
99
-	protected function addRole( $value, $role ) {
100
-		if ( $role === null ) {
99
+	protected function addRole($value, $role) {
100
+		if ($role === null) {
101 101
 			return $value;
102 102
 		}
103 103
 
104
-		return '<span class="wbqc-role wbqc-role-' . htmlspecialchars( $role ) . '">' .
105
-			$value .
104
+		return '<span class="wbqc-role wbqc-role-'.htmlspecialchars($role).'">'.
105
+			$value.
106 106
 			'</span>';
107 107
 	}
108 108
 
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
 	 * @param string $key message key
111 111
 	 * @return string HTML
112 112
 	 */
113
-	protected function msgEscaped( $key ) {
114
-		return $this->messageLocalizer->msg( $key )->escaped();
113
+	protected function msgEscaped($key) {
114
+		return $this->messageLocalizer->msg($key)->escaped();
115 115
 	}
116 116
 
117 117
 	/**
118 118
 	 * @param array $argument
119 119
 	 * @return array[] params (for Message::params)
120 120
 	 */
121
-	protected function renderArgument( array $argument ) {
121
+	protected function renderArgument(array $argument) {
122 122
 		$methods = [
123 123
 			ViolationMessage::TYPE_ENTITY_ID => 'renderEntityId',
124 124
 			ViolationMessage::TYPE_ENTITY_ID_LIST => 'renderEntityIdList',
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 		$value = $argument['value'];
139 139
 		$role = $argument['role'];
140 140
 
141
-		if ( array_key_exists( $type, $methods ) ) {
141
+		if (array_key_exists($type, $methods)) {
142 142
 			$method = $methods[$type];
143
-			$params = $this->$method( $value, $role );
143
+			$params = $this->$method($value, $role);
144 144
 		} else {
145 145
 			throw new InvalidArgumentException(
146
-				'Unknown ViolationMessage argument type ' . $type . '!'
146
+				'Unknown ViolationMessage argument type '.$type.'!'
147 147
 			);
148 148
 		}
149 149
 
@@ -157,46 +157,46 @@  discard block
 block discarded – undo
157 157
 	 * and return a single-element array with a raw message param (i. e. [ Message::rawParam( … ) ])
158 158
 	 * @return array[] list of parameters as accepted by Message::params()
159 159
 	 */
160
-	private function renderList( array $list, $role, callable $render ) {
161
-		if ( $list === [] ) {
160
+	private function renderList(array $list, $role, callable $render) {
161
+		if ($list === []) {
162 162
 			return [
163
-				Message::numParam( 0 ),
164
-				Message::rawParam( '<ul></ul>' ),
163
+				Message::numParam(0),
164
+				Message::rawParam('<ul></ul>'),
165 165
 			];
166 166
 		}
167 167
 
168
-		if ( count( $list ) > $this->maxListLength ) {
169
-			$list = array_slice( $list, 0, $this->maxListLength );
168
+		if (count($list) > $this->maxListLength) {
169
+			$list = array_slice($list, 0, $this->maxListLength);
170 170
 			$truncated = true;
171 171
 		}
172 172
 
173 173
 		$renderedParamsLists = array_map(
174 174
 			$render,
175 175
 			$list,
176
-			array_fill( 0, count( $list ), $role )
176
+			array_fill(0, count($list), $role)
177 177
 		);
178 178
 		$renderedParams = array_map(
179
-			static function ( $params ) {
179
+			static function($params) {
180 180
 				return $params[0];
181 181
 			},
182 182
 			$renderedParamsLists
183 183
 		);
184 184
 		$renderedElements = array_map(
185
-			static function ( $param ) {
185
+			static function($param) {
186 186
 				return $param['raw'];
187 187
 			},
188 188
 			$renderedParams
189 189
 		);
190
-		if ( isset( $truncated ) ) {
191
-			$renderedElements[] = $this->msgEscaped( 'ellipsis' );
190
+		if (isset($truncated)) {
191
+			$renderedElements[] = $this->msgEscaped('ellipsis');
192 192
 		}
193 193
 
194 194
 		return array_merge(
195 195
 			[
196
-				Message::numParam( count( $list ) ),
196
+				Message::numParam(count($list)),
197 197
 				Message::rawParam(
198
-					'<ul><li>' .
199
-					implode( '</li><li>', $renderedElements ) .
198
+					'<ul><li>'.
199
+					implode('</li><li>', $renderedElements).
200 200
 					'</li></ul>'
201 201
 				),
202 202
 			],
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 	 * @param string|null $role one of the Role::* constants
210 210
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
211 211
 	 */
212
-	private function renderEntityId( EntityId $entityId, $role ) {
213
-		return [ Message::rawParam( $this->addRole(
214
-			$this->entityIdFormatter->formatEntityId( $entityId ),
212
+	private function renderEntityId(EntityId $entityId, $role) {
213
+		return [Message::rawParam($this->addRole(
214
+			$this->entityIdFormatter->formatEntityId($entityId),
215 215
 			$role
216
-		) ) ];
216
+		))];
217 217
 	}
218 218
 
219 219
 	/**
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 * @param string|null $role one of the Role::* constants
222 222
 	 * @return array[] list of parameters as accepted by Message::params()
223 223
 	 */
224
-	private function renderEntityIdList( array $entityIdList, $role ) {
225
-		return $this->renderList( $entityIdList, $role, [ $this, 'renderEntityId' ] );
224
+	private function renderEntityIdList(array $entityIdList, $role) {
225
+		return $this->renderList($entityIdList, $role, [$this, 'renderEntityId']);
226 226
 	}
227 227
 
228 228
 	/**
@@ -230,24 +230,24 @@  discard block
 block discarded – undo
230 230
 	 * @param string|null $role one of the Role::* constants
231 231
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
232 232
 	 */
233
-	private function renderItemIdSnakValue( ItemIdSnakValue $value, $role ) {
234
-		switch ( true ) {
233
+	private function renderItemIdSnakValue(ItemIdSnakValue $value, $role) {
234
+		switch (true) {
235 235
 			case $value->isValue():
236
-				return $this->renderEntityId( $value->getItemId(), $role );
236
+				return $this->renderEntityId($value->getItemId(), $role);
237 237
 			case $value->isSomeValue():
238
-				return [ Message::rawParam( $this->addRole(
239
-					'<span class="wikibase-snakview-variation-somevaluesnak">' .
240
-						$this->msgEscaped( 'wikibase-snakview-snaktypeselector-somevalue' ) .
238
+				return [Message::rawParam($this->addRole(
239
+					'<span class="wikibase-snakview-variation-somevaluesnak">'.
240
+						$this->msgEscaped('wikibase-snakview-snaktypeselector-somevalue').
241 241
 						'</span>',
242 242
 					$role
243
-				) ) ];
243
+				))];
244 244
 			case $value->isNoValue():
245
-				return [ Message::rawParam( $this->addRole(
246
-					'<span class="wikibase-snakview-variation-novaluesnak">' .
247
-					$this->msgEscaped( 'wikibase-snakview-snaktypeselector-novalue' ) .
245
+				return [Message::rawParam($this->addRole(
246
+					'<span class="wikibase-snakview-variation-novaluesnak">'.
247
+					$this->msgEscaped('wikibase-snakview-snaktypeselector-novalue').
248 248
 						'</span>',
249 249
 					$role
250
-				) ) ];
250
+				))];
251 251
 			default:
252 252
 				// @codeCoverageIgnoreStart
253 253
 				throw new LogicException(
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @param string|null $role one of the Role::* constants
263 263
 	 * @return array[] list of parameters as accepted by Message::params()
264 264
 	 */
265
-	private function renderItemIdSnakValueList( array $valueList, $role ) {
266
-		return $this->renderList( $valueList, $role, [ $this, 'renderItemIdSnakValue' ] );
265
+	private function renderItemIdSnakValueList(array $valueList, $role) {
266
+		return $this->renderList($valueList, $role, [$this, 'renderItemIdSnakValue']);
267 267
 	}
268 268
 
269 269
 	/**
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 	 * @param string|null $role one of the Role::* constants
272 272
 	 * @return array[] list of parameters as accepted by Message::params()
273 273
 	 */
274
-	private function renderDataValue( DataValue $dataValue, $role ) {
275
-		return [ Message::rawParam( $this->addRole(
276
-			$this->dataValueFormatter->format( $dataValue ),
274
+	private function renderDataValue(DataValue $dataValue, $role) {
275
+		return [Message::rawParam($this->addRole(
276
+			$this->dataValueFormatter->format($dataValue),
277 277
 			$role
278
-		) ) ];
278
+		))];
279 279
 	}
280 280
 
281 281
 	/**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @param string|null $role one of the Role::* constants
284 284
 	 * @return array[] list of parameters as accepted by Message::params()
285 285
 	 */
286
-	private function renderDataValueType( $dataValueType, $role ) {
286
+	private function renderDataValueType($dataValueType, $role) {
287 287
 		$messageKeys = [
288 288
 			'string' => 'datatypes-type-string',
289 289
 			'monolingualtext' => 'datatypes-type-monolingualtext',
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
 			'wikibase-entityid' => 'wbqc-dataValueType-wikibase-entityid',
293 293
 		];
294 294
 
295
-		if ( array_key_exists( $dataValueType, $messageKeys ) ) {
296
-			return [ Message::rawParam( $this->addRole(
297
-				$this->msgEscaped( $messageKeys[$dataValueType] ),
295
+		if (array_key_exists($dataValueType, $messageKeys)) {
296
+			return [Message::rawParam($this->addRole(
297
+				$this->msgEscaped($messageKeys[$dataValueType]),
298 298
 				$role
299
-			) ) ];
299
+			))];
300 300
 		} else {
301 301
 			// @codeCoverageIgnoreStart
302 302
 			throw new LogicException(
303
-				'Unknown data value type ' . $dataValueType
303
+				'Unknown data value type '.$dataValueType
304 304
 			);
305 305
 			// @codeCoverageIgnoreEnd
306 306
 		}
@@ -311,11 +311,11 @@  discard block
 block discarded – undo
311 311
 	 * @param string|null $role one of the Role::* constants
312 312
 	 * @return array[] list of parameters as accepted by Message::params()
313 313
 	 */
314
-	private function renderInlineCode( $code, $role ) {
315
-		return [ Message::rawParam( $this->addRole(
316
-			'<code>' . htmlspecialchars( $code ) . '</code>',
314
+	private function renderInlineCode($code, $role) {
315
+		return [Message::rawParam($this->addRole(
316
+			'<code>'.htmlspecialchars($code).'</code>',
317 317
 			$role
318
-		) ) ];
318
+		))];
319 319
 	}
320 320
 
321 321
 	/**
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
 	 * @param string|null $role one of the Role::* constants
324 324
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
325 325
 	 */
326
-	private function renderConstraintScope( $scope, $role ) {
327
-		switch ( $scope ) {
326
+	private function renderConstraintScope($scope, $role) {
327
+		switch ($scope) {
328 328
 			case Context::TYPE_STATEMENT:
329 329
 				$itemId = $this->config->get(
330 330
 					'WBQualityConstraintsConstraintCheckedOnMainValueId'
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 				// callers should never let this happen, but if it does happen,
345 345
 				// showing “unknown value” seems reasonable
346 346
 				// @codeCoverageIgnoreStart
347
-				return $this->renderItemIdSnakValue( ItemIdSnakValue::someValue(), $role );
347
+				return $this->renderItemIdSnakValue(ItemIdSnakValue::someValue(), $role);
348 348
 				// @codeCoverageIgnoreEnd
349 349
 		}
350
-		return $this->renderEntityId( new ItemId( $itemId ), $role );
350
+		return $this->renderEntityId(new ItemId($itemId), $role);
351 351
 	}
352 352
 
353 353
 	/**
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 	 * @param string|null $role one of the Role::* constants
356 356
 	 * @return array[] list of parameters as accepted by Message::params()
357 357
 	 */
358
-	private function renderConstraintScopeList( array $scopeList, $role ) {
359
-		return $this->renderList( $scopeList, $role, [ $this, 'renderConstraintScope' ] );
358
+	private function renderConstraintScopeList(array $scopeList, $role) {
359
+		return $this->renderList($scopeList, $role, [$this, 'renderConstraintScope']);
360 360
 	}
361 361
 
362 362
 	/**
@@ -364,25 +364,25 @@  discard block
 block discarded – undo
364 364
 	 * @param string|null $role one of the Role::* constants
365 365
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
366 366
 	 */
367
-	private function renderPropertyScope( $scope, $role ) {
368
-		switch ( $scope ) {
367
+	private function renderPropertyScope($scope, $role) {
368
+		switch ($scope) {
369 369
 			case Context::TYPE_STATEMENT:
370
-				$itemId = $this->config->get( 'WBQualityConstraintsAsMainValueId' );
370
+				$itemId = $this->config->get('WBQualityConstraintsAsMainValueId');
371 371
 				break;
372 372
 			case Context::TYPE_QUALIFIER:
373
-				$itemId = $this->config->get( 'WBQualityConstraintsAsQualifiersId' );
373
+				$itemId = $this->config->get('WBQualityConstraintsAsQualifiersId');
374 374
 				break;
375 375
 			case Context::TYPE_REFERENCE:
376
-				$itemId = $this->config->get( 'WBQualityConstraintsAsReferencesId' );
376
+				$itemId = $this->config->get('WBQualityConstraintsAsReferencesId');
377 377
 				break;
378 378
 			default:
379 379
 				// callers should never let this happen, but if it does happen,
380 380
 				// showing “unknown value” seems reasonable
381 381
 				// @codeCoverageIgnoreStart
382
-				return $this->renderItemIdSnakValue( ItemIdSnakValue::someValue(), $role );
382
+				return $this->renderItemIdSnakValue(ItemIdSnakValue::someValue(), $role);
383 383
 				// @codeCoverageIgnoreEnd
384 384
 		}
385
-		return $this->renderEntityId( new ItemId( $itemId ), $role );
385
+		return $this->renderEntityId(new ItemId($itemId), $role);
386 386
 	}
387 387
 
388 388
 	/**
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 	 * @param string|null $role one of the Role::* constants
391 391
 	 * @return array[] list of parameters as accepted by Message::params()
392 392
 	 */
393
-	private function renderPropertyScopeList( array $scopeList, $role ) {
394
-		return $this->renderList( $scopeList, $role, [ $this, 'renderPropertyScope' ] );
393
+	private function renderPropertyScopeList(array $scopeList, $role) {
394
+		return $this->renderList($scopeList, $role, [$this, 'renderPropertyScope']);
395 395
 	}
396 396
 
397 397
 	/**
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
 	 * @param string|null $role one of the Role::* constants
400 400
 	 * @return array[] list of parameters as accepted by Message::params()
401 401
 	 */
402
-	private function renderLanguage( $languageCode, $role ) {
402
+	private function renderLanguage($languageCode, $role) {
403 403
 		return [
404
-			Message::plaintextParam( Language::fetchLanguageName( $languageCode ) ),
405
-			Message::plaintextParam( $languageCode ),
404
+			Message::plaintextParam(Language::fetchLanguageName($languageCode)),
405
+			Message::plaintextParam($languageCode),
406 406
 		];
407 407
 	}
408 408
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Result/CheckResultSerializer.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
 	 * @param CheckResult $checkResult
77 77
 	 * @return array
78 78
 	 */
79
-	public function serialize( CheckResult $checkResult ) {
79
+	public function serialize(CheckResult $checkResult) {
80 80
 		$contextCursor = $checkResult->getContextCursor();
81 81
 
82 82
 		$serialization = [
83
-			self::KEY_CONTEXT_CURSOR => $this->contextCursorSerializer->serialize( $contextCursor ),
83
+			self::KEY_CONTEXT_CURSOR => $this->contextCursorSerializer->serialize($contextCursor),
84 84
 		];
85 85
 
86
-		if ( $checkResult instanceof NullResult ) {
86
+		if ($checkResult instanceof NullResult) {
87 87
 			$serialization[self::KEY_NULL_RESULT] = 1;
88 88
 		} else {
89 89
 			$constraint = $checkResult->getConstraint();
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
 			$violationMessage = $checkResult->getMessage();
92 92
 
93 93
 			$serialization[self::KEY_CONSTRAINT] =
94
-				$this->constraintSerializer->serialize( $constraint );
94
+				$this->constraintSerializer->serialize($constraint);
95 95
 			$serialization[self::KEY_CHECK_RESULT_STATUS] =
96 96
 				$checkResult->getStatus();
97 97
 			$serialization[self::KEY_CACHING_METADATA] =
98
-				$this->serializeCachingMetadata( $cachingMetadata );
98
+				$this->serializeCachingMetadata($cachingMetadata);
99 99
 
100
-			if ( $violationMessage !== null ) {
100
+			if ($violationMessage !== null) {
101 101
 				$serialization[self::KEY_VIOLATION_MESSAGE] =
102
-					$this->violationMessageSerializer->serialize( $violationMessage );
102
+					$this->violationMessageSerializer->serialize($violationMessage);
103 103
 			}
104 104
 		}
105 105
 
106
-		if ( $this->serializeDependencyMetadata ) {
106
+		if ($this->serializeDependencyMetadata) {
107 107
 			$serialization[self::KEY_DEPENDENCY_METADATA] =
108
-				$this->serializeDependencyMetadata( $checkResult );
108
+				$this->serializeDependencyMetadata($checkResult);
109 109
 		}
110 110
 
111 111
 		return $serialization;
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 	 * @param CachingMetadata $cachingMetadata
116 116
 	 * @return array
117 117
 	 */
118
-	private function serializeCachingMetadata( CachingMetadata $cachingMetadata ) {
118
+	private function serializeCachingMetadata(CachingMetadata $cachingMetadata) {
119 119
 		$maximumAge = $cachingMetadata->getMaximumAgeInSeconds();
120 120
 
121 121
 		$serialization = [];
122 122
 
123
-		if ( $maximumAge > 0 ) {
123
+		if ($maximumAge > 0) {
124 124
 			$serialization[self::KEY_CACHING_METADATA_MAX_AGE] = $maximumAge;
125 125
 		}
126 126
 
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
 	 * @param CheckResult $checkResult
132 132
 	 * @return array
133 133
 	 */
134
-	private function serializeDependencyMetadata( CheckResult $checkResult ) {
134
+	private function serializeDependencyMetadata(CheckResult $checkResult) {
135 135
 		$dependencyMetadata = $checkResult->getMetadata()->getDependencyMetadata();
136 136
 		$entityIds = $dependencyMetadata->getEntityIds();
137 137
 		$futureTime = $dependencyMetadata->getFutureTime();
138 138
 
139 139
 		$serialization = [
140 140
 			self::KEY_DEPENDENCY_METADATA_ENTITY_IDS => array_map(
141
-				static function ( EntityId $entityId ) {
141
+				static function(EntityId $entityId) {
142 142
 					return $entityId->getSerialization();
143 143
 				},
144 144
 				$entityIds
145 145
 			),
146 146
 		];
147 147
 
148
-		if ( $futureTime !== null ) {
148
+		if ($futureTime !== null) {
149 149
 			$serialization[self::KEY_DEPENDENCY_METADATA_FUTURE_TIME] =
150 150
 				$futureTime->getArrayValue();
151 151
 		}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/TypeChecker.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 	 * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs
76 76
 	 * @return CheckResult
77 77
 	 */
78
-	public function checkConstraint( Context $context, Constraint $constraint ) {
79
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
80
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
78
+	public function checkConstraint(Context $context, Constraint $constraint) {
79
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
80
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
81 81
 		}
82
-		if ( $context->getType() === Context::TYPE_REFERENCE ) {
83
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE );
82
+		if ($context->getType() === Context::TYPE_REFERENCE) {
83
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE);
84 84
 		}
85 85
 
86 86
 		$parameters = [];
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 			$constraintTypeItemId
93 93
 		);
94 94
 		$parameters['class'] = array_map(
95
-			static function ( $id ) {
96
-				return new ItemId( $id );
95
+			static function($id) {
96
+				return new ItemId($id);
97 97
 			},
98 98
 			$classes
99 99
 		);
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 			$constraintTypeItemId
104 104
 		);
105 105
 		$relationIds = [];
106
-		if ( $relation === 'instance' || $relation === 'instanceOrSubclass' ) {
107
-			$relationIds[] = $this->config->get( 'WBQualityConstraintsInstanceOfId' );
106
+		if ($relation === 'instance' || $relation === 'instanceOrSubclass') {
107
+			$relationIds[] = $this->config->get('WBQualityConstraintsInstanceOfId');
108 108
 		}
109
-		if ( $relation === 'subclass' || $relation === 'instanceOrSubclass' ) {
110
-			$relationIds[] = $this->config->get( 'WBQualityConstraintsSubclassOfId' );
109
+		if ($relation === 'subclass' || $relation === 'instanceOrSubclass') {
110
+			$relationIds[] = $this->config->get('WBQualityConstraintsSubclassOfId');
111 111
 		}
112
-		$parameters['relation'] = [ $relation ];
112
+		$parameters['relation'] = [$relation];
113 113
 
114 114
 		$result = $this->typeCheckerHelper->hasClassInRelation(
115 115
 			$context->getEntity()->getStatements(),
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			$classes
118 118
 		);
119 119
 
120
-		if ( $result->getBool() ) {
120
+		if ($result->getBool()) {
121 121
 			$message = null;
122 122
 			$status = CheckResult::STATUS_COMPLIANCE;
123 123
 		} else {
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 			$status = CheckResult::STATUS_VIOLATION;
132 132
 		}
133 133
 
134
-		return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) )
135
-			->withMetadata( $result->getMetadata() );
134
+		return (new CheckResult($context, $constraint, $parameters, $status, $message))
135
+			->withMetadata($result->getMetadata());
136 136
 	}
137 137
 
138
-	public function checkConstraintParameters( Constraint $constraint ) {
138
+	public function checkConstraintParameters(Constraint $constraint) {
139 139
 		$constraintParameters = $constraint->getConstraintParameters();
140 140
 		$constraintTypeItemId = $constraint->getConstraintTypeItemId();
141 141
 		$exceptions = [];
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 				$constraintParameters,
145 145
 				$constraintTypeItemId
146 146
 			);
147
-		} catch ( ConstraintParameterException $e ) {
147
+		} catch (ConstraintParameterException $e) {
148 148
 			$exceptions[] = $e;
149 149
 		}
150 150
 		try {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 				$constraintParameters,
153 153
 				$constraintTypeItemId
154 154
 			);
155
-		} catch ( ConstraintParameterException $e ) {
155
+		} catch (ConstraintParameterException $e) {
156 156
 			$exceptions[] = $e;
157 157
 		}
158 158
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ValueTypeChecker.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	 * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs
92 92
 	 * @return CheckResult
93 93
 	 */
94
-	public function checkConstraint( Context $context, Constraint $constraint ) {
95
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
96
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
94
+	public function checkConstraint(Context $context, Constraint $constraint) {
95
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
96
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
97 97
 		}
98 98
 
99 99
 		$parameters = [];
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 			$constraintTypeItemId
106 106
 		);
107 107
 		$parameters['class'] = array_map(
108
-			static function ( $id ) {
109
-				return new ItemId( $id );
108
+			static function($id) {
109
+				return new ItemId($id);
110 110
 			},
111 111
 			$classes
112 112
 		);
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
 			$constraintTypeItemId
117 117
 		);
118 118
 		$relationIds = [];
119
-		if ( $relation === 'instance' || $relation === 'instanceOrSubclass' ) {
120
-			$relationIds[] = $this->config->get( 'WBQualityConstraintsInstanceOfId' );
119
+		if ($relation === 'instance' || $relation === 'instanceOrSubclass') {
120
+			$relationIds[] = $this->config->get('WBQualityConstraintsInstanceOfId');
121 121
 		}
122
-		if ( $relation === 'subclass' || $relation === 'instanceOrSubclass' ) {
123
-			$relationIds[] = $this->config->get( 'WBQualityConstraintsSubclassOfId' );
122
+		if ($relation === 'subclass' || $relation === 'instanceOrSubclass') {
123
+			$relationIds[] = $this->config->get('WBQualityConstraintsSubclassOfId');
124 124
 		}
125
-		$parameters['relation'] = [ $relation ];
125
+		$parameters['relation'] = [$relation];
126 126
 
127 127
 		$snak = $context->getSnak();
128 128
 
129
-		if ( !$snak instanceof PropertyValueSnak ) {
129
+		if (!$snak instanceof PropertyValueSnak) {
130 130
 			// nothing to check
131
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
131
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
132 132
 		}
133 133
 
134 134
 		$dataValue = $snak->getDataValue();
@@ -137,23 +137,23 @@  discard block
 block discarded – undo
137 137
 		 * error handling:
138 138
 		 *   type of $dataValue for properties with 'Value type' constraint has to be 'wikibase-entityid'
139 139
 		 */
140
-		if ( !$dataValue instanceof EntityIdValue ) {
141
-			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
142
-				->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
143
-				->withDataValueType( 'wikibase-entityid' );
144
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
140
+		if (!$dataValue instanceof EntityIdValue) {
141
+			$message = (new ViolationMessage('wbqc-violation-message-value-needed-of-type'))
142
+				->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
143
+				->withDataValueType('wikibase-entityid');
144
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
145 145
 		}
146 146
 
147 147
 		try {
148
-			$item = $this->entityLookup->getEntity( $dataValue->getEntityId() );
149
-		} catch ( UnresolvedEntityRedirectException $e ) {
148
+			$item = $this->entityLookup->getEntity($dataValue->getEntityId());
149
+		} catch (UnresolvedEntityRedirectException $e) {
150 150
 			// Edge case (double redirect): Pretend the entity doesn't exist
151 151
 			$item = null;
152 152
 		}
153 153
 
154
-		if ( !( $item instanceof StatementListProvidingEntity ) ) {
155
-			$message = new ViolationMessage( 'wbqc-violation-message-value-entity-must-exist' );
156
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
154
+		if (!($item instanceof StatementListProvidingEntity)) {
155
+			$message = new ViolationMessage('wbqc-violation-message-value-entity-must-exist');
156
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
157 157
 		}
158 158
 
159 159
 		$statements = $item->getStatements();
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 			$classes
165 165
 		);
166 166
 
167
-		if ( $result->getBool() ) {
167
+		if ($result->getBool()) {
168 168
 			$message = null;
169 169
 			$status = CheckResult::STATUS_COMPLIANCE;
170 170
 		} else {
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 			$status = CheckResult::STATUS_VIOLATION;
179 179
 		}
180 180
 
181
-		return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) )
182
-			->withMetadata( $result->getMetadata() );
181
+		return (new CheckResult($context, $constraint, $parameters, $status, $message))
182
+			->withMetadata($result->getMetadata());
183 183
 	}
184 184
 
185
-	public function checkConstraintParameters( Constraint $constraint ) {
185
+	public function checkConstraintParameters(Constraint $constraint) {
186 186
 		$constraintParameters = $constraint->getConstraintParameters();
187 187
 		$constraintTypeItemId = $constraint->getConstraintTypeItemId();
188 188
 		$exceptions = [];
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 				$constraintParameters,
192 192
 				$constraintTypeItemId
193 193
 			);
194
-		} catch ( ConstraintParameterException $e ) {
194
+		} catch (ConstraintParameterException $e) {
195 195
 			$exceptions[] = $e;
196 196
 		}
197 197
 		try {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				$constraintParameters,
200 200
 				$constraintTypeItemId
201 201
 			);
202
-		} catch ( ConstraintParameterException $e ) {
202
+		} catch (ConstraintParameterException $e) {
203 203
 			$exceptions[] = $e;
204 204
 		}
205 205
 		return $exceptions;
Please login to merge, or discard this patch.
src/ServiceWiring-Wikibase.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
 use Wikibase\Repo\WikibaseRepo;
9 9
 
10 10
 return [
11
-	WikibaseServices::ENTITY_LOOKUP => static function ( MediaWikiServices $services ) {
11
+	WikibaseServices::ENTITY_LOOKUP => static function(MediaWikiServices $services) {
12 12
 		return new ExceptionIgnoringEntityLookup(
13
-			WikibaseRepo::getEntityLookup( $services )
13
+			WikibaseRepo::getEntityLookup($services)
14 14
 		);
15 15
 	},
16 16
 
17
-	WikibaseServices::ENTITY_LOOKUP_WITHOUT_CACHE => static function ( MediaWikiServices $services ) {
17
+	WikibaseServices::ENTITY_LOOKUP_WITHOUT_CACHE => static function(MediaWikiServices $services) {
18 18
 		return new ExceptionIgnoringEntityLookup(
19
-			WikibaseRepo::getStore( $services )
20
-				->getEntityLookup( Store::LOOKUP_CACHING_RETRIEVE_ONLY )
19
+			WikibaseRepo::getStore($services)
20
+				->getEntityLookup(Store::LOOKUP_CACHING_RETRIEVE_ONLY)
21 21
 		);
22 22
 	},
23 23
 
24
-	WikibaseServices::PROPERTY_DATA_TYPE_LOOKUP => static function ( MediaWikiServices $services ) {
25
-		return WikibaseRepo::getPropertyDataTypeLookup( $services );
24
+	WikibaseServices::PROPERTY_DATA_TYPE_LOOKUP => static function(MediaWikiServices $services) {
25
+		return WikibaseRepo::getPropertyDataTypeLookup($services);
26 26
 	},
27 27
 ];
Please login to merge, or discard this patch.