Completed
Push — master ( 5d44c2...328add )
by
unknown
02:15 queued 12s
created
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/Helper/SparqlHelper.php 1 patch
Spacing   +174 added lines, -177 removed lines patch added patch discarded remove patch
@@ -199,73 +199,73 @@  discard block
 block discarded – undo
199 199
 		$this->defaultUserAgent = $defaultUserAgent;
200 200
 		$this->requestFactory = $requestFactory;
201 201
 		$this->entityPrefixes = [];
202
-		foreach ( $rdfVocabulary->entityNamespaceNames as $namespaceName ) {
203
-			$this->entityPrefixes[] = $rdfVocabulary->getNamespaceURI( $namespaceName );
202
+		foreach ($rdfVocabulary->entityNamespaceNames as $namespaceName) {
203
+			$this->entityPrefixes[] = $rdfVocabulary->getNamespaceURI($namespaceName);
204 204
 		}
205 205
 
206
-		$this->endpoint = $config->get( 'WBQualityConstraintsSparqlEndpoint' );
207
-		$this->maxQueryTimeMillis = $config->get( 'WBQualityConstraintsSparqlMaxMillis' );
208
-		$this->instanceOfId = $config->get( 'WBQualityConstraintsInstanceOfId' );
209
-		$this->subclassOfId = $config->get( 'WBQualityConstraintsSubclassOfId' );
210
-		$this->cacheMapSize = $config->get( 'WBQualityConstraintsFormatCacheMapSize' );
206
+		$this->endpoint = $config->get('WBQualityConstraintsSparqlEndpoint');
207
+		$this->maxQueryTimeMillis = $config->get('WBQualityConstraintsSparqlMaxMillis');
208
+		$this->instanceOfId = $config->get('WBQualityConstraintsInstanceOfId');
209
+		$this->subclassOfId = $config->get('WBQualityConstraintsSubclassOfId');
210
+		$this->cacheMapSize = $config->get('WBQualityConstraintsFormatCacheMapSize');
211 211
 		$this->timeoutExceptionClasses = $config->get(
212 212
 			'WBQualityConstraintsSparqlTimeoutExceptionClasses'
213 213
 		);
214 214
 		$this->sparqlHasWikibaseSupport = $config->get(
215 215
 			'WBQualityConstraintsSparqlHasWikibaseSupport'
216 216
 		);
217
-		$this->sparqlThrottlingFallbackDuration = (int)$config->get(
217
+		$this->sparqlThrottlingFallbackDuration = (int) $config->get(
218 218
 			'WBQualityConstraintsSparqlThrottlingFallbackDuration'
219 219
 		);
220 220
 
221
-		$this->prefixes = $this->getQueryPrefixes( $rdfVocabulary );
221
+		$this->prefixes = $this->getQueryPrefixes($rdfVocabulary);
222 222
 	}
223 223
 
224
-	private function getQueryPrefixes( RdfVocabulary $rdfVocabulary ) {
224
+	private function getQueryPrefixes(RdfVocabulary $rdfVocabulary) {
225 225
 		// TODO: it would probably be smarter that RdfVocubulary exposed these prefixes somehow
226 226
 		$prefixes = '';
227
-		foreach ( $rdfVocabulary->entityNamespaceNames as $sourceName => $namespaceName ) {
227
+		foreach ($rdfVocabulary->entityNamespaceNames as $sourceName => $namespaceName) {
228 228
 			$prefixes .= <<<END
229
-PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI( $namespaceName )}>\n
229
+PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI($namespaceName)}>\n
230 230
 END;
231 231
 		}
232 232
 		$prefixes .= <<<END
233
-PREFIX wds: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NS_STATEMENT )}>
234
-PREFIX wdv: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NS_VALUE )}>\n
233
+PREFIX wds: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NS_STATEMENT)}>
234
+PREFIX wdv: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NS_VALUE)}>\n
235 235
 END;
236 236
 
237
-		foreach ( $rdfVocabulary->propertyNamespaceNames as $sourceName => $sourceNamespaces ) {
237
+		foreach ($rdfVocabulary->propertyNamespaceNames as $sourceName => $sourceNamespaces) {
238 238
 			$namespaceName = $sourceNamespaces[RdfVocabulary::NSP_DIRECT_CLAIM];
239 239
 			$prefixes .= <<<END
240
-PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI( $namespaceName )}>\n
240
+PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI($namespaceName)}>\n
241 241
 END;
242 242
 			$namespaceName = $sourceNamespaces[RdfVocabulary::NSP_CLAIM];
243 243
 			$prefixes .= <<<END
244
-PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI( $namespaceName )}>\n
244
+PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI($namespaceName)}>\n
245 245
 END;
246 246
 			$namespaceName = $sourceNamespaces[RdfVocabulary::NSP_CLAIM_STATEMENT];
247 247
 			$prefixes .= <<<END
248
-PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI( $namespaceName )}>\n
248
+PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI($namespaceName)}>\n
249 249
 END;
