Completed
Push — master ( 6d8e1d...17f68d )
by
unknown
07:37
created
src/ConstraintCheck/Result/CheckResult.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 		$status = self::STATUS_TODO,
123 123
 		$message = null
124 124
 	) {
125
-		if ( $contextCursor instanceof Context ) {
125
+		if ($contextCursor instanceof Context) {
126 126
 			$context = $contextCursor;
127 127
 			$this->contextCursor = $context->getCursor();
128 128
 			$this->snakType = $context->getSnak()->getType();
129 129
 			$mainSnak = $context->getSnak();
130
-			if ( $mainSnak instanceof PropertyValueSnak ) {
130
+			if ($mainSnak instanceof PropertyValueSnak) {
131 131
 				$this->dataValue = $mainSnak->getDataValue();
132 132
 			} else {
133 133
 				$this->dataValue = null;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 * @param string $key
191 191
 	 * @param string $value
192 192
 	 */
193
-	public function addParameter( $key, $value ) {
193
+	public function addParameter($key, $value) {
194 194
 		$this->parameters[$key][] = $value;
195 195
 	}
196 196
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	/**
205 205
 	 * @param string $status
206 206
 	 */
207
-	public function setStatus( $status ) {
207
+	public function setStatus($status) {
208 208
 		$this->status = $status;
209 209
 	}
210 210
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 * @param Metadata $metadata
220 220
 	 * @return self
221 221
 	 */
222
-	public function withMetadata( Metadata $metadata ) {
222
+	public function withMetadata(Metadata $metadata) {
223 223
 		$this->metadata = $metadata;
224 224
 		return $this;
225 225
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/QualifierContext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 		Statement $statement,
24 24
 		Snak $snak
25 25
 	) {
26
-		parent::__construct( $entity, $snak );
26
+		parent::__construct($entity, $snak);
27 27
 		$this->statement = $statement;
28 28
 	}
29 29
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function getSnakGroup() {
35 35
 		$snaks = $this->statement->getQualifiers();
36
-		return array_values( $snaks->getArrayCopy() );
36
+		return array_values($snaks->getArrayCopy());
37 37
 	}
38 38
 
39 39
 	public function getCursor() {
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/MainSnakContext.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	private $statement;
22 22
 
23
-	public function __construct( EntityDocument $entity, Statement $statement ) {
24
-		Assert::parameterType( StatementListProvider::class, $entity, '$entity' );
25
-		parent::__construct( $entity, $statement->getMainSnak() );
23
+	public function __construct(EntityDocument $entity, Statement $statement) {
24
+		Assert::parameterType(StatementListProvider::class, $entity, '$entity');
25
+		parent::__construct($entity, $statement->getMainSnak());
26 26
 
27 27
 		$this->statement = $statement;
28 28
 	}
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		/** @var StatementList $statements */
44 44
 		$statements = $this->entity->getStatements();
45 45
 		return $statements
46
-			->getByRank( [ Statement::RANK_NORMAL, Statement::RANK_PREFERRED ] )
46
+			->getByRank([Statement::RANK_NORMAL, Statement::RANK_PREFERRED])
47 47
 			->getMainSnaks();
48 48
 	}
49 49
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ReferenceContext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		Reference $reference,
31 31
 		Snak $snak
32 32
 	) {
33
-		parent::__construct( $entity, $snak );
33
+		parent::__construct($entity, $snak);
34 34
 		$this->statement = $statement;
35 35
 		$this->reference = $reference;
36 36
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 	public function getSnakGroup() {
43 43
 		$snaks = $this->reference->getSnaks();
44
-		return array_values( $snaks->getArrayCopy() );
44
+		return array_values($snaks->getArrayCopy());
45 45
 	}
46 46
 
47 47
 	public function getCursor() {
Please login to merge, or discard this patch.
src/WikibaseQualityConstraintsHooks.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -28,36 +28,36 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @param DatabaseUpdater $updater
30 30
 	 */
31
-	public static function onCreateSchema( DatabaseUpdater $updater ) {
32
-		$updater->addExtensionTable( 'wbqc_constraints', __DIR__ . '/../sql/create_wbqc_constraints.sql' );
33
-		$updater->addExtensionField( 'wbqc_constraints', 'constraint_id', __DIR__ . '/../sql/patch-wbqc_constraints-constraint_id.sql' );
31
+	public static function onCreateSchema(DatabaseUpdater $updater) {
32
+		$updater->addExtensionTable('wbqc_constraints', __DIR__.'/../sql/create_wbqc_constraints.sql');
33
+		$updater->addExtensionField('wbqc_constraints', 'constraint_id', __DIR__.'/../sql/patch-wbqc_constraints-constraint_id.sql');
34 34
 	}
35 35
 
36
-	public static function onWikibaseChange( Change $change ) {
36
+	public static function onWikibaseChange(Change $change) {
37 37
 		$config = MediaWikiServices::getInstance()->getMainConfig();
38
-		if ( $config->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) &&
39
-			self::isConstraintStatementsChange( $config, $change )
38
+		if ($config->get('WBQualityConstraintsEnableConstraintsImportFromStatements') &&
39
+			self::isConstraintStatementsChange($config, $change)
40 40
 		) {
41 41
 			/** @var EntityChange $change */
42 42
 			$title = Title::newMainPage();
43
-			$params = [ 'propertyId' => $change->getEntityId()->getSerialization() ];
43
+			$params = ['propertyId' => $change->getEntityId()->getSerialization()];
44 44
 			JobQueueGroup::singleton()->push(
45
-				new JobSpecification( 'constraintsTableUpdate', $params, [], $title )
45
+				new JobSpecification('constraintsTableUpdate', $params, [], $title)
46 46
 			);
47 47
 		}
48 48
 	}
49 49
 
50
-	public static function isConstraintStatementsChange( Config $config, Change $change ) {
51
-		if ( !( $change instanceof EntityChange ) ||
50
+	public static function isConstraintStatementsChange(Config $config, Change $change) {
51
+		if (!($change instanceof EntityChange) ||
52 52
 			 $change->getAction() !== EntityChange::UPDATE ||
53
-			 !( $change->getEntityId() instanceof PropertyId )
53
+			 !($change->getEntityId() instanceof PropertyId)
54 54
 		) {
55 55
 			return false;
56 56
 		}
57 57
 
58 58
 		$info = $change->getInfo();
59 59
 
60
-		if ( !array_key_exists( 'compactDiff', $info ) ) {
60
+		if (!array_key_exists('compactDiff', $info)) {
61 61
 			// the non-compact diff ($info['diff']) does not contain statement diffs (T110996),
62 62
 			// so we only know that the change *might* affect the constraint statements
63 63
 			return true;
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
 		/** @var EntityDiffChangedAspects $aspects */
67 67
 		$aspects = $info['compactDiff'];
68 68
 
69
-		$propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' );
70
-		return in_array( $propertyConstraintId, $aspects->getStatementChanges() );
69
+		$propertyConstraintId = $config->get('WBQualityConstraintsPropertyConstraintId');
70
+		return in_array($propertyConstraintId, $aspects->getStatementChanges());
71 71
 	}
72 72
 
73
-	public static function onArticlePurge( WikiPage $wikiPage ) {
73
+	public static function onArticlePurge(WikiPage $wikiPage) {
74 74
 		$repo = WikibaseRepo::getDefaultInstance();
75 75
 
76 76
 		$entityContentFactory = $repo->getEntityContentFactory();
77
-		if ( $entityContentFactory->isEntityContentModel( $wikiPage->getContentModel() ) ) {
78
-			$entityId = $entityContentFactory->getEntityIdForTitle( $wikiPage->getTitle() );
77
+		if ($entityContentFactory->isEntityContentModel($wikiPage->getContentModel())) {
78
+			$entityId = $entityContentFactory->getEntityIdForTitle($wikiPage->getTitle());
79 79
 			$resultsCache = ResultsCache::getDefaultInstance();
80
-			$resultsCache->delete( $entityId );
80
+			$resultsCache->delete($entityId);
81 81
 		}
82 82
 	}
83 83
 
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
 	 * @param int $timestamp UTC timestamp (seconds since the Epoch)
87 87
 	 * @return bool
88 88
 	 */
89
-	public static function isGadgetEnabledForUserName( $userName, $timestamp ) {
89
+	public static function isGadgetEnabledForUserName($userName, $timestamp) {
90 90
 		$initial = $userName[0];
91 91
 
92
-		if ( $initial === 'Z' ) {
92
+		if ($initial === 'Z') {
93 93
 			$firstWeek = 0;
94
-		} elseif ( $initial >= 'W' && $initial < 'Z' ) {
94
+		} elseif ($initial >= 'W' && $initial < 'Z') {
95 95
 			$firstWeek = 1;
96
-		} elseif ( $initial >= 'T' && $initial < 'W' ) {
96
+		} elseif ($initial >= 'T' && $initial < 'W') {
97 97
 			$firstWeek = 2;
98
-		} elseif ( $initial >= 'N' && $initial < 'T' ) {
98
+		} elseif ($initial >= 'N' && $initial < 'T') {
99 99
 			$firstWeek = 3;
100
-		} elseif ( $initial >= 'E' && $initial < 'N' ) {
100
+		} elseif ($initial >= 'E' && $initial < 'N') {
101 101
 			$firstWeek = 4;
102 102
 		} else {
103 103
 			$firstWeek = 5;
@@ -115,27 +115,27 @@  discard block
 block discarded – undo
115 115
 		return $timestamp >= $threshold;
116 116
 	}
117 117
 
118
-	public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
118
+	public static function onBeforePageDisplay(OutputPage $out, Skin $skin) {
119 119
 		$repo = WikibaseRepo::getDefaultInstance();
120 120
 
121 121
 		$lookup = $repo->getEntityNamespaceLookup();
122 122
 		$title = $out->getTitle();
123
-		if ( $title === null ) {
123
+		if ($title === null) {
124 124
 			return;
125 125
 		}
126 126
 
127
-		if ( !$lookup->isEntityNamespace( $title->getNamespace() ) ) {
127
+		if (!$lookup->isEntityNamespace($title->getNamespace())) {
128 128
 			return;
129 129
 		}
130
-		if ( !$out->getUser()->isLoggedIn() ) {
130
+		if (!$out->getUser()->isLoggedIn()) {
131 131
 			return;
132 132
 		}
133
-		if ( empty( $out->getJsConfigVars()['wbIsEditView'] ) ) {
133
+		if (empty($out->getJsConfigVars()['wbIsEditView'])) {
134 134
 			return;
135 135
 		}
136 136
 
137
-		if ( self::isGadgetEnabledForUserName( $out->getUser()->getName(), time() ) ) {
138
-			$out->addModules( 'wikibase.quality.constraints.gadget' );
137
+		if (self::isGadgetEnabledForUserName($out->getUser()->getName(), time())) {
138
+			$out->addModules('wikibase.quality.constraints.gadget');
139 139
 		}
140 140
 	}
141 141
 
Please login to merge, or discard this patch.
src/Api/CachingResultsBuilder.php 1 patch
Spacing   +68 added lines, -69 removed lines patch added patch discarded remove patch
@@ -151,30 +151,30 @@  discard block
 block discarded – undo
151 151
 	) {
152 152
 		$results = [];
153 153
 		$metadatas = [];
154
-		if ( $this->canUseStoredResults( $entityIds, $claimIds, $constraintIds, $statuses ) ) {
154
+		if ($this->canUseStoredResults($entityIds, $claimIds, $constraintIds, $statuses)) {
155 155
 			$storedEntityIds = [];
156
-			foreach ( $entityIds as $entityId ) {
157
-				$storedResults = $this->getStoredResults( $entityId );
158
-				if ( $storedResults !== null ) {
159
-					$this->loggingHelper->logCheckConstraintsCacheHit( $entityId );
156
+			foreach ($entityIds as $entityId) {
157
+				$storedResults = $this->getStoredResults($entityId);
158
+				if ($storedResults !== null) {
159
+					$this->loggingHelper->logCheckConstraintsCacheHit($entityId);
160 160
 					$results += $storedResults->getArray();
161 161
 					$metadatas[] = $storedResults->getMetadata();
162 162
 					$storedEntityIds[] = $entityId;
163 163
 				}
164 164
 			}
165
-			$entityIds = array_values( array_diff( $entityIds, $storedEntityIds ) );
165
+			$entityIds = array_values(array_diff($entityIds, $storedEntityIds));
166 166
 		}
167
-		if ( $entityIds !== [] || $claimIds !== [] ) {
168
-			if ( $entityIds !== [] ) {
169
-				$this->loggingHelper->logCheckConstraintsCacheMisses( $entityIds );
167
+		if ($entityIds !== [] || $claimIds !== []) {
168
+			if ($entityIds !== []) {
169
+				$this->loggingHelper->logCheckConstraintsCacheMisses($entityIds);
170 170
 			}
171
-			$response = $this->getAndStoreResults( $entityIds, $claimIds, $constraintIds, $statuses );
171
+			$response = $this->getAndStoreResults($entityIds, $claimIds, $constraintIds, $statuses);
172 172
 			$results += $response->getArray();
173 173
 			$metadatas[] = $response->getMetadata();
174 174
 		}
175 175
 		return new CachedCheckConstraintsResponse(
176 176
 			$results,
177
-			Metadata::merge( $metadatas )
177
+			Metadata::merge($metadatas)
178 178
 		);
179 179
 	}
180 180
 
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 		array $constraintIds = null,
204 204
 		array $statuses
205 205
 	) {
206
-		if ( $claimIds !== [] ) {
206
+		if ($claimIds !== []) {
207 207
 			return false;
208 208
 		}
209
-		if ( $constraintIds !== null ) {
209
+		if ($constraintIds !== null) {
210 210
 			return false;
211 211
 		}
212
-		if ( $statuses != $this->cachedStatuses ) {
212
+		if ($statuses != $this->cachedStatuses) {
213 213
 			return false;
214 214
 		}
215 215
 		return true;
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 		array $constraintIds = null,
229 229
 		array $statuses
230 230
 	) {
231
-		$results = $this->resultsBuilder->getResults( $entityIds, $claimIds, $constraintIds, $statuses );
231
+		$results = $this->resultsBuilder->getResults($entityIds, $claimIds, $constraintIds, $statuses);
232 232
 
233
-		if ( $this->canStoreResults( $entityIds, $claimIds, $constraintIds, $statuses ) ) {
234
-			foreach ( $entityIds as $entityId ) {
233
+		if ($this->canStoreResults($entityIds, $claimIds, $constraintIds, $statuses)) {
234
+			foreach ($entityIds as $entityId) {
235 235
 				$latestRevisionIds = $this->getLatestRevisionIds(
236 236
 					$results->getMetadata()->getDependencyMetadata()->getEntityIds()
237 237
 				);
238
-				if ( $latestRevisionIds === null ) {
238
+				if ($latestRevisionIds === null) {
239 239
 					continue;
240 240
 				}
241 241
 				$value = [
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 					'latestRevisionIds' => $latestRevisionIds,
244 244
 				];
245 245
 				$futureTime = $results->getMetadata()->getDependencyMetadata()->getFutureTime();
246
-				if ( $futureTime !== null ) {
246
+				if ($futureTime !== null) {
247 247
 					$value['futureTime'] = $futureTime->getArrayValue();
248 248
 				}
249
-				$this->cache->set( $entityId, $value, $this->ttlInSeconds );
249
+				$this->cache->set($entityId, $value, $this->ttlInSeconds);
250 250
 			}
251 251
 		}
252 252
 
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 		array $constraintIds = null,
279 279
 		array $statuses
280 280
 	) {
281
-		if ( $constraintIds !== null ) {
281
+		if ($constraintIds !== null) {
282 282
 			return false;
283 283
 		}
284
-		if ( $statuses != $this->cachedStatuses ) {
284
+		if ($statuses != $this->cachedStatuses) {
285 285
 			return false;
286 286
 		}
287 287
 		return true;
@@ -294,45 +294,44 @@  discard block
 block discarded – undo
294 294
 	public function getStoredResults(
295 295
 		EntityId $entityId
296 296
 	) {
297
-		$value = $this->cache->get( $entityId, $curTTL, [], $asOf );
298
-		$now = call_user_func( $this->microtime, true );
297
+		$value = $this->cache->get($entityId, $curTTL, [], $asOf);
298
+		$now = call_user_func($this->microtime, true);
299 299
 
300
-		if ( $value === false ) {
300
+		if ($value === false) {
301 301
 			return null;
302 302
 		}
303 303
 
304
-		$ageInSeconds = (int)ceil( $now - $asOf );
304
+		$ageInSeconds = (int) ceil($now - $asOf);
305 305
 
306 306
 		$dependedEntityIds = array_map(
307
-			[ $this->entityIdParser, "parse" ],
308
-			array_keys( $value['latestRevisionIds'] )
307
+			[$this->entityIdParser, "parse"],
308
+			array_keys($value['latestRevisionIds'])
309 309
 		);
310 310
 
311
-		if ( $value['latestRevisionIds'] !== $this->getLatestRevisionIds( $dependedEntityIds ) ) {
311
+		if ($value['latestRevisionIds'] !== $this->getLatestRevisionIds($dependedEntityIds)) {
312 312
 			return null;
313 313
 		}
314 314
 
315
-		if ( array_key_exists( 'futureTime', $value ) ) {
316
-			$futureTime = TimeValue::newFromArray( $value['futureTime'] );
317
-			if ( !$this->timeValueComparer->isFutureTime( $futureTime ) ) {
315
+		if (array_key_exists('futureTime', $value)) {
316
+			$futureTime = TimeValue::newFromArray($value['futureTime']);
317
+			if (!$this->timeValueComparer->isFutureTime($futureTime)) {
318 318
 				return null;
319 319
 			}
320
-			$futureTimeDependencyMetadata = DependencyMetadata::ofFutureTime( $futureTime );
320
+			$futureTimeDependencyMetadata = DependencyMetadata::ofFutureTime($futureTime);
321 321
 		} else {
322 322
 			$futureTimeDependencyMetadata = DependencyMetadata::blank();
323 323
 		}
324 324
 
325 325
 		$cachingMetadata = $ageInSeconds > 0 ?
326
-			CachingMetadata::ofMaximumAgeInSeconds( $ageInSeconds ) :
327
-			CachingMetadata::fresh();
326
+			CachingMetadata::ofMaximumAgeInSeconds($ageInSeconds) : CachingMetadata::fresh();
328 327
 
329
-		if ( is_array( $value['results'] ) ) {
330
-			array_walk( $value['results'], [ $this, 'updateCachingMetadata' ], $cachingMetadata );
328
+		if (is_array($value['results'])) {
329
+			array_walk($value['results'], [$this, 'updateCachingMetadata'], $cachingMetadata);
331 330
 		}
332 331
 
333 332
 		return new CachedCheckConstraintsResponse(
334
-			[ $entityId->getSerialization() => $value['results'] ],
335
-			$this->mergeStoredMetadata( $cachingMetadata, $dependedEntityIds, $futureTimeDependencyMetadata )
333
+			[$entityId->getSerialization() => $value['results']],
334
+			$this->mergeStoredMetadata($cachingMetadata, $dependedEntityIds, $futureTimeDependencyMetadata)
336 335
 		);
337 336
 	}
338 337
 
@@ -347,19 +346,19 @@  discard block
 block discarded – undo
347 346
 		array $dependedEntityIds,
348 347
 		DependencyMetadata $futureTimeDependencyMetadata = null
349 348
 	) {
350
-		return Metadata::merge( [
351
-			Metadata::ofCachingMetadata( $cachingMetadata ),
352
-			Metadata::ofDependencyMetadata( array_reduce(
349
+		return Metadata::merge([
350
+			Metadata::ofCachingMetadata($cachingMetadata),
351
+			Metadata::ofDependencyMetadata(array_reduce(
353 352
 				$dependedEntityIds,
354
-				function( DependencyMetadata $metadata, EntityId $entityId ) {
355
-					return DependencyMetadata::merge( [
353
+				function(DependencyMetadata $metadata, EntityId $entityId) {
354
+					return DependencyMetadata::merge([
356 355
 						$metadata,
357
-						DependencyMetadata::ofEntityId( $entityId )
358
-					] );
356
+						DependencyMetadata::ofEntityId($entityId)
357
+					]);
359 358
 				},
360 359
 				$futureTimeDependencyMetadata
361
-			) )
362
-		] );
360
+			))
361
+		]);
363 362
 	}
364 363
 
365 364
 	/**
@@ -367,14 +366,14 @@  discard block
 block discarded – undo
367 366
 	 * @return int[]|null array from entity ID serializations to revision ID,
368 367
 	 * or null to indicate that not all revision IDs could be loaded
369 368
 	 */
370
-	private function getLatestRevisionIds( array $entityIds ) {
371
-		if ( $entityIds === [] ) {
369
+	private function getLatestRevisionIds(array $entityIds) {
370
+		if ($entityIds === []) {
372 371
 			$this->loggingHelper->logEmptyDependencyMetadata();
373 372
 			return [];
374 373
 		}
375
-		if ( count( $entityIds ) > $this->maxRevisionIds ) {
374
+		if (count($entityIds) > $this->maxRevisionIds) {
376 375
 			// one of those entities will probably be edited soon, so might as well skip caching
377
-			$this->loggingHelper->logHugeDependencyMetadata( $entityIds, $this->maxRevisionIds );
376
+			$this->loggingHelper->logHugeDependencyMetadata($entityIds, $this->maxRevisionIds);
378 377
 			return null;
379 378
 		}
380 379
 
@@ -382,7 +381,7 @@  discard block
 block discarded – undo
382 381
 			$entityIds,
383 382
 			EntityRevisionLookup::LATEST_FROM_REPLICA
384 383
 		);
385
-		if ( $this->hasFalseElements( $latestRevisionIds ) ) {
384
+		if ($this->hasFalseElements($latestRevisionIds)) {
386 385
 			return null;
387 386
 		}
388 387
 		return $latestRevisionIds;
@@ -392,31 +391,31 @@  discard block
 block discarded – undo
392 391
 	 * @param array $array
393 392
 	 * @return bool
394 393
 	 */
395
-	private function hasFalseElements( array $array ) {
396
-		return in_array( false, $array, true );
394
+	private function hasFalseElements(array $array) {
395
+		return in_array(false, $array, true);
397 396
 	}
398 397
 
399
-	public function updateCachingMetadata( &$element, $key, CachingMetadata $cachingMetadata ) {
400
-		if ( $key === 'cached' ) {
401
-			$element = CachingMetadata::merge( [
398
+	public function updateCachingMetadata(&$element, $key, CachingMetadata $cachingMetadata) {
399
+		if ($key === 'cached') {
400
+			$element = CachingMetadata::merge([
402 401
 				$cachingMetadata,
403
-				CachingMetadata::ofArray( $element ),
404
-			] )->toArray();
402
+				CachingMetadata::ofArray($element),
403
+			])->toArray();
405 404
 		}
406 405
 		if (
407
-			is_array( $element ) &&
408
-			array_key_exists( 'constraint', $element ) &&
409
-			in_array( $element['constraint']['type'], $this->possiblyStaleConstraintTypes, true )
406
+			is_array($element) &&
407
+			array_key_exists('constraint', $element) &&
408
+			in_array($element['constraint']['type'], $this->possiblyStaleConstraintTypes, true)
410 409
 		) {
411
-			$element['cached'] = CachingMetadata::merge( [
410
+			$element['cached'] = CachingMetadata::merge([
412 411
 				$cachingMetadata,
413 412
 				CachingMetadata::ofArray(
414
-					array_key_exists( 'cached', $element ) ? $element['cached'] : null
413
+					array_key_exists('cached', $element) ? $element['cached'] : null
415 414
 				),
416
-			] )->toArray();
415
+			])->toArray();
417 416
 		}
418
-		if ( is_array( $element ) ) {
419
-			array_walk( $element, [ $this, __FUNCTION__ ], $cachingMetadata );
417
+		if (is_array($element)) {
418
+			array_walk($element, [$this, __FUNCTION__], $cachingMetadata);
420 419
 		}
421 420
 	}
422 421
 
@@ -425,7 +424,7 @@  discard block
 block discarded – undo
425 424
 	 *
426 425
 	 * @param callable $microtime
427 426
 	 */
428
-	public function setMicrotimeFunction( callable $microtime ) {
427
+	public function setMicrotimeFunction(callable $microtime) {
429 428
 		$this->microtime = $microtime;
430 429
 	}
431 430
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ReferenceContextCursor.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -92,43 +92,43 @@
 block discarded – undo
92 92
 		return $this->referenceHash;
93 93
 	}
94 94
 
95
-	protected function &getMainArray( array &$container ) {
96
-		$statementArray = &$this->getStatementArray( $container );
95
+	protected function &getMainArray(array &$container) {
96
+		$statementArray = &$this->getStatementArray($container);
97 97
 
98
-		if ( !array_key_exists( 'references', $statementArray ) ) {
98
+		if (!array_key_exists('references', $statementArray)) {
99 99
 			$statementArray['references'] = [];
100 100
 		}
101 101
 		$referencesArray = &$statementArray['references'];
102 102
 
103 103
 		$referenceHash = $this->getReferenceHash();
104
-		foreach ( $referencesArray as &$potentialReferenceArray ) {
105
-			if ( $potentialReferenceArray['hash'] === $referenceHash ) {
104
+		foreach ($referencesArray as &$potentialReferenceArray) {
105
+			if ($potentialReferenceArray['hash'] === $referenceHash) {
106 106
 				$referenceArray = &$potentialReferenceArray;
107 107
 				break;
108 108
 			}
109 109
 		}
110
-		if ( !isset( $referenceArray ) ) {
111
-			$referenceArray = [ 'hash' => $referenceHash, 'snaks' => [] ];
110
+		if (!isset($referenceArray)) {
111
+			$referenceArray = ['hash' => $referenceHash, 'snaks' => []];
112 112
 			$referencesArray[] = &$referenceArray;
113 113
 		}
114 114
 
115 115
 		$snaksArray = &$referenceArray['snaks'];
116 116
 
117 117
 		$snakPropertyId = $this->getSnakPropertyId();
118
-		if ( !array_key_exists( $snakPropertyId, $snaksArray ) ) {
118
+		if (!array_key_exists($snakPropertyId, $snaksArray)) {
119 119
 			$snaksArray[$snakPropertyId] = [];
120 120
 		}
121 121
 		$propertyArray = &$snaksArray[$snakPropertyId];
122 122
 
123 123
 		$snakHash = $this->getSnakHash();
124
-		foreach ( $propertyArray as &$potentialSnakArray ) {
125
-			if ( $potentialSnakArray['hash'] === $snakHash ) {
124
+		foreach ($propertyArray as &$potentialSnakArray) {
125
+			if ($potentialSnakArray['hash'] === $snakHash) {
126 126
 				$snakArray = &$potentialSnakArray;
127 127
 				break;
128 128
 			}
129 129
 		}
130
-		if ( !isset( $snakArray ) ) {
131
-			$snakArray = [ 'hash' => $snakHash ];
130
+		if (!isset($snakArray)) {
131
+			$snakArray = ['hash' => $snakHash];
132 132
 			$propertyArray[] = &$snakArray;
133 133
 		}
134 134
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/QualifierContextCursor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -80,29 +80,29 @@
 block discarded – undo
80 80
 		return $this->snakHash;
81 81
 	}
82 82
 
83
-	protected function &getMainArray( array &$container ) {
84
-		$statementArray = &$this->getStatementArray( $container );
83
+	protected function &getMainArray(array &$container) {
84
+		$statementArray = &$this->getStatementArray($container);
85 85
 
86
-		if ( !array_key_exists( 'qualifiers', $statementArray ) ) {
86
+		if (!array_key_exists('qualifiers', $statementArray)) {
87 87
 			$statementArray['qualifiers'] = [];
88 88
 		}
89 89
 		$qualifiersArray = &$statementArray['qualifiers'];
90 90
 
91 91
 		$snakPropertyId = $this->getSnakPropertyId();
92
-		if ( !array_key_exists( $snakPropertyId, $qualifiersArray ) ) {
92
+		if (!array_key_exists($snakPropertyId, $qualifiersArray)) {
93 93
 			$qualifiersArray[$snakPropertyId] = [];
94 94
 		}
95 95
 		$propertyArray = &$qualifiersArray[$snakPropertyId];
96 96
 
97 97
 		$snakHash = $this->getSnakHash();
98
-		foreach ( $propertyArray as &$potentialQualifierArray ) {
99
-			if ( $potentialQualifierArray['hash'] === $snakHash ) {
98
+		foreach ($propertyArray as &$potentialQualifierArray) {
99
+			if ($potentialQualifierArray['hash'] === $snakHash) {
100 100
 				$qualifierArray = &$potentialQualifierArray;
101 101
 				break;
102 102
 			}
103 103
 		}
104
-		if ( !isset( $qualifierArray ) ) {
105
-			$qualifierArray = [ 'hash' => $snakHash ];
104
+		if (!isset($qualifierArray)) {
105
+			$qualifierArray = ['hash' => $snakHash];
106 106
 			$propertyArray[] = &$qualifierArray;
107 107
 		}
108 108
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/MainSnakContextCursor.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,12 +72,12 @@
 block discarded – undo
72 72
 		return $this->snakHash;
73 73
 	}
74 74
 
75
-	protected function &getMainArray( array &$container ) {
76
-		$statementArray = &$this->getStatementArray( $container );
75
+	protected function &getMainArray(array &$container) {
76
+		$statementArray = &$this->getStatementArray($container);
77 77
 
78
-		if ( !array_key_exists( 'mainsnak', $statementArray ) ) {
78
+		if (!array_key_exists('mainsnak', $statementArray)) {
79 79
 			$snakHash = $this->getSnakHash();
80
-			$statementArray['mainsnak'] = [ 'hash' => $snakHash ];
80
+			$statementArray['mainsnak'] = ['hash' => $snakHash];
81 81
 		}
82 82
 		$mainsnakArray = &$statementArray['mainsnak'];
83 83
 
Please login to merge, or discard this patch.