Completed
Push — master ( dfc993...34e257 )
by
unknown
02:20 queued 10s
created
src/ConstraintCheck/Context/MainSnakContext.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	private $statement;
24 24
 
25
-	public function __construct( StatementListProvidingEntity $entity, Statement $statement ) {
26
-		parent::__construct( $entity, $statement->getMainSnak() );
25
+	public function __construct(StatementListProvidingEntity $entity, Statement $statement) {
26
+		parent::__construct($entity, $statement->getMainSnak());
27 27
 
28 28
 		$this->statement = $statement;
29 29
 	}
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
 		return $this->statement;
41 41
 	}
42 42
 
43
-	public function getSnakGroup( $groupingMode, array $separators = [] ) {
43
+	public function getSnakGroup($groupingMode, array $separators = []) {
44 44
 		/** @var StatementList $statements */
45 45
 		$statements = $this->entity->getStatements();
46
-		switch ( $groupingMode ) {
46
+		switch ($groupingMode) {
47 47
 			case Context::GROUP_NON_DEPRECATED:
48
-				$statements = $statements->getByRank( [
48
+				$statements = $statements->getByRank([
49 49
 					Statement::RANK_NORMAL,
50 50
 					Statement::RANK_PREFERRED,
51
-				] );
51
+				]);
52 52
 				break;
53 53
 			case Context::GROUP_BEST_RANK:
54
-				$statements = $this->getBestStatementsPerPropertyId( $statements );
54
+				$statements = $this->getBestStatementsPerPropertyId($statements);
55 55
 				break;
56 56
 			default:
57
-				throw new LogicException( 'Unknown $groupingMode ' . $groupingMode );
57
+				throw new LogicException('Unknown $groupingMode '.$groupingMode);
58 58
 		}
59 59
 		return $this->getStatementsWithSameQualifiersForProperties(
60 60
 			$this->statement,
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 		)->getMainSnaks();
64 64
 	}
65 65
 
66
-	private function getBestStatementsPerPropertyId( StatementList $statements ) {
66
+	private function getBestStatementsPerPropertyId(StatementList $statements) {
67 67
 		$allBestStatements = new StatementList();
68
-		foreach ( $statements->getPropertyIds() as $propertyId ) {
69
-			$bestStatements = $statements->getByPropertyId( $propertyId )
68
+		foreach ($statements->getPropertyIds() as $propertyId) {
69
+			$bestStatements = $statements->getByPropertyId($propertyId)
70 70
 				->getBestStatements();
71
-			foreach ( $bestStatements as $bestStatement ) {
72
-				$allBestStatements->addStatement( $bestStatement );
71
+			foreach ($bestStatements as $bestStatement) {
72
+				$allBestStatements->addStatement($bestStatement);
73 73
 			}
74 74
 		}
75 75
 		return $allBestStatements;
@@ -91,20 +91,20 @@  discard block
 block discarded – undo
91 91
 		array $qualifierPropertyIds
92 92
 	) {
93 93
 		$similarStatements = new StatementList();
94
-		foreach ( $allStatements as $statement ) {
95
-			if ( $statement === $currentStatement ) {
94
+		foreach ($allStatements as $statement) {
95
+			if ($statement === $currentStatement) {
96 96
 				// if the statement has an “unknown value” qualifier,
97 97
 				// it might be considered different from itself,
98 98
 				// so add it explicitly to ensure it’s always included
99
-				$similarStatements->addStatement( $statement );
99
+				$similarStatements->addStatement($statement);
100 100
 				continue;
101 101
 			}
102
-			foreach ( $qualifierPropertyIds as $qualifierPropertyId ) {
103
-				if ( !$this->haveSameQualifiers( $currentStatement, $statement, $qualifierPropertyId ) ) {
102
+			foreach ($qualifierPropertyIds as $qualifierPropertyId) {
103
+				if (!$this->haveSameQualifiers($currentStatement, $statement, $qualifierPropertyId)) {
104 104
 					continue 2;
105 105
 				}
106 106
 			}
107
-			$similarStatements->addStatement( $statement );
107
+			$similarStatements->addStatement($statement);
108 108
 		}
109 109
 		return $similarStatements;
110 110
 	}
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
 	 * @param PropertyId $propertyId
119 119
 	 * @return bool
120 120
 	 */
121
-	private function haveSameQualifiers( Statement $s1, Statement $s2, PropertyId $propertyId ) {
122
-		$q1 = $this->getSnaksWithPropertyId( $s1->getQualifiers(), $propertyId );
123
-		$q2 = $this->getSnaksWithPropertyId( $s2->getQualifiers(), $propertyId );
121
+	private function haveSameQualifiers(Statement $s1, Statement $s2, PropertyId $propertyId) {
122
+		$q1 = $this->getSnaksWithPropertyId($s1->getQualifiers(), $propertyId);
123
+		$q2 = $this->getSnaksWithPropertyId($s2->getQualifiers(), $propertyId);
124 124
 
125
-		if ( $q1->count() !== $q2->count() ) {
125
+		if ($q1->count() !== $q2->count()) {
126 126
 			return false;
127 127
 		}
128 128
 
129
-		foreach ( $q1 as $qualifier ) {
130
-			switch ( $qualifier->getType() ) {
129
+		foreach ($q1 as $qualifier) {
130
+			switch ($qualifier->getType()) {
131 131
 				case 'value':
132 132
 				case 'novalue':
133
-					if ( !$q2->hasSnak( $qualifier ) ) {
133
+					if (!$q2->hasSnak($qualifier)) {
134 134
 						return false;
135 135
 					}
136 136
 					break;
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 	 * @param PropertyId $propertyId
153 153
 	 * @return SnakList
154 154
 	 */
155
-	private function getSnaksWithPropertyId( SnakList $allSnaks, PropertyId $propertyId ) {
155
+	private function getSnaksWithPropertyId(SnakList $allSnaks, PropertyId $propertyId) {
156 156
 		$snaks = new SnakList();
157 157
 		/** @var Snak $snak */
158
-		foreach ( $allSnaks as $snak ) {
159
-			if ( $snak->getPropertyId()->equals( $propertyId ) ) {
160
-				$snaks->addSnak( $snak );
158
+		foreach ($allSnaks as $snak) {
159
+			if ($snak->getPropertyId()->equals($propertyId)) {
160
+				$snaks->addSnak($snak);
161 161
 			}
162 162
 		}
163 163
 		return $snaks;
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/AbstractContext.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	 */
24 24
 	protected $snak;
25 25
 
26
-	public function __construct( StatementListProvidingEntity $entity, Snak $snak ) {
26
+	public function __construct(StatementListProvidingEntity $entity, Snak $snak) {
27 27
 		$this->entity = $entity;
28 28
 		$this->snak = $snak;
29 29
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/DelegatingConstraintChecker.php 1 patch
Spacing   +145 added lines, -145 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
-			function ( $resultStatus ) {
226
+			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,17 +301,17 @@  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();
306
-		$constraints = $this->constraintLookup->queryConstraintsForProperty( $propertyId );
304
+	public function checkConstraintParametersOnConstraintId($constraintId) {
305
+		$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
306
+		$constraints = $this->constraintLookup->queryConstraintsForProperty($propertyId);
307 307
 
308
-		foreach ( $constraints as $constraint ) {
309
-			if ( $constraint->getConstraintId() === $constraintId ) {
310
-				$problems = $this->checkCommonConstraintParameters( $constraint );
308
+		foreach ($constraints as $constraint) {
309
+			if ($constraint->getConstraintId() === $constraintId) {
310
+				$problems = $this->checkCommonConstraintParameters($constraint);
311 311
 
312
-				if ( array_key_exists( $constraint->getConstraintTypeItemId(), $this->checkerMap ) ) {
312
+				if (array_key_exists($constraint->getConstraintTypeItemId(), $this->checkerMap)) {
313 313
 					$checker = $this->checkerMap[$constraint->getConstraintTypeItemId()];
314
-					$problems = array_merge( $problems, $checker->checkConstraintParameters( $constraint ) );
314
+					$problems = array_merge($problems, $checker->checkConstraintParameters($constraint));
315 315
 				}
316 316
 
317 317
 				return $problems;
@@ -336,14 +336,14 @@  discard block
 block discarded – undo
336 336
 		$result = [];
337 337
 
338 338
 		/** @var Statement $statement */
339
-		foreach ( $entity->getStatements() as $statement ) {
340
-			$result = array_merge( $result,
339
+		foreach ($entity->getStatements() as $statement) {
340
+			$result = array_merge($result,
341 341
 				$this->checkStatement(
342 342
 					$entity,
343 343
 					$statement,
344 344
 					$constraintIds,
345 345
 					$defaultResultsPerContext
346
-				) );
346
+				));
347 347
 		}
348 348
 
349 349
 		return $result;
@@ -365,32 +365,32 @@  discard block
 block discarded – undo
365 365
 	) {
366 366
 		$result = [];
367 367
 
368
-		$result = array_merge( $result,
368
+		$result = array_merge($result,
369 369
 			$this->checkConstraintsForMainSnak(
370 370
 				$entity,
371 371
 				$statement,
372 372
 				$constraintIds,
373 373
 				$defaultResultsPerContext
374
-			) );
374
+			));
375 375
 
376
-		if ( $this->checkQualifiers ) {
377
-			$result = array_merge( $result,
376
+		if ($this->checkQualifiers) {
377
+			$result = array_merge($result,
378 378
 				$this->checkConstraintsForQualifiers(
379 379
 					$entity,
380 380
 					$statement,
381 381
 					$constraintIds,
382 382
 					$defaultResultsPerContext
383
-				) );
383
+				));
384 384
 		}
385 385
 
386
-		if ( $this->checkReferences ) {
387
-			$result = array_merge( $result,
386
+		if ($this->checkReferences) {
387
+			$result = array_merge($result,
388 388
 				$this->checkConstraintsForReferences(
389 389
 					$entity,
390 390
 					$statement,
391 391
 					$constraintIds,
392 392
 					$defaultResultsPerContext
393
-				) );
393
+				));
394 394
 		}
395 395
 
396 396
 		return $result;
@@ -405,12 +405,12 @@  discard block
 block discarded – undo
405 405
 	 * @param string[]|null $constraintIds
406 406
 	 * @return Constraint[]
407 407
 	 */
408
-	private function getConstraintsToUse( PropertyId $propertyId, array $constraintIds = null ) {
409
-		$constraints = $this->constraintLookup->queryConstraintsForProperty( $propertyId );
410
-		if ( $constraintIds !== null ) {
408
+	private function getConstraintsToUse(PropertyId $propertyId, array $constraintIds = null) {
409
+		$constraints = $this->constraintLookup->queryConstraintsForProperty($propertyId);
410
+		if ($constraintIds !== null) {
411 411
 			$constraintsToUse = [];
412
-			foreach ( $constraints as $constraint ) {
413
-				if ( in_array( $constraint->getConstraintId(), $constraintIds ) ) {
412
+			foreach ($constraints as $constraint) {
413
+				if (in_array($constraint->getConstraintId(), $constraintIds)) {
414 414
 					$constraintsToUse[] = $constraint;
415 415
 				}
416 416
 			}
@@ -434,29 +434,29 @@  discard block
 block discarded – undo
434 434
 		array $constraintIds = null,
435 435
 		callable $defaultResults = null
436 436
 	) {
437
-		$context = new MainSnakContext( $entity, $statement );
437
+		$context = new MainSnakContext($entity, $statement);
438 438
 		$constraints = $this->getConstraintsToUse(
439 439
 			$statement->getPropertyId(),
440 440
 			$constraintIds
441 441
 		);
442
-		$result = $defaultResults !== null ? $defaultResults( $context ) : [];
442
+		$result = $defaultResults !== null ? $defaultResults($context) : [];
443 443
 
444
-		foreach ( $constraints as $constraint ) {
444
+		foreach ($constraints as $constraint) {
445 445
 			$parameters = $constraint->getConstraintParameters();
446 446
 			try {
447
-				$exceptions = $this->constraintParameterParser->parseExceptionParameter( $parameters );
448
-			} catch ( ConstraintParameterException $e ) {
449
-				$result[] = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage() );
447
+				$exceptions = $this->constraintParameterParser->parseExceptionParameter($parameters);
448
+			} catch (ConstraintParameterException $e) {
449
+				$result[] = new CheckResult($context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage());
450 450
 				continue;
451 451
 			}
452 452
 
453
-			if ( in_array( $entity->getId(), $exceptions ) ) {
454
-				$message = new ViolationMessage( 'wbqc-violation-message-exception' );
455
-				$result[] = new CheckResult( $context, $constraint, [], CheckResult::STATUS_EXCEPTION, $message );
453
+			if (in_array($entity->getId(), $exceptions)) {
454
+				$message = new ViolationMessage('wbqc-violation-message-exception');
455
+				$result[] = new CheckResult($context, $constraint, [], CheckResult::STATUS_EXCEPTION, $message);
456 456
 				continue;
457 457
 			}
458 458
 
459
-			$result[] = $this->getCheckResultFor( $context, $constraint );
459
+			$result[] = $this->getCheckResultFor($context, $constraint);
460 460
 		}
461 461
 
462 462
 		return $result;
@@ -478,24 +478,24 @@  discard block
 block discarded – undo
478 478
 	) {
479 479
 		$result = [];
480 480
 
481
-		if ( in_array(
481
+		if (in_array(
482 482
 			$statement->getPropertyId()->getSerialization(),
483 483
 			$this->propertiesWithViolatingQualifiers
484
-		) ) {
484
+		)) {
485 485
 			return $result;
486 486
 		}
487 487
 
488
-		foreach ( $statement->getQualifiers() as $qualifier ) {
489
-			$qualifierContext = new QualifierContext( $entity, $statement, $qualifier );
490
-			if ( $defaultResultsPerContext !== null ) {
491
-				$result = array_merge( $result, $defaultResultsPerContext( $qualifierContext ) );
488
+		foreach ($statement->getQualifiers() as $qualifier) {
489
+			$qualifierContext = new QualifierContext($entity, $statement, $qualifier);
490
+			if ($defaultResultsPerContext !== null) {
491
+				$result = array_merge($result, $defaultResultsPerContext($qualifierContext));
492 492
 			}
493 493
 			$qualifierConstraints = $this->getConstraintsToUse(
494 494
 				$qualifierContext->getSnak()->getPropertyId(),
495 495
 				$constraintIds
496 496
 			);
497
-			foreach ( $qualifierConstraints as $qualifierConstraint ) {
498
-				$result[] = $this->getCheckResultFor( $qualifierContext, $qualifierConstraint );
497
+			foreach ($qualifierConstraints as $qualifierConstraint) {
498
+				$result[] = $this->getCheckResultFor($qualifierContext, $qualifierConstraint);
499 499
 			}
500 500
 		}
501 501
 
@@ -519,19 +519,19 @@  discard block
 block discarded – undo
519 519
 		$result = [];
520 520
 
521 521
 		/** @var Reference $reference */
522
-		foreach ( $statement->getReferences() as $reference ) {
523
-			foreach ( $reference->getSnaks() as $snak ) {
522
+		foreach ($statement->getReferences() as $reference) {
523
+			foreach ($reference->getSnaks() as $snak) {
524 524
 				$referenceContext = new ReferenceContext(
525 525
 					$entity, $statement, $reference, $snak
526 526
 				);
527
-				if ( $defaultResultsPerContext !== null ) {
528
-					$result = array_merge( $result, $defaultResultsPerContext( $referenceContext ) );
527
+				if ($defaultResultsPerContext !== null) {
528
+					$result = array_merge($result, $defaultResultsPerContext($referenceContext));
529 529
 				}
530 530
 				$referenceConstraints = $this->getConstraintsToUse(
531 531
 					$referenceContext->getSnak()->getPropertyId(),
532 532
 					$constraintIds
533 533
 				);
534
-				foreach ( $referenceConstraints as $referenceConstraint ) {
534
+				foreach ($referenceConstraints as $referenceConstraint) {
535 535
 					$result[] = $this->getCheckResultFor(
536 536
 						$referenceContext,
537 537
 						$referenceConstraint
@@ -550,43 +550,43 @@  discard block
 block discarded – undo
550 550
 	 * @throws InvalidArgumentException
551 551
 	 * @return CheckResult
552 552
 	 */
553
-	private function getCheckResultFor( Context $context, Constraint $constraint ) {
554
-		if ( array_key_exists( $constraint->getConstraintTypeItemId(), $this->checkerMap ) ) {
553
+	private function getCheckResultFor(Context $context, Constraint $constraint) {
554
+		if (array_key_exists($constraint->getConstraintTypeItemId(), $this->checkerMap)) {
555 555
 			$checker = $this->checkerMap[$constraint->getConstraintTypeItemId()];
556
-			$result = $this->handleScope( $checker, $context, $constraint );
556
+			$result = $this->handleScope($checker, $context, $constraint);
557 557
 
558
-			if ( $result !== null ) {
559
-				$this->addMetadata( $context, $result );
558
+			if ($result !== null) {
559
+				$this->addMetadata($context, $result);
560 560
 				return $result;
561 561
 			}
562 562
 
563
-			$startTime = microtime( true );
563
+			$startTime = microtime(true);
564 564
 			try {
565
-				$result = $checker->checkConstraint( $context, $constraint );
566
-			} catch ( ConstraintParameterException $e ) {
567
-				$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage() );
568
-			} catch ( SparqlHelperException $e ) {
569
-				$message = new ViolationMessage( 'wbqc-violation-message-sparql-error' );
570
-				$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_TODO, $message );
565
+				$result = $checker->checkConstraint($context, $constraint);
566
+			} catch (ConstraintParameterException $e) {
567
+				$result = new CheckResult($context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage());
568
+			} catch (SparqlHelperException $e) {
569
+				$message = new ViolationMessage('wbqc-violation-message-sparql-error');
570
+				$result = new CheckResult($context, $constraint, [], CheckResult::STATUS_TODO, $message);
571 571
 			}
572
-			$endTime = microtime( true );
572
+			$endTime = microtime(true);
573 573
 
574
-			$this->addMetadata( $context, $result );
574
+			$this->addMetadata($context, $result);
575 575
 
576
-			$this->downgradeResultStatus( $context, $result );
576
+			$this->downgradeResultStatus($context, $result);
577 577
 
578 578
 			$this->loggingHelper->logConstraintCheck(
579 579
 				$context,
580 580
 				$constraint,
581 581
 				$result,
582
-				get_class( $checker ),
582
+				get_class($checker),
583 583
 				$endTime - $startTime,
584 584
 				__METHOD__
585 585
 			);
586 586
 
587 587
 			return $result;
588 588
 		} else {
589
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_TODO, null );
589
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_TODO, null);
590 590
 		}
591 591
 	}
592 592
 
@@ -600,61 +600,61 @@  discard block
 block discarded – undo
600 600
 				$constraint->getConstraintParameters(),
601 601
 				$constraint->getConstraintTypeItemId()
602 602
 			);
603
-		} catch ( ConstraintParameterException $e ) {
604
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage() );
603
+		} catch (ConstraintParameterException $e) {
604
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage());
605 605
 		}
606
-		if ( $checkedContextTypes === null ) {
606
+		if ($checkedContextTypes === null) {
607 607
 			$checkedContextTypes = $checker->getDefaultContextTypes();
608 608
 		}
609
-		if ( !in_array( $context->getType(), $checkedContextTypes ) ) {
610
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE, null );
609
+		if (!in_array($context->getType(), $checkedContextTypes)) {
610
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE, null);
611 611
 		}
612
-		if ( $checker->getSupportedContextTypes()[$context->getType()] === CheckResult::STATUS_TODO ) {
613
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_TODO, null );
612
+		if ($checker->getSupportedContextTypes()[$context->getType()] === CheckResult::STATUS_TODO) {
613
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_TODO, null);
614 614
 		}
615 615
 		return null;
616 616
 	}
617 617
 
618
-	private function addMetadata( Context $context, CheckResult $result ) {
619
-		$result->withMetadata( Metadata::merge( [
618
+	private function addMetadata(Context $context, CheckResult $result) {
619
+		$result->withMetadata(Metadata::merge([
620 620
 			$result->getMetadata(),
621
-			Metadata::ofDependencyMetadata( DependencyMetadata::merge( [
622
-				DependencyMetadata::ofEntityId( $context->getEntity()->getId() ),
623
-				DependencyMetadata::ofEntityId( $result->getConstraint()->getPropertyId() ),
624
-			] ) ),
625
-		] ) );
621
+			Metadata::ofDependencyMetadata(DependencyMetadata::merge([
622
+				DependencyMetadata::ofEntityId($context->getEntity()->getId()),
623
+				DependencyMetadata::ofEntityId($result->getConstraint()->getPropertyId()),
624
+			])),
625
+		]));
626 626
 	}
627 627
 
628
-	private function downgradeResultStatus( Context $context, CheckResult &$result ) {
628
+	private function downgradeResultStatus(Context $context, CheckResult &$result) {
629 629
 		$constraint = $result->getConstraint();
630 630
 		try {
631 631
 			$constraintStatus = $this->constraintParameterParser
632
-				->parseConstraintStatusParameter( $constraint->getConstraintParameters() );
633
-		} catch ( ConstraintParameterException $e ) {
634
-			$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage() );
632
+				->parseConstraintStatusParameter($constraint->getConstraintParameters());
633
+		} catch (ConstraintParameterException $e) {
634
+			$result = new CheckResult($context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getViolationMessage());
635 635
 			$constraintStatus = null;
636 636
 		}
637
-		if ( $constraintStatus === null ) {
637
+		if ($constraintStatus === null) {
638 638
 			// downgrade violation to warning
639
-			if ( $result->getStatus() === CheckResult::STATUS_VIOLATION ) {
640
-				$result->setStatus( CheckResult::STATUS_WARNING );
639
+			if ($result->getStatus() === CheckResult::STATUS_VIOLATION) {
640
+				$result->setStatus(CheckResult::STATUS_WARNING);
641 641
 			}
642
-		} elseif ( $constraintStatus === 'suggestion' ) {
642
+		} elseif ($constraintStatus === 'suggestion') {
643 643
 			// downgrade violation to suggestion
644
-			if ( $result->getStatus() === CheckResult::STATUS_VIOLATION ) {
645
-				$result->setStatus( CheckResult::STATUS_SUGGESTION );
644
+			if ($result->getStatus() === CheckResult::STATUS_VIOLATION) {
645
+				$result->setStatus(CheckResult::STATUS_SUGGESTION);
646 646
 			}
647
-			$result->addParameter( 'constraint_status', $constraintStatus );
647
+			$result->addParameter('constraint_status', $constraintStatus);
648 648
 		} else {
649
-			if ( $constraintStatus !== 'mandatory' ) {
649
+			if ($constraintStatus !== 'mandatory') {
650 650
 				// @codeCoverageIgnoreStart
651 651
 				throw new LogicException(
652
-					"Unknown constraint status '$constraintStatus', " .
652
+					"Unknown constraint status '$constraintStatus', ".
653 653
 					"only known statuses are 'mandatory' and 'suggestion'"
654 654
 				);
655 655
 				// @codeCoverageIgnoreEnd
656 656
 			}
657
-			$result->addParameter( 'constraint_status', $constraintStatus );
657
+			$result->addParameter('constraint_status', $constraintStatus);
658 658
 		}
659 659
 	}
660 660
 
@@ -663,12 +663,12 @@  discard block
 block discarded – undo
663 663
 	 *
664 664
 	 * @return CheckResult[]
665 665
 	 */
666
-	private function sortResult( array $result ) {
667
-		if ( count( $result ) < 2 ) {
666
+	private function sortResult(array $result) {
667
+		if (count($result) < 2) {
668 668
 			return $result;
669 669
 		}
670 670
 
671
-		$sortFunction = function ( CheckResult $a, CheckResult $b ) {
671
+		$sortFunction = function(CheckResult $a, CheckResult $b) {
672 672
 			$orderNum = 0;
673 673
 			$order = [
674 674
 				CheckResult::STATUS_BAD_PARAMETERS => $orderNum++,
@@ -685,55 +685,55 @@  discard block
 block discarded – undo
685 685
 			$statusA = $a->getStatus();
686 686
 			$statusB = $b->getStatus();
687 687
 
688
-			$orderA = array_key_exists( $statusA, $order ) ? $order[ $statusA ] : $order[ 'other' ];
689
-			$orderB = array_key_exists( $statusB, $order ) ? $order[ $statusB ] : $order[ 'other' ];
688
+			$orderA = array_key_exists($statusA, $order) ? $order[$statusA] : $order['other'];
689
+			$orderB = array_key_exists($statusB, $order) ? $order[$statusB] : $order['other'];
690 690
 
691
-			if ( $orderA === $orderB ) {
691
+			if ($orderA === $orderB) {
692 692
 				$cursorA = $a->getContextCursor();
693 693
 				$cursorB = $b->getContextCursor();
694 694
 
695
-				if ( $cursorA instanceof EntityContextCursor ) {
695
+				if ($cursorA instanceof EntityContextCursor) {
696 696
 					return $cursorB instanceof EntityContextCursor ? 0 : -1;
697 697
 				}
698
-				if ( $cursorB instanceof EntityContextCursor ) {
698
+				if ($cursorB instanceof EntityContextCursor) {
699 699
 					return $cursorA instanceof EntityContextCursor ? 0 : 1;
700 700
 				}
701 701
 
702 702
 				$pidA = $cursorA->getSnakPropertyId();
703 703
 				$pidB = $cursorB->getSnakPropertyId();
704 704
 
705
-				if ( $pidA === $pidB ) {
705
+				if ($pidA === $pidB) {
706 706
 					$hashA = $cursorA->getSnakHash();
707 707
 					$hashB = $cursorB->getSnakHash();
708 708
 
709
-					if ( $hashA === $hashB ) {
710
-						if ( $a instanceof NullResult ) {
709
+					if ($hashA === $hashB) {
710
+						if ($a instanceof NullResult) {
711 711
 							return $b instanceof NullResult ? 0 : -1;
712 712
 						}
713
-						if ( $b instanceof NullResult ) {
713
+						if ($b instanceof NullResult) {
714 714
 							return $a instanceof NullResult ? 0 : 1;
715 715
 						}
716 716
 
717 717
 						$typeA = $a->getConstraint()->getConstraintTypeItemId();
718 718
 						$typeB = $b->getConstraint()->getConstraintTypeItemId();
719 719
 
720
-						if ( $typeA == $typeB ) {
720
+						if ($typeA == $typeB) {
721 721
 							return 0;
722 722
 						} else {
723
-							return ( $typeA > $typeB ) ? 1 : -1;
723
+							return ($typeA > $typeB) ? 1 : -1;
724 724
 						}
725 725
 					} else {
726
-						return ( $hashA > $hashB ) ? 1 : -1;
726
+						return ($hashA > $hashB) ? 1 : -1;
727 727
 					}
728 728
 				} else {
729
-					return ( $pidA > $pidB ) ? 1 : -1;
729
+					return ($pidA > $pidB) ? 1 : -1;
730 730
 				}
731 731
 			} else {
732
-				return ( $orderA > $orderB ) ? 1 : -1;
732
+				return ($orderA > $orderB) ? 1 : -1;
733 733
 			}
734 734
 		};
735 735
 
736
-		uasort( $result, $sortFunction );
736
+		uasort($result, $sortFunction);
737 737
 
738 738
 		return $result;
739 739
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ContemporaryChecker.php 1 patch
Spacing   +42 added lines, -43 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @codeCoverageIgnore This method is purely declarative.
80 80
 	 */
81 81
 	public function getDefaultContextTypes() {
82
-		return [ Context::TYPE_STATEMENT ];
82
+		return [Context::TYPE_STATEMENT];
83 83
 	}
84 84
 
85 85
 	/**
@@ -91,31 +91,31 @@  discard block
 block discarded – undo
91 91
 	 * @return CheckResult
92 92
 	 * @throws \ConfigException
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
 		$snak = $context->getSnak();
99
-		if ( !$snak instanceof PropertyValueSnak ) {
99
+		if (!$snak instanceof PropertyValueSnak) {
100 100
 			// nothing to check
101
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
101
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
102 102
 		}
103 103
 
104 104
 		$dataValue = $snak->getDataValue();
105
-		if ( !$dataValue instanceof EntityIdValue ) {
105
+		if (!$dataValue instanceof EntityIdValue) {
106 106
 			// wrong data type
107
-			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
108
-				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
109
-				->withDataValueType( 'wikibase-entityid' );
110
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
107
+			$message = (new ViolationMessage('wbqc-violation-message-value-needed-of-type'))
108
+				->withEntityId(new ItemId($constraint->getConstraintTypeItemId()), Role::CONSTRAINT_TYPE_ITEM)
109
+				->withDataValueType('wikibase-entityid');
110
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
111 111
 		}
112 112
 
113 113
 		$objectId = $dataValue->getEntityId();
114
-		$objectItem = $this->entityLookup->getEntity( $objectId );
115
-		if ( !( $objectItem instanceof StatementListProvider ) ) {
114
+		$objectItem = $this->entityLookup->getEntity($objectId);
115
+		if (!($objectItem instanceof StatementListProvider)) {
116 116
 			// object was deleted/doesn't exist
117
-			$message = new ViolationMessage( 'wbqc-violation-message-value-entity-must-exist' );
118
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
117
+			$message = new ViolationMessage('wbqc-violation-message-value-entity-must-exist');
118
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
119 119
 		}
120 120
 		/** @var Statement[] $objectStatements */
121 121
 		$objectStatements = $objectItem->getStatements()->toArray();
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 		$subjectId = $context->getEntity()->getId();
124 124
 		$subjectStatements = $context->getEntity()->getStatements()->toArray();
125 125
 		/** @var String[] $startPropertyIds */
126
-		$startPropertyIds = $this->config->get( self::CONFIG_VARIABLE_START_PROPERTY_IDS );
126
+		$startPropertyIds = $this->config->get(self::CONFIG_VARIABLE_START_PROPERTY_IDS);
127 127
 		/** @var String[] $endPropertyIds */
128
-		$endPropertyIds = $this->config->get( self::CONFIG_VARIABLE_END_PROPERTY_IDS );
128
+		$endPropertyIds = $this->config->get(self::CONFIG_VARIABLE_END_PROPERTY_IDS);
129 129
 		$subjectStartValue = $this->getExtremeValue(
130 130
 			$startPropertyIds,
131 131
 			$subjectStatements,
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
 			'end'
148 148
 		);
149 149
 		if (
150
-			$this->rangeCheckerHelper->getComparison( $subjectStartValue, $subjectEndValue ) <= 0 &&
151
-			$this->rangeCheckerHelper->getComparison( $objectStartValue, $objectEndValue ) <= 0 && (
152
-				$this->rangeCheckerHelper->getComparison( $subjectEndValue, $objectStartValue ) < 0 ||
153
-				$this->rangeCheckerHelper->getComparison( $objectEndValue, $subjectStartValue ) < 0
150
+			$this->rangeCheckerHelper->getComparison($subjectStartValue, $subjectEndValue) <= 0 &&
151
+			$this->rangeCheckerHelper->getComparison($objectStartValue, $objectEndValue) <= 0 && (
152
+				$this->rangeCheckerHelper->getComparison($subjectEndValue, $objectStartValue) < 0 ||
153
+				$this->rangeCheckerHelper->getComparison($objectEndValue, $subjectStartValue) < 0
154 154
 			)
155 155
 		) {
156 156
 			if (
157 157
 				$subjectEndValue == null ||
158
-				$this->rangeCheckerHelper->getComparison( $objectEndValue, $subjectEndValue ) < 0
158
+				$this->rangeCheckerHelper->getComparison($objectEndValue, $subjectEndValue) < 0
159 159
 			) {
160 160
 				$earlierEntityId = $objectId;
161 161
 				$minEndValue = $objectEndValue;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			$message = null;
179 179
 			$status = CheckResult::STATUS_COMPLIANCE;
180 180
 		}
181
-		return new CheckResult( $context, $constraint, [], $status, $message );
181
+		return new CheckResult($context, $constraint, [], $status, $message);
182 182
 	}
183 183
 
184 184
 	/**
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return DataValue|null
190 190
 	 */
191
-	private function getExtremeValue( $extremePropertyIds, $statements, $startOrEnd ) {
192
-		if ( $startOrEnd !== 'start' && $startOrEnd !== 'end' ) {
193
-			throw new \InvalidArgumentException( '$startOrEnd must be \'start\' or \'end\'.' );
191
+	private function getExtremeValue($extremePropertyIds, $statements, $startOrEnd) {
192
+		if ($startOrEnd !== 'start' && $startOrEnd !== 'end') {
193
+			throw new \InvalidArgumentException('$startOrEnd must be \'start\' or \'end\'.');
194 194
 		}
195 195
 		$extremeValue = null;
196
-		foreach ( $extremePropertyIds as $extremePropertyId ) {
197
-			$statementList = new StatementList( $statements );
198
-			$extremeStatements = $statementList->getByPropertyId( new PropertyId( $extremePropertyId ) );
196
+		foreach ($extremePropertyIds as $extremePropertyId) {
197
+			$statementList = new StatementList($statements);
198
+			$extremeStatements = $statementList->getByPropertyId(new PropertyId($extremePropertyId));
199 199
 			/** @var Statement $extremeStatement */
200
-			foreach ( $extremeStatements as $extremeStatement ) {
201
-				if ( $extremeStatement->getRank() !== Statement::RANK_DEPRECATED ) {
200
+			foreach ($extremeStatements as $extremeStatement) {
201
+				if ($extremeStatement->getRank() !== Statement::RANK_DEPRECATED) {
202 202
 					$snak = $extremeStatement->getMainSnak();
203
-					if ( !$snak instanceof PropertyValueSnak ) {
203
+					if (!$snak instanceof PropertyValueSnak) {
204 204
 						return null;
205 205
 					} else {
206 206
 						$comparison = $this->rangeCheckerHelper->getComparison(
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 						);
210 210
 						if (
211 211
 							$extremeValue === null ||
212
-							( $startOrEnd === 'start' && $comparison < 0 ) ||
213
-							( $startOrEnd === 'end' && $comparison > 0 )
212
+							($startOrEnd === 'start' && $comparison < 0) ||
213
+							($startOrEnd === 'end' && $comparison > 0)
214 214
 						) {
215 215
 							$extremeValue = $snak->getDataValue();
216 216
 						}
@@ -240,17 +240,16 @@  discard block
 block discarded – undo
240 240
 		DataValue $maxStartValue
241 241
 	) {
242 242
 		$messageKey = $earlierEntityId === $subjectId ?
243
-			'wbqc-violation-message-contemporary-subject-earlier' :
244
-			'wbqc-violation-message-contemporary-value-earlier';
245
-		return ( new ViolationMessage( $messageKey ) )
246
-			->withEntityId( $subjectId, Role::SUBJECT )
247
-			->withEntityId( $propertyId, Role::PREDICATE )
248
-			->withEntityId( $objectId, Role::OBJECT )
249
-			->withDataValue( $minEndValue, Role::OBJECT )
250
-			->withDataValue( $maxStartValue, Role::OBJECT );
243
+			'wbqc-violation-message-contemporary-subject-earlier' : 'wbqc-violation-message-contemporary-value-earlier';
244
+		return (new ViolationMessage($messageKey))
245
+			->withEntityId($subjectId, Role::SUBJECT)
246
+			->withEntityId($propertyId, Role::PREDICATE)
247
+			->withEntityId($objectId, Role::OBJECT)
248
+			->withDataValue($minEndValue, Role::OBJECT)
249
+			->withDataValue($maxStartValue, Role::OBJECT);
251 250
 	}
252 251
 
253
-	public function checkConstraintParameters( Constraint $constraint ) {
252
+	public function checkConstraintParameters(Constraint $constraint) {
254 253
 		// no parameters
255 254
 		return [];
256 255
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ConflictsWithChecker.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 * @throws ConstraintParameterException
72 72
 	 * @return CheckResult
73 73
 	 */
74
-	public function checkConstraint( Context $context, Constraint $constraint ) {
75
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
76
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
74
+	public function checkConstraint(Context $context, Constraint $constraint) {
75
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
76
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
77 77
 		}
78 78
 
79 79
 		$parameters = [];
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 			$constraintParameters,
85 85
 			$constraintTypeItemId
86 86
 		);
87
-		$parameters['property'] = [ $propertyId ];
87
+		$parameters['property'] = [$propertyId];
88 88
 
89 89
 		$items = $this->constraintParameterParser->parseItemsParameter(
90 90
 			$constraintParameters,
@@ -95,22 +95,22 @@  discard block
 block discarded – undo
95 95
 
96 96
 		$statementList = $context->getEntity()
97 97
 			->getStatements()
98
-			->getByRank( [ Statement::RANK_PREFERRED, Statement::RANK_NORMAL ] );
98
+			->getByRank([Statement::RANK_PREFERRED, Statement::RANK_NORMAL]);
99 99
 
100 100
 		/*
101 101
 		 * 'Conflicts with' can be defined with
102 102
 		 *   a) a property only
103 103
 		 *   b) a property and a number of items (each combination of property and item forming an individual claim)
104 104
 		 */
105
-		if ( $items === [] ) {
105
+		if ($items === []) {
106 106
 			$offendingStatement = $this->connectionCheckerHelper->findStatementWithProperty(
107 107
 				$statementList,
108 108
 				$propertyId
109 109
 			);
110
-			if ( $offendingStatement !== null ) {
111
-				$message = ( new ViolationMessage( 'wbqc-violation-message-conflicts-with-property' ) )
112
-					->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
113
-					->withEntityId( $propertyId, Role::PREDICATE );
110
+			if ($offendingStatement !== null) {
111
+				$message = (new ViolationMessage('wbqc-violation-message-conflicts-with-property'))
112
+					->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY)
113
+					->withEntityId($propertyId, Role::PREDICATE);
114 114
 				$status = CheckResult::STATUS_VIOLATION;
115 115
 			} else {
116 116
 				$message = null;
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 				$propertyId,
123 123
 				$items
124 124
 			);
125
-			if ( $offendingStatement !== null ) {
126
-				$offendingValue = ItemIdSnakValue::fromSnak( $offendingStatement->getMainSnak() );
127
-				$message = ( new ViolationMessage( 'wbqc-violation-message-conflicts-with-claim' ) )
128
-					->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
129
-					->withEntityId( $propertyId, Role::PREDICATE )
130
-					->withItemIdSnakValue( $offendingValue, Role::OBJECT );
125
+			if ($offendingStatement !== null) {
126
+				$offendingValue = ItemIdSnakValue::fromSnak($offendingStatement->getMainSnak());
127
+				$message = (new ViolationMessage('wbqc-violation-message-conflicts-with-claim'))
128
+					->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY)
129
+					->withEntityId($propertyId, Role::PREDICATE)
130
+					->withItemIdSnakValue($offendingValue, Role::OBJECT);
131 131
 				$status = CheckResult::STATUS_VIOLATION;
132 132
 			} else {
133 133
 				$message = null;
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 			}
136 136
 		}
137 137
 
138
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
138
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
139 139
 	}
140 140
 
141
-	public function checkConstraintParameters( Constraint $constraint ) {
141
+	public function checkConstraintParameters(Constraint $constraint) {
142 142
 		$constraintParameters = $constraint->getConstraintParameters();
143 143
 		$constraintTypeItemId = $constraint->getConstraintTypeItemId();
144 144
 		$exceptions = [];
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 				$constraintParameters,
148 148
 				$constraintTypeItemId
149 149
 			);
150
-		} catch ( ConstraintParameterException $e ) {
150
+		} catch (ConstraintParameterException $e) {
151 151
 			$exceptions[] = $e;
152 152
 		}
153 153
 		try {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 				$constraintTypeItemId,
157 157
 				false
158 158
 			);
159
-		} catch ( ConstraintParameterException $e ) {
159
+		} catch (ConstraintParameterException $e) {
160 160
 			$exceptions[] = $e;
161 161
 		}
162 162
 		return $exceptions;
Please login to merge, or discard this patch.