Completed
Push — master ( 4c9187...22d349 )
by
unknown
08:02 queued 10s
created
src/ConstraintCheck/Checker/SingleBestValueChecker.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @return CheckResult
68 68
 	 */
69
-	public function checkConstraint( Context $context, Constraint $constraint ) {
70
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
71
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
69
+	public function checkConstraint(Context $context, Constraint $constraint) {
70
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
71
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
72 72
 		}
73 73
 
74 74
 		$parameters = [];
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 
81 81
 		$propertyId = $context->getSnak()->getPropertyId();
82 82
 		$bestRankCount = $this->valueCountCheckerHelper->getPropertyCount(
83
-			$context->getSnakGroup( Context::GROUP_BEST_RANK, $separators ),
83
+			$context->getSnakGroup(Context::GROUP_BEST_RANK, $separators),
84 84
 			$propertyId
85 85
 		);
86 86
 
87
-		if ( $bestRankCount > 1 ) {
87
+		if ($bestRankCount > 1) {
88 88
 			$nonDeprecatedCount = $this->valueCountCheckerHelper->getPropertyCount(
89
-				$context->getSnakGroup( Context::GROUP_NON_DEPRECATED ),
89
+				$context->getSnakGroup(Context::GROUP_NON_DEPRECATED),
90 90
 				$propertyId
91 91
 			);
92 92
 			$message = $this->getViolationMessage(
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 			$status = CheckResult::STATUS_COMPLIANCE;
102 102
 		}
103 103
 
104
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
104
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
105 105
 	}
106 106
 
107
-	public function checkConstraintParameters( Constraint $constraint ) {
107
+	public function checkConstraintParameters(Constraint $constraint) {
108 108
 		$constraintParameters = $constraint->getConstraintParameters();
109 109
 		$exceptions = [];
110 110
 		try {
111
-			$this->constraintParameterParser->parseSeparatorsParameter( $constraintParameters );
112
-		} catch ( ConstraintParameterException $e ) {
111
+			$this->constraintParameterParser->parseSeparatorsParameter($constraintParameters);
112
+		} catch (ConstraintParameterException $e) {
113 113
 			$exceptions[] = $e;
114 114
 		}
115 115
 		return $exceptions;
@@ -128,23 +128,23 @@  discard block
 block discarded – undo
128 128
 		$separators,
129 129
 		$propertyId
130 130
 	) {
131
-		if ( $bestRankCount === $nonDeprecatedCount ) {
132
-			if ( $separators === [] ) {
131
+		if ($bestRankCount === $nonDeprecatedCount) {
132
+			if ($separators === []) {
133 133
 				$messageKey = 'wbqc-violation-message-single-best-value-no-preferred';
134 134
 			} else {
135 135
 				$messageKey = 'wbqc-violation-message-single-best-value-no-preferred-separators';
136 136
 			}
137 137
 		} else {
138
-			if ( $separators === [] ) {
138
+			if ($separators === []) {
139 139
 				$messageKey = 'wbqc-violation-message-single-best-value-multi-preferred';
140 140
 			} else {
141 141
 				$messageKey = 'wbqc-violation-message-single-best-value-multi-preferred-separators';
142 142
 			}
143 143
 		}
144 144
 
145
-		return ( new ViolationMessage( $messageKey ) )
146
-			->withEntityId( $propertyId )
147
-			->withEntityIdList( $separators );
145
+		return (new ViolationMessage($messageKey))
146
+			->withEntityId($propertyId)
147
+			->withEntityIdList($separators);
148 148
 	}
149 149
 
150 150
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/SingleValueChecker.php 1 patch
Spacing   +15 added lines, -16 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 * @throws ConstraintParameterException
68 68
 	 * @return CheckResult
69 69
 	 */
70
-	public function checkConstraint( Context $context, Constraint $constraint ) {
71
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
72
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
70
+	public function checkConstraint(Context $context, Constraint $constraint) {
71
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
72
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
73 73
 		}
74 74
 
75 75
 		$parameters = [];
@@ -81,19 +81,19 @@  discard block
 block discarded – undo
81 81
 
82 82
 		$propertyId = $context->getSnak()->getPropertyId();
83 83
 		$propertyCount = $this->valueCountCheckerHelper->getPropertyCount(
84
-			$context->getSnakGroup( Context::GROUP_NON_DEPRECATED, $separators ),
84
+			$context->getSnakGroup(Context::GROUP_NON_DEPRECATED, $separators),
85 85
 			$propertyId
86 86
 		);
87 87
 
88
-		if ( $propertyCount > 1 ) {
89
-			$message = $this->getViolationMessage( $separators, $propertyId );
88
+		if ($propertyCount > 1) {
89
+			$message = $this->getViolationMessage($separators, $propertyId);
90 90
 			$status = CheckResult::STATUS_VIOLATION;
91 91
 		} else {
92 92
 			$message = null;
93 93
 			$status = CheckResult::STATUS_COMPLIANCE;
94 94
 		}
95 95
 
96
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
96
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
97 97
 	}
98 98
 
99 99
 	/**
@@ -101,22 +101,21 @@  discard block
 block discarded – undo
101 101
 	 * @param PropertyId $propertyId
102 102
 	 * @return ViolationMessage
103 103
 	 */
104
-	private function getViolationMessage( array $separators, PropertyId $propertyId ) {
104
+	private function getViolationMessage(array $separators, PropertyId $propertyId) {
105 105
 		$messageKey = $separators === [] ?
106
-			'wbqc-violation-message-single-value' :
107
-			'wbqc-violation-message-single-value-separators';
106
+			'wbqc-violation-message-single-value' : 'wbqc-violation-message-single-value-separators';
108 107
 
109
-		return ( new ViolationMessage( $messageKey ) )
110
-			->withEntityId( $propertyId )
111
-			->withEntityIdList( $separators );
108
+		return (new ViolationMessage($messageKey))
109
+			->withEntityId($propertyId)
110
+			->withEntityIdList($separators);
112 111
 	}
113 112
 
114
-	public function checkConstraintParameters( Constraint $constraint ) {
113
+	public function checkConstraintParameters(Constraint $constraint) {
115 114
 		$constraintParameters = $constraint->getConstraintParameters();
116 115
 		$exceptions = [];
117 116
 		try {
118
-			$this->constraintParameterParser->parseSeparatorsParameter( $constraintParameters );
119
-		} catch ( ConstraintParameterException $e ) {
117
+			$this->constraintParameterParser->parseSeparatorsParameter($constraintParameters);
118
+		} catch (ConstraintParameterException $e) {
120 119
 			$exceptions[] = $e;
121 120
 		}
122 121
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/MultiValueChecker.php 1 patch
Spacing   +14 added lines, -15 removed lines patch added patch discarded remove patch
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @return CheckResult
67 67
 	 */
68
-	public function checkConstraint( Context $context, Constraint $constraint ) {
69
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
70
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
68
+	public function checkConstraint(Context $context, Constraint $constraint) {
69
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
70
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
71 71
 		}
72 72
 
73 73
 		$parameters = [];
@@ -79,33 +79,32 @@  discard block
 block discarded – undo
79 79
 
80 80
 		$propertyId = $context->getSnak()->getPropertyId();
81 81
 		$propertyCount = $this->valueCountCheckerHelper->getPropertyCount(
82
-			$context->getSnakGroup( Context::GROUP_NON_DEPRECATED, $separators ),
82
+			$context->getSnakGroup(Context::GROUP_NON_DEPRECATED, $separators),
83 83
 			$propertyId
84 84
 		);
85 85
 
86
-		if ( $propertyCount <= 1 ) {
87
-			$message = ( new ViolationMessage(
86
+		if ($propertyCount <= 1) {
87
+			$message = (new ViolationMessage(
88 88
 					$separators === [] ?
89
-						'wbqc-violation-message-multi-value' :
90
-						'wbqc-violation-message-multi-value-separators'
91
-				) )
92
-				->withEntityId( $propertyId )
93
-				->withEntityIdList( $separators );
89
+						'wbqc-violation-message-multi-value' : 'wbqc-violation-message-multi-value-separators'
90
+				))
91
+				->withEntityId($propertyId)
92
+				->withEntityIdList($separators);
94 93
 			$status = CheckResult::STATUS_VIOLATION;
95 94
 		} else {
96 95
 			$message = null;
97 96
 			$status = CheckResult::STATUS_COMPLIANCE;
98 97
 		}
99 98
 
100
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
99
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
101 100
 	}
102 101
 
103
-	public function checkConstraintParameters( Constraint $constraint ) {
102
+	public function checkConstraintParameters(Constraint $constraint) {
104 103
 		$constraintParameters = $constraint->getConstraintParameters();
105 104
 		$exceptions = [];
106 105
 		try {
107
-			$this->constraintParameterParser->parseSeparatorsParameter( $constraintParameters );
108
-		} catch ( ConstraintParameterException $e ) {
106
+			$this->constraintParameterParser->parseSeparatorsParameter($constraintParameters);
107
+		} catch (ConstraintParameterException $e) {
109 108
 			$exceptions[] = $e;
110 109
 		}
111 110
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ConflictsWithChecker.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -88,39 +88,39 @@  discard block
 block discarded – undo
88 88
 	 * @throws ConstraintParameterException
89 89
 	 * @return CheckResult
90 90
 	 */
91
-	public function checkConstraint( Context $context, Constraint $constraint ) {
92
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
93
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
91
+	public function checkConstraint(Context $context, Constraint $constraint) {
92
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
93
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
94 94
 		}
95 95
 
96 96
 		$parameters = [];
97 97
 		$constraintParameters = $constraint->getConstraintParameters();
98 98
 
99
-		$propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
100
-		$parameters['property'] = [ $propertyId ];
99
+		$propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
100
+		$parameters['property'] = [$propertyId];
101 101
 
102
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
102
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
103 103
 		$parameters['items'] = $items;
104 104
 
105 105
 		/** @var StatementList $statementList */
106 106
 		$statementList = $context->getEntity()
107 107
 			->getStatements()
108
-			->getByRank( [ Statement::RANK_PREFERRED, Statement::RANK_NORMAL ] );
108
+			->getByRank([Statement::RANK_PREFERRED, Statement::RANK_NORMAL]);
109 109
 
110 110
 		/*
111 111
 		 * 'Conflicts with' can be defined with
112 112
 		 *   a) a property only
113 113
 		 *   b) a property and a number of items (each combination of property and item forming an individual claim)
114 114
 		 */
115
-		if ( $items === [] ) {
115
+		if ($items === []) {
116 116
 			$offendingStatement = $this->connectionCheckerHelper->findStatementWithProperty(
117 117
 				$statementList,
118 118
 				$propertyId
119 119
 			);
120
-			if ( $offendingStatement !== null ) {
121
-				$message = ( new ViolationMessage( 'wbqc-violation-message-conflicts-with-property' ) )
122
-					->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
123
-					->withEntityId( $propertyId, Role::PREDICATE );
120
+			if ($offendingStatement !== null) {
121
+				$message = (new ViolationMessage('wbqc-violation-message-conflicts-with-property'))
122
+					->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY)
123
+					->withEntityId($propertyId, Role::PREDICATE);
124 124
 				$status = CheckResult::STATUS_VIOLATION;
125 125
 			} else {
126 126
 				$message = null;
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 				$propertyId,
133 133
 				$items
134 134
 			);
135
-			if ( $offendingStatement !== null ) {
136
-				$offendingValue = ItemIdSnakValue::fromSnak( $offendingStatement->getMainSnak() );
137
-				$message = ( new ViolationMessage( 'wbqc-violation-message-conflicts-with-claim' ) )
138
-					->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
139
-					->withEntityId( $propertyId, Role::PREDICATE )
140
-					->withItemIdSnakValue( $offendingValue, Role::OBJECT );
135
+			if ($offendingStatement !== null) {
136
+				$offendingValue = ItemIdSnakValue::fromSnak($offendingStatement->getMainSnak());
137
+				$message = (new ViolationMessage('wbqc-violation-message-conflicts-with-claim'))
138
+					->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY)
139
+					->withEntityId($propertyId, Role::PREDICATE)
140
+					->withItemIdSnakValue($offendingValue, Role::OBJECT);
141 141
 				$status = CheckResult::STATUS_VIOLATION;
142 142
 			} else {
143 143
 				$message = null;
@@ -145,20 +145,20 @@  discard block
 block discarded – undo
145 145
 			}
146 146
 		}
147 147
 
148
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
148
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
149 149
 	}
150 150
 
151
-	public function checkConstraintParameters( Constraint $constraint ) {
151
+	public function checkConstraintParameters(Constraint $constraint) {
152 152
 		$constraintParameters = $constraint->getConstraintParameters();
153 153
 		$exceptions = [];
154 154
 		try {
155
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
156
-		} catch ( ConstraintParameterException $e ) {
155
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
156
+		} catch (ConstraintParameterException $e) {
157 157
 			$exceptions[] = $e;
158 158
 		}
159 159
 		try {
160
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
161
-		} catch ( ConstraintParameterException $e ) {
160
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
161
+		} catch (ConstraintParameterException $e) {
162 162
 			$exceptions[] = $e;
163 163
 		}
164 164
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintReportFactory.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	public static function getDefaultInstance() {
148 148
 		static $instance = null;
149 149
 
150
-		if ( $instance === null ) {
150
+		if ($instance === null) {
151 151
 			$wikibaseRepo = WikibaseRepo::getDefaultInstance();
152 152
 			$config = MediaWikiServices::getInstance()->getMainConfig();
153 153
 			$titleParser = MediaWikiServices::getInstance()->getTitleParser();
@@ -210,21 +210,21 @@  discard block
 block discarded – undo
210 210
 	 * @return DelegatingConstraintChecker
211 211
 	 */
212 212
 	public function getConstraintChecker() {
213
-		if ( $this->delegatingConstraintChecker === null ) {
213
+		if ($this->delegatingConstraintChecker === null) {
214 214
 			$this->delegatingConstraintChecker = new DelegatingConstraintChecker(
215 215
 				$this->lookup,
216 216
 				$this->getConstraintCheckerMap(),
217
-				new CachingConstraintLookup( $this->getConstraintRepository() ),
217
+				new CachingConstraintLookup($this->getConstraintRepository()),
218 218
 				$this->constraintParameterParser,
219 219
 				$this->statementGuidParser,
220 220
 				new LoggingHelper(
221 221
 					$this->dataFactory,
222
-					LoggerFactory::getInstance( 'WikibaseQualityConstraints' ),
222
+					LoggerFactory::getInstance('WikibaseQualityConstraints'),
223 223
 					$this->config
224 224
 				),
225
-				$this->config->get( 'WBQualityConstraintsCheckQualifiers' ),
226
-				$this->config->get( 'WBQualityConstraintsCheckReferences' ),
227
-				$this->config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' )
225
+				$this->config->get('WBQualityConstraintsCheckQualifiers'),
226
+				$this->config->get('WBQualityConstraintsCheckReferences'),
227
+				$this->config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers')
228 228
 			);
229 229
 		}
230 230
 
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 	 * @return ConstraintChecker[]
236 236
 	 */
237 237
 	private function getConstraintCheckerMap() {
238
-		if ( $this->constraintCheckerMap === null ) {
238
+		if ($this->constraintCheckerMap === null) {
239 239
 			$connectionCheckerHelper = new ConnectionCheckerHelper();
240
-			$rangeCheckerHelper = new RangeCheckerHelper( $this->config, $this->unitConverter );
241
-			if ( $this->config->get( 'WBQualityConstraintsSparqlEndpoint' ) !== '' ) {
240
+			$rangeCheckerHelper = new RangeCheckerHelper($this->config, $this->unitConverter);
241
+			if ($this->config->get('WBQualityConstraintsSparqlEndpoint') !== '') {
242 242
 				$sparqlHelper = new SparqlHelper(
243 243
 					$this->config,
244 244
 					$this->rdfVocabulary,
@@ -260,112 +260,112 @@  discard block
 block discarded – undo
260 260
 			);
261 261
 
262 262
 			$this->constraintCheckerMap = [
263
-				$this->config->get( 'WBQualityConstraintsConflictsWithConstraintId' )
263
+				$this->config->get('WBQualityConstraintsConflictsWithConstraintId')
264 264
 					=> new ConflictsWithChecker(
265 265
 						$this->lookup,
266 266
 						$this->constraintParameterParser,
267 267
 						$connectionCheckerHelper
268 268
 					),
269
-				$this->config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' )
269
+				$this->config->get('WBQualityConstraintsItemRequiresClaimConstraintId')
270 270
 					=> new ItemChecker(
271 271
 						$this->lookup,
272 272
 						$this->constraintParameterParser,
273 273
 						$connectionCheckerHelper
274 274
 					),
275
-				$this->config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' )
275
+				$this->config->get('WBQualityConstraintsValueRequiresClaimConstraintId')
276 276
 					=> new TargetRequiredClaimChecker(
277 277
 						$this->lookup,
278 278
 						$this->constraintParameterParser,
279 279
 						$connectionCheckerHelper
280 280
 					),
281
-				$this->config->get( 'WBQualityConstraintsSymmetricConstraintId' )
281
+				$this->config->get('WBQualityConstraintsSymmetricConstraintId')
282 282
 					=> new SymmetricChecker(
283 283
 						$this->lookup,
284 284
 						$connectionCheckerHelper
285 285
 					),
286
-				$this->config->get( 'WBQualityConstraintsInverseConstraintId' )
286
+				$this->config->get('WBQualityConstraintsInverseConstraintId')
287 287
 					=> new InverseChecker(
288 288
 						$this->lookup,
289 289
 						$this->constraintParameterParser,
290 290
 						$connectionCheckerHelper
291 291
 					),
292
-				$this->config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' )
292
+				$this->config->get('WBQualityConstraintsUsedAsQualifierConstraintId')
293 293
 					=> new QualifierChecker(),
294
-				$this->config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' )
294
+				$this->config->get('WBQualityConstraintsAllowedQualifiersConstraintId')
295 295
 					=> new QualifiersChecker(
296 296
 						$this->constraintParameterParser
297 297
 					),
298
-				$this->config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' )
298
+				$this->config->get('WBQualityConstraintsMandatoryQualifierConstraintId')
299 299
 					=> new MandatoryQualifiersChecker(
300 300
 						$this->constraintParameterParser
301 301
 					),
302
-				$this->config->get( 'WBQualityConstraintsRangeConstraintId' )
302
+				$this->config->get('WBQualityConstraintsRangeConstraintId')
303 303
 					=> new RangeChecker(
304 304
 						$this->propertyDataTypeLookup,
305 305
 						$this->constraintParameterParser,
306 306
 						$rangeCheckerHelper
307 307
 					),
308
-				$this->config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' )
308
+				$this->config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId')
309 309
 					=> new DiffWithinRangeChecker(
310 310
 						$this->constraintParameterParser,
311 311
 						$rangeCheckerHelper,
312 312
 						$this->config
313 313
 					),
314
-				$this->config->get( 'WBQualityConstraintsTypeConstraintId' )
314
+				$this->config->get('WBQualityConstraintsTypeConstraintId')
315 315
 					=> new TypeChecker(
316 316
 						$this->lookup,
317 317
 						$this->constraintParameterParser,
318 318
 						$typeCheckerHelper,
319 319
 						$this->config
320 320
 					),
321
-				$this->config->get( 'WBQualityConstraintsValueTypeConstraintId' )
321
+				$this->config->get('WBQualityConstraintsValueTypeConstraintId')
322 322
 					=> new ValueTypeChecker(
323 323
 						$this->lookup,
324 324
 						$this->constraintParameterParser,
325 325
 						$typeCheckerHelper,
326 326
 						$this->config
327 327
 					),
328
-				$this->config->get( 'WBQualityConstraintsSingleValueConstraintId' )
329
-					=> new SingleValueChecker( $this->constraintParameterParser ),
330
-				$this->config->get( 'WBQualityConstraintsMultiValueConstraintId' )
331
-					=> new MultiValueChecker( $this->constraintParameterParser ),
332
-				$this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' )
328
+				$this->config->get('WBQualityConstraintsSingleValueConstraintId')
329
+					=> new SingleValueChecker($this->constraintParameterParser),
330
+				$this->config->get('WBQualityConstraintsMultiValueConstraintId')
331
+					=> new MultiValueChecker($this->constraintParameterParser),
332
+				$this->config->get('WBQualityConstraintsDistinctValuesConstraintId')
333 333
 					=> new UniqueValueChecker(
334 334
 						$sparqlHelper
335 335
 					),
336
-				$this->config->get( 'WBQualityConstraintsFormatConstraintId' )
336
+				$this->config->get('WBQualityConstraintsFormatConstraintId')
337 337
 					=> new FormatChecker(
338 338
 						$this->constraintParameterParser,
339 339
 						$this->config,
340 340
 						$sparqlHelper
341 341
 					),
342
-				$this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' )
342
+				$this->config->get('WBQualityConstraintsCommonsLinkConstraintId')
343 343
 					=> new CommonsLinkChecker(
344 344
 						$this->constraintParameterParser,
345 345
 						$this->titleParser
346 346
 					),
347
-				$this->config->get( 'WBQualityConstraintsOneOfConstraintId' )
347
+				$this->config->get('WBQualityConstraintsOneOfConstraintId')
348 348
 					=> new OneOfChecker(
349 349
 						$this->constraintParameterParser
350 350
 					),
351
-				$this->config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' )
351
+				$this->config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId')
352 352
 					=> new ValueOnlyChecker(),
353
-				$this->config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' )
353
+				$this->config->get('WBQualityConstraintsUsedAsReferenceConstraintId')
354 354
 					=> new ReferenceChecker(),
355
-				$this->config->get( 'WBQualityConstraintsNoBoundsConstraintId' )
355
+				$this->config->get('WBQualityConstraintsNoBoundsConstraintId')
356 356
 					=> new NoBoundsChecker(),
357
-				$this->config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' )
357
+				$this->config->get('WBQualityConstraintsAllowedUnitsConstraintId')
358 358
 					=> new AllowedUnitsChecker(
359 359
 						$this->constraintParameterParser,
360 360
 						$this->unitConverter
361 361
 					),
362
-				$this->config->get( 'WBQualityConstraintsSingleBestValueConstraintId' )
363
-					=> new SingleBestValueChecker( $this->constraintParameterParser ),
364
-				$this->config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' )
362
+				$this->config->get('WBQualityConstraintsSingleBestValueConstraintId')
363
+					=> new SingleBestValueChecker($this->constraintParameterParser),
364
+				$this->config->get('WBQualityConstraintsAllowedEntityTypesConstraintId')
365 365
 					=> new EntityTypeChecker(
366 366
 						$this->constraintParameterParser
367 367
 					),
368
-				$this->config->get( 'WBQualityConstraintsNoneOfConstraintId' )
368
+				$this->config->get('WBQualityConstraintsNoneOfConstraintId')
369 369
 					=> new NoneOfChecker(
370 370
 						$this->constraintParameterParser
371 371
 					),
@@ -379,26 +379,26 @@  discard block
 block discarded – undo
379 379
 	 * @return array[]
380 380
 	 */
381 381
 	public function getConstraintParameterMap() {
382
-		if ( $this->constraintParameterMap === null ) {
382
+		if ($this->constraintParameterMap === null) {
383 383
 			$this->constraintParameterMap = [
384
-				'Commons link' => [ 'namespace' ],
385
-				'Conflicts with' => [ 'property', 'item' ],
386
-				'Diff within range' => [ 'property', 'minimum_quantity', 'maximum_quantity' ],
387
-				'Format' => [ 'pattern' ],
388
-				'Inverse' => [ 'property' ],
389
-				'Item' => [ 'property', 'item' ],
390
-				'Mandatory qualifiers' => [ 'property' ],
384
+				'Commons link' => ['namespace'],
385
+				'Conflicts with' => ['property', 'item'],
386
+				'Diff within range' => ['property', 'minimum_quantity', 'maximum_quantity'],
387
+				'Format' => ['pattern'],
388
+				'Inverse' => ['property'],
389
+				'Item' => ['property', 'item'],
390
+				'Mandatory qualifiers' => ['property'],
391 391
 				'Multi value' => [],
392
-				'One of' => [ 'item' ],
392
+				'One of' => ['item'],
393 393
 				'Qualifier' => [],
394
-				'Qualifiers' => [ 'property' ],
395
-				'Range' => [ 'minimum_quantity', 'maximum_quantity', 'minimum_date', 'maximum_date' ],
394
+				'Qualifiers' => ['property'],
395
+				'Range' => ['minimum_quantity', 'maximum_quantity', 'minimum_date', 'maximum_date'],
396 396
 				'Single value' => [],
397 397
 				'Symmetric' => [],
398
-				'Target required claim' => [ 'property', 'item' ],
399
-				'Type' => [ 'class', 'relation' ],
398
+				'Target required claim' => ['property', 'item'],
399
+				'Type' => ['class', 'relation'],
400 400
 				'Unique value' => [],
401
-				'Value type' => [ 'class', 'relation' ]
401
+				'Value type' => ['class', 'relation']
402 402
 			];
403 403
 		}
404 404
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 * @return ConstraintRepository
410 410
 	 */
411 411
 	public function getConstraintRepository() {
412
-		if ( $this->constraintRepository === null ) {
412
+		if ($this->constraintRepository === null) {
413 413
 			$this->constraintRepository = new ConstraintRepository();
414 414
 		}
415 415
 
Please login to merge, or discard this patch.
src/Api/CheckConstraints.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -91,28 +91,28 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return self
93 93
 	 */
94
-	public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) {
94
+	public static function newFromGlobalState(ApiMain $main, $name, $prefix = '') {
95 95
 		$repo = WikibaseRepo::getDefaultInstance();
96 96
 
97 97
 		$language = $repo->getUserLanguage();
98 98
 		$formatterOptions = new FormatterOptions();
99
-		$formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() );
99
+		$formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode());
100 100
 		$valueFormatterFactory = $repo->getValueFormatterFactory();
101
-		$valueFormatter = $valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions );
101
+		$valueFormatter = $valueFormatterFactory->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions);
102 102
 
103 103
 		$languageFallbackLabelDescriptionLookupFactory = $repo->getLanguageFallbackLabelDescriptionLookupFactory();
104
-		$labelDescriptionLookup = $languageFallbackLabelDescriptionLookupFactory->newLabelDescriptionLookup( $language );
104
+		$labelDescriptionLookup = $languageFallbackLabelDescriptionLookupFactory->newLabelDescriptionLookup($language);
105 105
 		$entityIdHtmlLinkFormatterFactory = $repo->getEntityIdHtmlLinkFormatterFactory();
106
-		$entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( $labelDescriptionLookup );
106
+		$entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter($labelDescriptionLookup);
107 107
 		$entityIdLabelFormatterFactory = new EntityIdLabelFormatterFactory();
108
-		$entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter( $labelDescriptionLookup );
108
+		$entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter($labelDescriptionLookup);
109 109
 		$config = MediaWikiServices::getInstance()->getMainConfig();
110 110
 		$titleParser = MediaWikiServices::getInstance()->getTitleParser();
111 111
 		$unitConverter = $repo->getUnitConverter();
112 112
 		$dataFactory = MediaWikiServices::getInstance()->getStatsdDataFactory();
113 113
 		$loggingHelper = new LoggingHelper(
114 114
 			$dataFactory,
115
-			LoggerFactory::getInstance( 'WikibaseQualityConstraints' ),
115
+			LoggerFactory::getInstance('WikibaseQualityConstraints'),
116 116
 			$config
117 117
 		);
118 118
 		$constraintReportFactory = new ConstraintReportFactory(
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		$resultsSource = new CheckingResultsSource(
152 152
 			$constraintReportFactory->getConstraintChecker()
153 153
 		);
154
-		if ( $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) {
154
+		if ($config->get('WBQualityConstraintsCacheCheckConstraintsResults')) {
155 155
 			$wikiPageEntityMetaDataAccessor = new WikiPageEntityMetaDataLookup(
156 156
 				$repo->getEntityNamespaceLookup()
157 157
 			);
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 				$checkResultDeserializer,
181 181
 				$wikiPageEntityMetaDataAccessor,
182 182
 				$entityIdParser,
183
-				$config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ),
183
+				$config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'),
184 184
 				[
185
-					$config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ),
186
-					$config->get( 'WBQualityConstraintsTypeConstraintId' ),
187
-					$config->get( 'WBQualityConstraintsValueTypeConstraintId' ),
188
-					$config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ),
185
+					$config->get('WBQualityConstraintsCommonsLinkConstraintId'),
186
+					$config->get('WBQualityConstraintsTypeConstraintId'),
187
+					$config->get('WBQualityConstraintsValueTypeConstraintId'),
188
+					$config->get('WBQualityConstraintsDistinctValuesConstraintId'),
189 189
 				],
190
-				$config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ),
190
+				$config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'),
191 191
 				$loggingHelper
192 192
 			);
193 193
 		}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			$prefix,
199 199
 			$repo->getEntityIdParser(),
200 200
 			$repo->getStatementGuidValidator(),
201
-			$repo->getApiHelperFactory( RequestContext::getMain() ),
201
+			$repo->getApiHelperFactory(RequestContext::getMain()),
202 202
 			$resultsSource,
203 203
 			$checkResultsRenderer,
204 204
 			$dataFactory
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 		CheckResultsRenderer $checkResultsRenderer,
228 228
 		IBufferingStatsdDataFactory $dataFactory
229 229
 	) {
230
-		parent::__construct( $main, $name, $prefix );
230
+		parent::__construct($main, $name, $prefix);
231 231
 		$this->entityIdParser = $entityIdParser;
232 232
 		$this->statementGuidValidator = $statementGuidValidator;
233
-		$this->resultBuilder = $apiHelperFactory->getResultBuilder( $this );
234
-		$this->errorReporter = $apiHelperFactory->getErrorReporter( $this );
233
+		$this->resultBuilder = $apiHelperFactory->getResultBuilder($this);
234
+		$this->errorReporter = $apiHelperFactory->getErrorReporter($this);
235 235
 		$this->resultsSource = $resultsSource;
236 236
 		$this->checkResultsRenderer = $checkResultsRenderer;
237 237
 		$this->dataFactory = $dataFactory;
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 
248 248
 		$params = $this->extractRequestParams();
249 249
 
250
-		$this->validateParameters( $params );
251
-		$entityIds = $this->parseEntityIds( $params );
252
-		$claimIds = $this->parseClaimIds( $params );
250
+		$this->validateParameters($params);
251
+		$entityIds = $this->parseEntityIds($params);
252
+		$claimIds = $this->parseClaimIds($params);
253 253
 		$constraintIDs = $params[self::PARAM_CONSTRAINT_ID];
254 254
 		$statuses = $params[self::PARAM_STATUS];
255 255
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 				)
266 266
 			)->getArray()
267 267
 		);
268
-		$this->resultBuilder->markSuccess( 1 );
268
+		$this->resultBuilder->markSuccess(1);
269 269
 	}
270 270
 
271 271
 	/**
@@ -273,24 +273,24 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return EntityId[]
275 275
 	 */
276
-	private function parseEntityIds( array $params ) {
276
+	private function parseEntityIds(array $params) {
277 277
 		$ids = $params[self::PARAM_ID];
278 278
 
279
-		if ( $ids === null ) {
279
+		if ($ids === null) {
280 280
 			return [];
281
-		} elseif ( $ids === [] ) {
281
+		} elseif ($ids === []) {
282 282
 			$this->errorReporter->dieError(
283
-				'If ' . self::PARAM_ID . ' is specified, it must be nonempty.', 'no-data' );
283
+				'If '.self::PARAM_ID.' is specified, it must be nonempty.', 'no-data' );
284 284
 		}
285 285
 
286
-		return array_map( function ( $id ) {
286
+		return array_map(function($id) {
287 287
 			try {
288
-				return $this->entityIdParser->parse( $id );
289
-			} catch ( EntityIdParsingException $e ) {
288
+				return $this->entityIdParser->parse($id);
289
+			} catch (EntityIdParsingException $e) {
290 290
 				$this->errorReporter->dieError(
291
-					"Invalid id: $id", 'invalid-entity-id', 0, [ self::PARAM_ID => $id ] );
291
+					"Invalid id: $id", 'invalid-entity-id', 0, [self::PARAM_ID => $id] );
292 292
 			}
293
-		}, $ids );
293
+		}, $ids);
294 294
 	}
295 295
 
296 296
 	/**
@@ -298,35 +298,35 @@  discard block
 block discarded – undo
298 298
 	 *
299 299
 	 * @return string[]
300 300
 	 */
301
-	private function parseClaimIds( array $params ) {
301
+	private function parseClaimIds(array $params) {
302 302
 		$ids = $params[self::PARAM_CLAIM_ID];
303 303
 
304
-		if ( $ids === null ) {
304
+		if ($ids === null) {
305 305
 			return [];
306
-		} elseif ( $ids === [] ) {
306
+		} elseif ($ids === []) {
307 307
 			$this->errorReporter->dieError(
308
-				'If ' . self::PARAM_CLAIM_ID . ' is specified, it must be nonempty.', 'no-data' );
308
+				'If '.self::PARAM_CLAIM_ID.' is specified, it must be nonempty.', 'no-data' );
309 309
 		}
310 310
 
311
-		foreach ( $ids as $id ) {
312
-			if ( !$this->statementGuidValidator->validate( $id ) ) {
311
+		foreach ($ids as $id) {
312
+			if (!$this->statementGuidValidator->validate($id)) {
313 313
 				$this->errorReporter->dieError(
314
-					"Invalid claim id: $id", 'invalid-guid', 0, [ self::PARAM_CLAIM_ID => $id ] );
314
+					"Invalid claim id: $id", 'invalid-guid', 0, [self::PARAM_CLAIM_ID => $id] );
315 315
 			}
316 316
 		}
317 317
 
318 318
 		return $ids;
319 319
 	}
320 320
 
321
-	private function validateParameters( array $params ) {
322
-		if ( $params[self::PARAM_CONSTRAINT_ID] !== null
323
-			 && empty( $params[self::PARAM_CONSTRAINT_ID] )
321
+	private function validateParameters(array $params) {
322
+		if ($params[self::PARAM_CONSTRAINT_ID] !== null
323
+			 && empty($params[self::PARAM_CONSTRAINT_ID])
324 324
 		) {
325 325
 			$paramConstraintId = self::PARAM_CONSTRAINT_ID;
326 326
 			$this->errorReporter->dieError(
327 327
 				"If $paramConstraintId is specified, it must be nonempty.", 'no-data' );
328 328
 		}
329
-		if ( $params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null ) {
329
+		if ($params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null) {
330 330
 			$paramId = self::PARAM_ID;
331 331
 			$paramClaimId = self::PARAM_CLAIM_ID;
332 332
 			$this->errorReporter->dieError(
@@ -366,11 +366,11 @@  discard block
 block discarded – undo
366 366
 				],
367 367
 				ApiBase::PARAM_ISMULTI => true,
368 368
 				ApiBase::PARAM_ALL => true,
369
-				ApiBase::PARAM_DFLT => implode( '|', [
369
+				ApiBase::PARAM_DFLT => implode('|', [
370 370
 					CheckResult::STATUS_VIOLATION,
371 371
 					CheckResult::STATUS_WARNING,
372 372
 					CheckResult::STATUS_BAD_PARAMETERS,
373
-				] ),
373
+				]),
374 374
 				ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
375 375
 			],
376 376
 		];
Please login to merge, or discard this patch.