250 250
 			$namespaceName = $sourceNamespaces[RdfVocabulary::NSP_QUALIFIER];
251 251
 			$prefixes .= <<<END
252
-PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI( $namespaceName )}>\n
252
+PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI($namespaceName)}>\n
253 253
 END;
254 254
 			$namespaceName = $sourceNamespaces[RdfVocabulary::NSP_QUALIFIER_VALUE];
255 255
 			$prefixes .= <<<END
256
-PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI( $namespaceName )}>\n
256
+PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI($namespaceName)}>\n
257 257
 END;
258 258
 			$namespaceName = $sourceNamespaces[RdfVocabulary::NSP_REFERENCE];
259 259
 			$prefixes .= <<<END
260
-PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI( $namespaceName )}>\n
260
+PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI($namespaceName)}>\n
261 261
 END;
262 262
 			$namespaceName = $sourceNamespaces[RdfVocabulary::NSP_REFERENCE_VALUE];
263 263
 			$prefixes .= <<<END
264
-PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI( $namespaceName )}>\n
264
+PREFIX {$namespaceName}: <{$rdfVocabulary->getNamespaceURI($namespaceName)}>\n
265 265
 END;
266 266
 		}
267 267
 		$prefixes .= <<<END
268
-PREFIX wikibase: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NS_ONTOLOGY )}>\n
268
+PREFIX wikibase: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NS_ONTOLOGY)}>\n
269 269
 END;
270 270
 		return $prefixes;
271 271
 	}
@@ -277,21 +277,20 @@  discard block
 block discarded – undo
277 277
 	 * @return CachedBool
278 278
 	 * @throws SparqlHelperException if the query times out or some other error occurs
279 279
 	 */
280
-	public function hasType( $id, array $classes ) {
280
+	public function hasType($id, array $classes) {
281 281
 		// TODO hint:gearing is a workaround for T168973 and can hopefully be removed eventually
282 282
 		$gearingHint = $this->sparqlHasWikibaseSupport ?
283
-			' hint:Prior hint:gearing "forward".' :
284
-			'';
283
+			' hint:Prior hint:gearing "forward".' : '';
285 284
 
286 285
 		$metadatas = [];
287 286
 
288
-		foreach ( array_chunk( $classes, 20 ) as $classesChunk ) {
289
-			$classesValues = implode( ' ', array_map(
290
-				function ( $class ) {
291
-					return 'wd:' . $class;
287
+		foreach (array_chunk($classes, 20) as $classesChunk) {
288
+			$classesValues = implode(' ', array_map(
289
+				function($class) {
290
+					return 'wd:'.$class;
292 291
 				},
293 292
 				$classesChunk
294
-			) );
293
+			));
295 294
 
296 295
 			$query = <<<EOF
297 296
 ASK {
@@ -301,19 +300,19 @@  discard block
 block discarded – undo
301 300
 }
302 301
 EOF;
303 302
 
304
-			$result = $this->runQuery( $query );
303
+			$result = $this->runQuery($query);
305 304
 			$metadatas[] = $result->getMetadata();
306
-			if ( $result->getArray()['boolean'] ) {
305
+			if ($result->getArray()['boolean']) {
307 306
 				return new CachedBool(
308 307
 					true,
309
-					Metadata::merge( $metadatas )
308
+					Metadata::merge($metadatas)
310 309
 				);
311 310
 			}
312 311
 		}
313 312
 
314 313
 		return new CachedBool(
315 314
 			false,
316
-			Metadata::merge( $metadatas )
315
+			Metadata::merge($metadatas)
317 316
 		);
318 317
 	}
319 318
 
@@ -329,10 +328,10 @@  discard block
 block discarded – undo
329 328
 		$ignoreDeprecatedStatements
330 329
 	) {
331 330
 		$pid = $statement->getPropertyId()->serialize();
332
-		$guid = str_replace( '$', '-', $statement->getGuid() );
331
+		$guid = str_replace('$', '-', $statement->getGuid());
333 332
 
334 333
 		$deprecatedFilter = '';
335
-		if ( $ignoreDeprecatedStatements ) {
334
+		if ($ignoreDeprecatedStatements) {
336 335
 			$deprecatedFilter = 'MINUS { ?otherStatement wikibase:rank wikibase:DeprecatedRank. }';
337 336
 		}
338 337
 
@@ -351,9 +350,9 @@  discard block
 block discarded – undo
351 350
 LIMIT 10
352 351
 EOF;
353 352
 
354
-		$result = $this->runQuery( $query );
353
+		$result = $this->runQuery($query);
355 354
 
356
-		return $this->getOtherEntities( $result );
355
+		return $this->getOtherEntities($result);
357 356
 	}
358 357
 
359 358
 	/**
@@ -378,16 +377,15 @@  discard block
 block discarded – undo
378 377
 		$dataType = $this->propertyDataTypeLookup->getDataTypeIdForProperty(
379 378
 			$snak->getPropertyId()
380 379
 		);
381
-		list( $value, $isFullValue ) = $this->getRdfLiteral( $dataType, $dataValue );
382
-		if ( $isFullValue ) {
380
+		list($value, $isFullValue) = $this->getRdfLiteral($dataType, $dataValue);
381
+		if ($isFullValue) {
383 382
 			$prefix .= 'v';
384 383
 		}
385 384
 		$path = $type === Context::TYPE_QUALIFIER ?
386
-			"$prefix:$pid" :
387
-			"prov:wasDerivedFrom/$prefix:$pid";
385
+			"$prefix:$pid" : "prov:wasDerivedFrom/$prefix:$pid";
388 386
 
389 387
 		$deprecatedFilter = '';
390
-		if ( $ignoreDeprecatedStatements ) {
388
+		if ($ignoreDeprecatedStatements) {
391 389
 			$deprecatedFilter = <<< EOF
392 390
   MINUS { ?otherStatement wikibase:rank wikibase:DeprecatedRank. }
393 391
 EOF;
@@ -407,9 +405,9 @@  discard block
 block discarded – undo
407 405
 LIMIT 10
408 406
 EOF;
409 407
 
410
-		$result = $this->runQuery( $query );
408
+		$result = $this->runQuery($query);
411 409
 
412
-		return $this->getOtherEntities( $result );
410
+		return $this->getOtherEntities($result);
413 411
 	}
414 412
 
415 413
 	/**
@@ -419,8 +417,8 @@  discard block
 block discarded – undo
419 417
 	 *
420 418
 	 * @return string
421 419
 	 */
422
-	private function stringLiteral( $text ) {
423
-		return '"' . strtr( $text, [ '"' => '\\"', '\\' => '\\\\' ] ) . '"';
420
+	private function stringLiteral($text) {
421
+		return '"'.strtr($text, ['"' => '\\"', '\\' => '\\\\']).'"';
424 422
 	}
425 423
 
426 424
 	/**
@@ -430,18 +428,18 @@  discard block
 block discarded – undo
430 428
 	 *
431 429
 	 * @return CachedEntityIds
432 430
 	 */
433
-	private function getOtherEntities( CachedQueryResults $results ) {
434
-		return new CachedEntityIds( array_map(
435
-			function ( $resultBindings ) {
431
+	private function getOtherEntities(CachedQueryResults $results) {
432
+		return new CachedEntityIds(array_map(
433
+			function($resultBindings) {
436 434
 				$entityIRI = $resultBindings['otherEntity']['value'];
437
-				foreach ( $this->entityPrefixes as $entityPrefix ) {
438
-					$entityPrefixLength = strlen( $entityPrefix );
439
-					if ( substr( $entityIRI, 0, $entityPrefixLength ) === $entityPrefix ) {
435
+				foreach ($this->entityPrefixes as $entityPrefix) {
436
+					$entityPrefixLength = strlen($entityPrefix);
437
+					if (substr($entityIRI, 0, $entityPrefixLength) === $entityPrefix) {
440 438
 						try {
441 439
 							return $this->entityIdParser->parse(
442
-								substr( $entityIRI, $entityPrefixLength )
440
+								substr($entityIRI, $entityPrefixLength)
443 441
 							);
444
-						} catch ( EntityIdParsingException $e ) {
442
+						} catch (EntityIdParsingException $e) {
445 443
 							// fall through
446 444
 						}
447 445
 					}
@@ -452,7 +450,7 @@  discard block
 block discarded – undo
452 450
 				return null;
453 451
 			},
454 452
 			$results->getArray()['results']['bindings']
455
-		), $results->getMetadata() );
453
+		), $results->getMetadata());
456 454
 	}
457 455
 
458 456
 	// phpcs:disable Generic.Metrics.CyclomaticComplexity,Squiz.WhiteSpace.FunctionSpacing
@@ -465,50 +463,50 @@  discard block
 block discarded – undo
465 463
 	 * @return array the literal or IRI as a string in SPARQL syntax,
466 464
 	 * and a boolean indicating whether it refers to a full value node or not
467 465
 	 */
468
-	private function getRdfLiteral( $dataType, DataValue $dataValue ) {
469
-		switch ( $dataType ) {
466
+	private function getRdfLiteral($dataType, DataValue $dataValue) {
467
+		switch ($dataType) {
470 468
 			case 'string':
471 469
 			case 'external-id':
472
-				return [ $this->stringLiteral( $dataValue->getValue() ), false ];
470
+				return [$this->stringLiteral($dataValue->getValue()), false];
473 471
 			case 'commonsMedia':
474
-				$url = $this->rdfVocabulary->getMediaFileURI( $dataValue->getValue() );
475
-				return [ '<' . $url . '>', false ];
472
+				$url = $this->rdfVocabulary->getMediaFileURI($dataValue->getValue());
473
+				return ['<'.$url.'>', false];
476 474
 			case 'geo-shape':
477
-				$url = $this->rdfVocabulary->getGeoShapeURI( $dataValue->getValue() );
478
-				return [ '<' . $url . '>', false ];
475
+				$url = $this->rdfVocabulary->getGeoShapeURI($dataValue->getValue());
476
+				return ['<'.$url.'>', false];
479 477
 			case 'tabular-data':
480
-				$url = $this->rdfVocabulary->getTabularDataURI( $dataValue->getValue() );
481
-				return [ '<' . $url . '>', false ];
478
+				$url = $this->rdfVocabulary->getTabularDataURI($dataValue->getValue());
479
+				return ['<'.$url.'>', false];
482 480
 			case 'url':
483 481
 				$url = $dataValue->getValue();
484
-				if ( !preg_match( '/^[^<>"{}\\\\|^`\\x00-\\x20]*$/D', $url ) ) {
482
+				if (!preg_match('/^[^<>"{}\\\\|^`\\x00-\\x20]*$/D', $url)) {
485 483
 					// not a valid URL for SPARQL (see SPARQL spec, production 139 IRIREF)
486 484
 					// such an URL should never reach us, so just throw
487
-					throw new InvalidArgumentException( 'invalid URL: ' . $url );
485
+					throw new InvalidArgumentException('invalid URL: '.$url);
488 486
 				}
489
-				return [ '<' . $url . '>', false ];
487
+				return ['<'.$url.'>', false];
490 488
 			case 'wikibase-item':
491 489
 			case 'wikibase-property':
492 490
 				/** @var EntityIdValue $dataValue */
493 491
 				'@phan-var EntityIdValue $dataValue';
494
-				return [ 'wd:' . $dataValue->getEntityId()->getSerialization(), false ];
492
+				return ['wd:'.$dataValue->getEntityId()->getSerialization(), false];
495 493
 			case 'monolingualtext':
496 494
 				/** @var MonolingualTextValue $dataValue */
497 495
 				'@phan-var MonolingualTextValue $dataValue';
498 496
 				$lang = $dataValue->getLanguageCode();
499
-				if ( !preg_match( '/^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/D', $lang ) ) {
497
+				if (!preg_match('/^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/D', $lang)) {
500 498
 					// not a valid language tag for SPARQL (see SPARQL spec, production 145 LANGTAG)
501 499
 					// such a language tag should never reach us, so just throw
502
-					throw new InvalidArgumentException( 'invalid language tag: ' . $lang );
500
+					throw new InvalidArgumentException('invalid language tag: '.$lang);
503 501
 				}
504
-				return [ $this->stringLiteral( $dataValue->getText() ) . '@' . $lang, false ];
502
+				return [$this->stringLiteral($dataValue->getText()).'@'.$lang, false];
505 503
 			case 'globe-coordinate':
506 504
 			case 'quantity':
507 505
 			case 'time':
508 506
 				// @phan-suppress-next-line PhanUndeclaredMethod
509
-				return [ 'wdv:' . $dataValue->getHash(), true ];
507
+				return ['wdv:'.$dataValue->getHash(), true];
510 508
 			default:
511
-				throw new InvalidArgumentException( 'unknown data type: ' . $dataType );
509
+				throw new InvalidArgumentException('unknown data type: '.$dataType);
512 510
 		}
513 511
 	}
514 512
 	// phpcs:enable
@@ -521,43 +519,43 @@  discard block
 block discarded – undo
521 519
 	 * @throws SparqlHelperException if the query times out or some other error occurs
522 520
 	 * @throws ConstraintParameterException if the $regex is invalid
523 521
 	 */
524
-	public function matchesRegularExpression( $text, $regex ) {
522
+	public function matchesRegularExpression($text, $regex) {
525 523
 		// caching wrapper around matchesRegularExpressionWithSparql
526 524
 
527
-		$textHash = hash( 'sha256', $text );
525
+		$textHash = hash('sha256', $text);
528 526
 		$cacheKey = $this->cache->makeKey(
529 527
 			'WikibaseQualityConstraints', // extension
530 528
 			'regex', // action
531 529
 			'WDQS-Java', // regex flavor
532
-			hash( 'sha256', $regex )
530
+			hash('sha256', $regex)
533 531
 		);
534 532
 
535 533
 		$cacheMapArray = $this->cache->getWithSetCallback(
536 534
 			$cacheKey,
537 535
 			WANObjectCache::TTL_DAY,
538
-			function ( $cacheMapArray ) use ( $text, $regex, $textHash ) {
536
+			function($cacheMapArray) use ($text, $regex, $textHash) {
539 537
 				// Initialize the cache map if not set
540
-				if ( $cacheMapArray === false ) {
538
+				if ($cacheMapArray === false) {
541 539
 					$key = 'wikibase.quality.constraints.regex.cache.refresh.init';
542
-					$this->dataFactory->increment( $key );
540
+					$this->dataFactory->increment($key);
543 541
 					return [];
544 542
 				}
545 543
 
546 544
 				$key = 'wikibase.quality.constraints.regex.cache.refresh';
547
-				$this->dataFactory->increment( $key );
548
-				$cacheMap = MapCacheLRU::newFromArray( $cacheMapArray, $this->cacheMapSize );
549
-				if ( $cacheMap->has( $textHash ) ) {
545
+				$this->dataFactory->increment($key);
546
+				$cacheMap = MapCacheLRU::newFromArray($cacheMapArray, $this->cacheMapSize);
547
+				if ($cacheMap->has($textHash)) {
550 548
 					$key = 'wikibase.quality.constraints.regex.cache.refresh.hit';
551
-					$this->dataFactory->increment( $key );
552
-					$cacheMap->get( $textHash ); // ping cache
549
+					$this->dataFactory->increment($key);
550
+					$cacheMap->get($textHash); // ping cache
553 551
 				} else {
554 552
 					$key = 'wikibase.quality.constraints.regex.cache.refresh.miss';
555
-					$this->dataFactory->increment( $key );
553
+					$this->dataFactory->increment($key);
556 554
 					try {
557
-						$matches = $this->matchesRegularExpressionWithSparql( $text, $regex );
558
-					} catch ( ConstraintParameterException $e ) {
559
-						$matches = $this->serializeConstraintParameterException( $e );
560
-					} catch ( SparqlHelperException $e ) {
555
+						$matches = $this->matchesRegularExpressionWithSparql($text, $regex);
556
+					} catch (ConstraintParameterException $e) {
557
+						$matches = $this->serializeConstraintParameterException($e);
558
+					} catch (SparqlHelperException $e) {
561 559
 						// don’t cache this
562 560
 						return $cacheMap->toArray();
563 561
 					}
@@ -581,42 +579,42 @@  discard block
 block discarded – undo
581 579
 			]
582 580
 		);
583 581
 
584
-		if ( isset( $cacheMapArray[$textHash] ) ) {
582
+		if (isset($cacheMapArray[$textHash])) {
585 583
 			$key = 'wikibase.quality.constraints.regex.cache.hit';
586
-			$this->dataFactory->increment( $key );
584
+			$this->dataFactory->increment($key);
587 585
 			$matches = $cacheMapArray[$textHash];
588
-			if ( is_bool( $matches ) ) {
586
+			if (is_bool($matches)) {
589 587
 				return $matches;
590
-			} elseif ( is_array( $matches ) &&
591
-				$matches['type'] == ConstraintParameterException::class ) {
592
-				throw $this->deserializeConstraintParameterException( $matches );
588
+			} elseif (is_array($matches) &&
589
+				$matches['type'] == ConstraintParameterException::class) {
590
+				throw $this->deserializeConstraintParameterException($matches);
593 591
 			} else {
594 592
 				throw new MWException(
595
-					'Value of unknown type in object cache (' .
596
-					'cache key: ' . $cacheKey . ', ' .
597
-					'cache map key: ' . $textHash . ', ' .
598
-					'value type: ' . gettype( $matches ) . ')'
593
+					'Value of unknown type in object cache ('.
594
+					'cache key: '.$cacheKey.', '.
595
+					'cache map key: '.$textHash.', '.
596
+					'value type: '.gettype($matches).')'
599 597
 				);
600 598
 			}
601 599
 		} else {
602 600
 			$key = 'wikibase.quality.constraints.regex.cache.miss';
603
-			$this->dataFactory->increment( $key );
604
-			return $this->matchesRegularExpressionWithSparql( $text, $regex );
601
+			$this->dataFactory->increment($key);
602
+			return $this->matchesRegularExpressionWithSparql($text, $regex);
605 603
 		}
606 604
 	}
607 605
 
608
-	private function serializeConstraintParameterException( ConstraintParameterException $cpe ) {
606
+	private function serializeConstraintParameterException(ConstraintParameterException $cpe) {
609 607
 		return [
610 608
 			'type' => ConstraintParameterException::class,
611
-			'violationMessage' => $this->violationMessageSerializer->serialize( $cpe->getViolationMessage() ),
609
+			'violationMessage' => $this->violationMessageSerializer->serialize($cpe->getViolationMessage()),
612 610
 		];
613 611
 	}
614 612
 
615
-	private function deserializeConstraintParameterException( array $serialization ) {
613
+	private function deserializeConstraintParameterException(array $serialization) {
616 614
 		$message = $this->violationMessageDeserializer->deserialize(
617 615
 			$serialization['violationMessage']
618 616
 		);
619
-		return new ConstraintParameterException( $message );
617
+		return new ConstraintParameterException($message);
620 618
 	}
621 619
 
622 620
 	/**
@@ -630,25 +628,25 @@  discard block
 block discarded – undo
630 628
 	 * @throws SparqlHelperException if the query times out or some other error occurs
631 629
 	 * @throws ConstraintParameterException if the $regex is invalid
632 630
 	 */
633
-	public function matchesRegularExpressionWithSparql( $text, $regex ) {
634
-		$textStringLiteral = $this->stringLiteral( $text );
635
-		$regexStringLiteral = $this->stringLiteral( '^(?:' . $regex . ')$' );
631
+	public function matchesRegularExpressionWithSparql($text, $regex) {
632
+		$textStringLiteral = $this->stringLiteral($text);
633
+		$regexStringLiteral = $this->stringLiteral('^(?:'.$regex.')$');
636 634
 
637 635
 		$query = <<<EOF
638 636
 SELECT (REGEX($textStringLiteral, $regexStringLiteral) AS ?matches) {}
639 637
 EOF;
640 638
 
641
-		$result = $this->runQuery( $query, false );
639
+		$result = $this->runQuery($query, false);
642 640
 
643 641
 		$vars = $result->getArray()['results']['bindings'][0];
644
-		if ( array_key_exists( 'matches', $vars ) ) {
642
+		if (array_key_exists('matches', $vars)) {
645 643
 			// true or false ⇒ regex okay, text matches or not
646 644
 			return $vars['matches']['value'] === 'true';
647 645
 		} else {
648 646
 			// empty result: regex broken
649 647
 			throw new ConstraintParameterException(
650
-				( new ViolationMessage( 'wbqc-violation-message-parameter-regex' ) )
651
-					->withInlineCode( $regex, Role::CONSTRAINT_PARAMETER_VALUE )
648
+				(new ViolationMessage('wbqc-violation-message-parameter-regex'))
649
+					->withInlineCode($regex, Role::CONSTRAINT_PARAMETER_VALUE)
652 650
 			);
653 651
 		}
654 652
 	}
@@ -660,14 +658,14 @@  discard block
 block discarded – undo
660 658
 	 *
661 659
 	 * @return boolean
662 660
 	 */
663
-	public function isTimeout( $responseContent ) {
664
-		$timeoutRegex = implode( '|', array_map(
665
-			function ( $fqn ) {
666
-				return preg_quote( $fqn, '/' );
661
+	public function isTimeout($responseContent) {
662
+		$timeoutRegex = implode('|', array_map(
663
+			function($fqn) {
664
+				return preg_quote($fqn, '/');
667 665
 			},
668 666
 			$this->timeoutExceptionClasses
669
-		) );
670
-		return (bool)preg_match( '/' . $timeoutRegex . '/', $responseContent );
667
+		));
668
+		return (bool) preg_match('/'.$timeoutRegex.'/', $responseContent);
671 669
 	}
672 670
 
673 671
 	/**
@@ -679,17 +677,17 @@  discard block
 block discarded – undo
679 677
 	 * @return int|boolean the max-age (in seconds)
680 678
 	 * or a plain boolean if no max-age can be determined
681 679
 	 */
682
-	public function getCacheMaxAge( $responseHeaders ) {
680
+	public function getCacheMaxAge($responseHeaders) {
683 681
 		if (
684
-			array_key_exists( 'x-cache-status', $responseHeaders ) &&
685
-			preg_match( '/^hit(?:-.*)?$/', $responseHeaders['x-cache-status'][0] )
682
+			array_key_exists('x-cache-status', $responseHeaders) &&
683
+			preg_match('/^hit(?:-.*)?$/', $responseHeaders['x-cache-status'][0])
686 684
 		) {
687 685
 			$maxage = [];
688 686
 			if (
689
-				array_key_exists( 'cache-control', $responseHeaders ) &&
690
-				preg_match( '/\bmax-age=(\d+)\b/', $responseHeaders['cache-control'][0], $maxage )
687
+				array_key_exists('cache-control', $responseHeaders) &&
688
+				preg_match('/\bmax-age=(\d+)\b/', $responseHeaders['cache-control'][0], $maxage)
691 689
 			) {
692
-				return intval( $maxage[1] );
690
+				return intval($maxage[1]);
693 691
 			} else {
694 692
 				return true;
695 693
 			}
@@ -710,34 +708,34 @@  discard block
 block discarded – undo
710 708
 	 * or SparlHelper::EMPTY_RETRY_AFTER if there is an empty Retry-After
711 709
 	 * or SparlHelper::INVALID_RETRY_AFTER if there is something wrong with the format
712 710
 	 */
713
-	public function getThrottling( MWHttpRequest $request ) {
714
-		$retryAfterValue = $request->getResponseHeader( 'Retry-After' );
715
-		if ( $retryAfterValue === null ) {
711
+	public function getThrottling(MWHttpRequest $request) {
712
+		$retryAfterValue = $request->getResponseHeader('Retry-After');
713
+		if ($retryAfterValue === null) {
716 714
 			return self::NO_RETRY_AFTER;
717 715
 		}
718 716
 
719
-		$trimmedRetryAfterValue = trim( $retryAfterValue );
720
-		if ( empty( $trimmedRetryAfterValue ) ) {
717
+		$trimmedRetryAfterValue = trim($retryAfterValue);
718
+		if (empty($trimmedRetryAfterValue)) {
721 719
 			return self::EMPTY_RETRY_AFTER;
722 720
 		}
723 721
 
724
-		if ( is_numeric( $trimmedRetryAfterValue ) ) {
725
-			$delaySeconds = (int)$trimmedRetryAfterValue;
726
-			if ( $delaySeconds >= 0 ) {
727
-				return $this->getTimestampInFuture( new DateInterval( 'PT' . $delaySeconds . 'S' ) );
722
+		if (is_numeric($trimmedRetryAfterValue)) {
723
+			$delaySeconds = (int) $trimmedRetryAfterValue;
724
+			if ($delaySeconds >= 0) {
725
+				return $this->getTimestampInFuture(new DateInterval('PT'.$delaySeconds.'S'));
728 726
 			}
729 727
 		} else {
730
-			$return = strtotime( $trimmedRetryAfterValue );
731
-			if ( !empty( $return ) ) {
732
-				return new ConvertibleTimestamp( $return );
728
+			$return = strtotime($trimmedRetryAfterValue);
729
+			if (!empty($return)) {
730
+				return new ConvertibleTimestamp($return);
733 731
 			}
734 732
 		}
735 733
 		return self::INVALID_RETRY_AFTER;
736 734
 	}
737 735
 
738
-	private function getTimestampInFuture( DateInterval $delta ) {
736
+	private function getTimestampInFuture(DateInterval $delta) {
739 737
 		$now = new ConvertibleTimestamp();
740
-		return new ConvertibleTimestamp( $now->timestamp->add( $delta ) );
738
+		return new ConvertibleTimestamp($now->timestamp->add($delta));
741 739
 	}
742 740
 
743 741
 	/**
@@ -751,65 +749,64 @@  discard block
 block discarded – undo
751 749
 	 *
752 750
 	 * @throws SparqlHelperException if the query times out or some other error occurs
753 751
 	 */
754
-	public function runQuery( $query, $needsPrefixes = true ) {
752
+	public function runQuery($query, $needsPrefixes = true) {
755 753
 
756
-		if ( $this->throttlingLock->isLocked( self::EXPIRY_LOCK_ID ) ) {
757
-			$this->dataFactory->increment( 'wikibase.quality.constraints.sparql.throttling' );
754
+		if ($this->throttlingLock->isLocked(self::EXPIRY_LOCK_ID)) {
755
+			$this->dataFactory->increment('wikibase.quality.constraints.sparql.throttling');
758 756
 			throw new TooManySparqlRequestsException();
759 757
 		}
760 758
 
761
-		if ( $this->sparqlHasWikibaseSupport ) {
759
+		if ($this->sparqlHasWikibaseSupport) {
762 760
 			$needsPrefixes = false;
763 761
 		}
764 762
 
765
-		if ( $needsPrefixes ) {
766
-			$query = $this->prefixes . $query;
763
+		if ($needsPrefixes) {
764
+			$query = $this->prefixes.$query;
767 765
 		}
768
-		$query = "#wbqc\n" . $query;
766
+		$query = "#wbqc\n".$query;
769 767
 
770
-		$url = $this->endpoint . '?' . http_build_query(
768
+		$url = $this->endpoint.'?'.http_build_query(
771 769
 			[
772 770
 				'query' => $query,
773 771
 				'format' => 'json',
774 772
 				'maxQueryTimeMillis' => $this->maxQueryTimeMillis,
775 773
 			],
776
-			null, ini_get( 'arg_separator.output' ),
774
+			null, ini_get('arg_separator.output'),
777 775
 			// encode spaces with %20, not +
778 776
 			PHP_QUERY_RFC3986
779 777
 		);
780 778
 
781 779
 		$options = [
782 780
 			'method' => 'GET',
783
-			'timeout' => (int)round( ( $this->maxQueryTimeMillis + 1000 ) / 1000 ),
781
+			'timeout' => (int) round(($this->maxQueryTimeMillis + 1000) / 1000),
784 782
 			'connectTimeout' => 'default',
785 783
 			'userAgent' => $this->defaultUserAgent,
786 784
 		];
787
-		$request = $this->requestFactory->create( $url, $options, __METHOD__ );
788
-		$startTime = microtime( true );
785
+		$request = $this->requestFactory->create($url, $options, __METHOD__);
786
+		$startTime = microtime(true);
789 787
 		$requestStatus = $request->execute();
790
-		$endTime = microtime( true );
788
+		$endTime = microtime(true);
791 789
 		$this->dataFactory->timing(
792 790
 			'wikibase.quality.constraints.sparql.timing',
793
-			( $endTime - $startTime ) * 1000
791
+			($endTime - $startTime) * 1000
794 792
 		);
795 793
 
796
-		$this->guardAgainstTooManyRequestsError( $request );
794
+		$this->guardAgainstTooManyRequestsError($request);
797 795
 
798
-		$maxAge = $this->getCacheMaxAge( $request->getResponseHeaders() );
799
-		if ( $maxAge ) {
800
-			$this->dataFactory->increment( 'wikibase.quality.constraints.sparql.cached' );
796
+		$maxAge = $this->getCacheMaxAge($request->getResponseHeaders());
797
+		if ($maxAge) {
798
+			$this->dataFactory->increment('wikibase.quality.constraints.sparql.cached');
801 799
 		}
802 800
 
803
-		if ( $requestStatus->isOK() ) {
801
+		if ($requestStatus->isOK()) {
804 802
 			$json = $request->getContent();
805
-			$jsonStatus = FormatJson::parse( $json, FormatJson::FORCE_ASSOC );
806
-			if ( $jsonStatus->isOK() ) {
803
+			$jsonStatus = FormatJson::parse($json, FormatJson::FORCE_ASSOC);
804
+			if ($jsonStatus->isOK()) {
807 805
 				return new CachedQueryResults(
808 806
 					$jsonStatus->getValue(),
809 807
 					Metadata::ofCachingMetadata(
810 808
 						$maxAge ?
811
-							CachingMetadata::ofMaximumAgeInSeconds( $maxAge ) :
812
-							CachingMetadata::fresh()
809
+							CachingMetadata::ofMaximumAgeInSeconds($maxAge) : CachingMetadata::fresh()
813 810
 					)
814 811
 				);
815 812
 			} else {
@@ -826,9 +823,9 @@  discard block
 block discarded – undo
826 823
 			// fall through to general error handling
827 824
 		}
828 825
 
829
-		$this->dataFactory->increment( 'wikibase.quality.constraints.sparql.error' );
826
+		$this->dataFactory->increment('wikibase.quality.constraints.sparql.error');
830 827
 
831
-		if ( $this->isTimeout( $request->getContent() ) ) {
828
+		if ($this->isTimeout($request->getContent())) {
832 829
 			$this->dataFactory->increment(
833 830
 				'wikibase.quality.constraints.sparql.error.timeout'
834 831
 			);
@@ -843,29 +840,29 @@  discard block
 block discarded – undo
843 840
 	 * @param MWHttpRequest $request
844 841
 	 * @throws TooManySparqlRequestsException
845 842
 	 */
846
-	private function guardAgainstTooManyRequestsError( MWHttpRequest $request ): void {
847
-		if ( $request->getStatus() !== self::HTTP_TOO_MANY_REQUESTS ) {
843
+	private function guardAgainstTooManyRequestsError(MWHttpRequest $request): void {
844
+		if ($request->getStatus() !== self::HTTP_TOO_MANY_REQUESTS) {
848 845
 			return;
849 846
 		}
850 847
 
851 848
 		$fallbackBlockDuration = $this->sparqlThrottlingFallbackDuration;
852 849
 
853
-		if ( $fallbackBlockDuration < 0 ) {
854
-			throw new InvalidArgumentException( 'Fallback duration must be positive int but is: ' .
855
-				$fallbackBlockDuration );
850
+		if ($fallbackBlockDuration < 0) {
851
+			throw new InvalidArgumentException('Fallback duration must be positive int but is: '.
852
+				$fallbackBlockDuration);
856 853
 		}
857 854
 
858
-		$this->dataFactory->increment( 'wikibase.quality.constraints.sparql.throttling' );
859
-		$throttlingUntil = $this->getThrottling( $request );
860
-		if ( !( $throttlingUntil instanceof ConvertibleTimestamp ) ) {
861
-			$this->loggingHelper->logSparqlHelperTooManyRequestsRetryAfterInvalid( $request );
855
+		$this->dataFactory->increment('wikibase.quality.constraints.sparql.throttling');
856
+		$throttlingUntil = $this->getThrottling($request);
857
+		if (!($throttlingUntil instanceof ConvertibleTimestamp)) {
858
+			$this->loggingHelper->logSparqlHelperTooManyRequestsRetryAfterInvalid($request);
862 859
 			$this->throttlingLock->lock(
863 860
 				self::EXPIRY_LOCK_ID,
864
-				$this->getTimestampInFuture( new DateInterval( 'PT' . $fallbackBlockDuration . 'S' ) )
861
+				$this->getTimestampInFuture(new DateInterval('PT'.$fallbackBlockDuration.'S'))
865 862
 			);
866 863
 		} else {
867
-			$this->loggingHelper->logSparqlHelperTooManyRequestsRetryAfterPresent( $throttlingUntil, $request );
868
-			$this->throttlingLock->lock( self::EXPIRY_LOCK_ID, $throttlingUntil );
864
+			$this->loggingHelper->logSparqlHelperTooManyRequestsRetryAfterPresent($throttlingUntil, $request);
865
+			$this->throttlingLock->lock(self::EXPIRY_LOCK_ID, $throttlingUntil);
869 866
 		}
870 867
 		throw new TooManySparqlRequestsException();
871 868
 	}
Please login to merge, or discard this patch.