Completed
Push — master ( a718f1...259f04 )
by
unknown
01:49
created
src/ServiceWiring.php 1 patch
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -28,46 +28,46 @@  discard block
 block discarded – undo
28 28
 use WikibaseQuality\ConstraintReport\ConstraintCheck\Result\CheckResultSerializer;
29 29
 
30 30
 return [
31
-	ConstraintsServices::EXPIRY_LOCK => function ( MediaWikiServices $services ) {
32
-		return new ExpiryLock( ObjectCache::getInstance( CACHE_ANYTHING ) );
31
+	ConstraintsServices::EXPIRY_LOCK => function(MediaWikiServices $services) {
32
+		return new ExpiryLock(ObjectCache::getInstance(CACHE_ANYTHING));
33 33
 	},
34 34
 
35
-	ConstraintsServices::LOGGING_HELPER => function ( MediaWikiServices $services ) {
35
+	ConstraintsServices::LOGGING_HELPER => function(MediaWikiServices $services) {
36 36
 		return new LoggingHelper(
37 37
 			$services->getStatsdDataFactory(),
38
-			LoggerFactory::getInstance( 'WikibaseQualityConstraints' ),
38
+			LoggerFactory::getInstance('WikibaseQualityConstraints'),
39 39
 			$services->getMainConfig()
40 40
 		);
41 41
 	},
42 42
 
43
-	ConstraintsServices::CONSTRAINT_STORE => function ( MediaWikiServices $services ) {
44
-		$sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions( $services );
45
-		$propertySource = $sourceDefinitions->getSourceForEntityType( Property::ENTITY_TYPE );
43
+	ConstraintsServices::CONSTRAINT_STORE => function(MediaWikiServices $services) {
44
+		$sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions($services);
45
+		$propertySource = $sourceDefinitions->getSourceForEntityType(Property::ENTITY_TYPE);
46 46
 		$dbName = $propertySource->getDatabaseName();
47
-		$localEntitySourceName = WikibaseRepo::getLocalEntitySource( $services )->getSourceName();
47
+		$localEntitySourceName = WikibaseRepo::getLocalEntitySource($services)->getSourceName();
48 48
 
49
-		if ( $propertySource->getSourceName() !== $localEntitySourceName ) {
50
-			throw new \RuntimeException( 'Can\'t get a ConstraintStore for a non local entity source.' );
49
+		if ($propertySource->getSourceName() !== $localEntitySourceName) {
50
+			throw new \RuntimeException('Can\'t get a ConstraintStore for a non local entity source.');
51 51
 		}
52 52
 
53 53
 		return new ConstraintRepositoryStore(
54
-			$services->getDBLoadBalancerFactory()->getMainLB( $dbName ),
54
+			$services->getDBLoadBalancerFactory()->getMainLB($dbName),
55 55
 			$dbName
56 56
 		);
57 57
 	},
58 58
 
59
-	ConstraintsServices::CONSTRAINT_LOOKUP => function ( MediaWikiServices $services ) {
60
-		$sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions( $services );
61
-		$propertySource = $sourceDefinitions->getSourceForEntityType( Property::ENTITY_TYPE );
59
+	ConstraintsServices::CONSTRAINT_LOOKUP => function(MediaWikiServices $services) {
60
+		$sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions($services);
61
+		$propertySource = $sourceDefinitions->getSourceForEntityType(Property::ENTITY_TYPE);
62 62
 		$dbName = $propertySource->getDatabaseName();
63 63
 		$rawLookup = new ConstraintRepositoryLookup(
64
-			$services->getDBLoadBalancerFactory()->getMainLB( $dbName ),
64
+			$services->getDBLoadBalancerFactory()->getMainLB($dbName),
65 65
 			$dbName
66 66
 		);
67
-		return new CachingConstraintLookup( $rawLookup );
67
+		return new CachingConstraintLookup($rawLookup);
68 68
 	},
69 69
 
70
-	ConstraintsServices::CHECK_RESULT_SERIALIZER => function ( MediaWikiServices $services ) {
70
+	ConstraintsServices::CHECK_RESULT_SERIALIZER => function(MediaWikiServices $services) {
71 71
 		return new CheckResultSerializer(
72 72
 			new ConstraintSerializer(
73 73
 				false // constraint parameters are not exposed
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 		);
79 79
 	},
80 80
 
81
-	ConstraintsServices::CHECK_RESULT_DESERIALIZER => function ( MediaWikiServices $services ) {
82
-		$entityIdParser = WikibaseRepo::getEntityIdParser( $services );
83
-		$dataValueFactory = WikibaseRepo::getDataValueFactory( $services );
81
+	ConstraintsServices::CHECK_RESULT_DESERIALIZER => function(MediaWikiServices $services) {
82
+		$entityIdParser = WikibaseRepo::getEntityIdParser($services);
83
+		$dataValueFactory = WikibaseRepo::getDataValueFactory($services);
84 84
 
85 85
 		return new CheckResultDeserializer(
86 86
 			new ConstraintDeserializer(),
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 		);
94 94
 	},
95 95
 
96
-	ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function ( MediaWikiServices $services ) {
96
+	ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function(MediaWikiServices $services) {
97 97
 		return new ViolationMessageSerializer();
98 98
 	},
99 99
 
100
-	ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function ( MediaWikiServices $services ) {
101
-		$entityIdParser = WikibaseRepo::getEntityIdParser( $services );
102
-		$dataValueFactory = WikibaseRepo::getDataValueFactory( $services );
100
+	ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function(MediaWikiServices $services) {
101
+		$entityIdParser = WikibaseRepo::getEntityIdParser($services);
102
+		$dataValueFactory = WikibaseRepo::getDataValueFactory($services);
103 103
 
104 104
 		return new ViolationMessageDeserializer(
105 105
 			$entityIdParser,
@@ -107,37 +107,37 @@  discard block
 block discarded – undo
107 107
 		);
108 108
 	},
109 109
 
110
-	ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function ( MediaWikiServices $services ) {
111
-		$deserializerFactory = WikibaseRepo::getBaseDataModelDeserializerFactory( $services );
112
-		$entitySourceDefinitions = WikibaseRepo::getEntitySourceDefinitions( $services );
110
+	ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function(MediaWikiServices $services) {
111
+		$deserializerFactory = WikibaseRepo::getBaseDataModelDeserializerFactory($services);
112
+		$entitySourceDefinitions = WikibaseRepo::getEntitySourceDefinitions($services);
113 113
 
114 114
 		return new ConstraintParameterParser(
115 115
 			$services->getMainConfig(),
116 116
 			$deserializerFactory,
117
-			$entitySourceDefinitions->getSourceForEntityType( 'item' )->getConceptBaseUri()
117
+			$entitySourceDefinitions->getSourceForEntityType('item')->getConceptBaseUri()
118 118
 		);
119 119
 	},
120 120
 
121
-	ConstraintsServices::CONNECTION_CHECKER_HELPER => function ( MediaWikiServices $services ) {
121
+	ConstraintsServices::CONNECTION_CHECKER_HELPER => function(MediaWikiServices $services) {
122 122
 		return new ConnectionCheckerHelper();
123 123
 	},
124 124
 
125
-	ConstraintsServices::RANGE_CHECKER_HELPER => function ( MediaWikiServices $services ) {
125
+	ConstraintsServices::RANGE_CHECKER_HELPER => function(MediaWikiServices $services) {
126 126
 		return new RangeCheckerHelper(
127 127
 			$services->getMainConfig(),
128
-			WikibaseRepo::getUnitConverter( $services )
128
+			WikibaseRepo::getUnitConverter($services)
129 129
 		);
130 130
 	},
131 131
 
132
-	ConstraintsServices::SPARQL_HELPER => function ( MediaWikiServices $services ) {
133
-		$endpoint = $services->getMainConfig()->get( 'WBQualityConstraintsSparqlEndpoint' );
134
-		if ( $endpoint === '' ) {
132
+	ConstraintsServices::SPARQL_HELPER => function(MediaWikiServices $services) {
133
+		$endpoint = $services->getMainConfig()->get('WBQualityConstraintsSparqlEndpoint');
134
+		if ($endpoint === '') {
135 135
 			return new DummySparqlHelper();
136 136
 		}
137 137
 
138
-		$rdfVocabulary = WikibaseRepo::getRdfVocabulary( $services );
139
-		$entityIdParser = WikibaseRepo::getEntityIdParser( $services );
140
-		$propertyDataTypeLookup = WikibaseRepo::getPropertyDataTypeLookup( $services );
138
+		$rdfVocabulary = WikibaseRepo::getRdfVocabulary($services);
139
+		$entityIdParser = WikibaseRepo::getEntityIdParser($services);
140
+		$propertyDataTypeLookup = WikibaseRepo::getPropertyDataTypeLookup($services);
141 141
 
142 142
 		return new SparqlHelper(
143 143
 			$services->getMainConfig(),
@@ -145,122 +145,122 @@  discard block
 block discarded – undo
145 145
 			$entityIdParser,
146 146
 			$propertyDataTypeLookup,
147 147
 			$services->getMainWANObjectCache(),
148
-			ConstraintsServices::getViolationMessageSerializer( $services ),
149
-			ConstraintsServices::getViolationMessageDeserializer( $services ),
148
+			ConstraintsServices::getViolationMessageSerializer($services),
149
+			ConstraintsServices::getViolationMessageDeserializer($services),
150 150
 			$services->getStatsdDataFactory(),
151
-			ConstraintsServices::getExpiryLock( $services ),
152
-			ConstraintsServices::getLoggingHelper( $services ),
153
-			wfWikiID() . ' WikibaseQualityConstraints ' . Http::userAgent(),
151
+			ConstraintsServices::getExpiryLock($services),
152
+			ConstraintsServices::getLoggingHelper($services),
153
+			wfWikiID().' WikibaseQualityConstraints '.Http::userAgent(),
154 154
 			$services->getHttpRequestFactory()
155 155
 		);
156 156
 	},
157 157
 
158
-	ConstraintsServices::TYPE_CHECKER_HELPER => function ( MediaWikiServices $services ) {
158
+	ConstraintsServices::TYPE_CHECKER_HELPER => function(MediaWikiServices $services) {
159 159
 		return new TypeCheckerHelper(
160
-			WikibaseServices::getEntityLookup( $services ),
160
+			WikibaseServices::getEntityLookup($services),
161 161
 			$services->getMainConfig(),
162
-			ConstraintsServices::getSparqlHelper( $services ),
162
+			ConstraintsServices::getSparqlHelper($services),
163 163
 			$services->getStatsdDataFactory()
164 164
 		);
165 165
 	},
166 166
 
167
-	ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => function ( MediaWikiServices $services ) {
168
-		$statementGuidParser = WikibaseRepo::getStatementGuidParser( $services );
167
+	ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => function(MediaWikiServices $services) {
168
+		$statementGuidParser = WikibaseRepo::getStatementGuidParser($services);
169 169
 
170 170
 		$config = $services->getMainConfig();
171 171
 		$checkerMap = [
172
-			$config->get( 'WBQualityConstraintsConflictsWithConstraintId' )
173
-				=> ConstraintCheckerServices::getConflictsWithChecker( $services ),
174
-			$config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' )
175
-				=> ConstraintCheckerServices::getItemChecker( $services ),
176
-			$config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' )
177
-				=> ConstraintCheckerServices::getTargetRequiredClaimChecker( $services ),
178
-			$config->get( 'WBQualityConstraintsSymmetricConstraintId' )
179
-				=> ConstraintCheckerServices::getSymmetricChecker( $services ),
180
-			$config->get( 'WBQualityConstraintsInverseConstraintId' )
181
-				=> ConstraintCheckerServices::getInverseChecker( $services ),
182
-			$config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' )
183
-				=> ConstraintCheckerServices::getQualifierChecker( $services ),
184
-			$config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' )
185
-				=> ConstraintCheckerServices::getQualifiersChecker( $services ),
186
-			$config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' )
187
-				=> ConstraintCheckerServices::getMandatoryQualifiersChecker( $services ),
188
-			$config->get( 'WBQualityConstraintsRangeConstraintId' )
189
-				=> ConstraintCheckerServices::getRangeChecker( $services ),
190
-			$config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' )
191
-				=> ConstraintCheckerServices::getDiffWithinRangeChecker( $services ),
192
-			$config->get( 'WBQualityConstraintsTypeConstraintId' )
193
-				=> ConstraintCheckerServices::getTypeChecker( $services ),
194
-			$config->get( 'WBQualityConstraintsValueTypeConstraintId' )
195
-				=> ConstraintCheckerServices::getValueTypeChecker( $services ),
196
-			$config->get( 'WBQualityConstraintsSingleValueConstraintId' )
197
-				=> ConstraintCheckerServices::getSingleValueChecker( $services ),
198
-			$config->get( 'WBQualityConstraintsMultiValueConstraintId' )
199
-				=> ConstraintCheckerServices::getMultiValueChecker( $services ),
200
-			$config->get( 'WBQualityConstraintsDistinctValuesConstraintId' )
201
-				=> ConstraintCheckerServices::getUniqueValueChecker( $services ),
202
-			$config->get( 'WBQualityConstraintsFormatConstraintId' )
203
-				=> ConstraintCheckerServices::getFormatChecker( $services ),
204
-			$config->get( 'WBQualityConstraintsCommonsLinkConstraintId' )
205
-				=> ConstraintCheckerServices::getCommonsLinkChecker( $services ),
206
-			$config->get( 'WBQualityConstraintsOneOfConstraintId' )
207
-				=> ConstraintCheckerServices::getOneOfChecker( $services ),
208
-			$config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' )
209
-				=> ConstraintCheckerServices::getValueOnlyChecker( $services ),
210
-			$config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' )
211
-				=> ConstraintCheckerServices::getReferenceChecker( $services ),
212
-			$config->get( 'WBQualityConstraintsNoBoundsConstraintId' )
213
-				=> ConstraintCheckerServices::getNoBoundsChecker( $services ),
214
-			$config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' )
215
-				=> ConstraintCheckerServices::getAllowedUnitsChecker( $services ),
216
-			$config->get( 'WBQualityConstraintsSingleBestValueConstraintId' )
217
-				=> ConstraintCheckerServices::getSingleBestValueChecker( $services ),
218
-			$config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' )
219
-				=> ConstraintCheckerServices::getEntityTypeChecker( $services ),
220
-			$config->get( 'WBQualityConstraintsNoneOfConstraintId' )
221
-				=> ConstraintCheckerServices::getNoneOfChecker( $services ),
222
-			$config->get( 'WBQualityConstraintsIntegerConstraintId' )
223
-				=> ConstraintCheckerServices::getIntegerChecker( $services ),
224
-			$config->get( 'WBQualityConstraintsCitationNeededConstraintId' )
225
-				=> ConstraintCheckerServices::getCitationNeededChecker( $services ),
226
-			$config->get( 'WBQualityConstraintsPropertyScopeConstraintId' )
227
-				=> ConstraintCheckerServices::getPropertyScopeChecker( $services ),
228
-			$config->get( 'WBQualityConstraintsContemporaryConstraintId' )
229
-				=> ConstraintCheckerServices::getContemporaryChecker( $services ),
172
+			$config->get('WBQualityConstraintsConflictsWithConstraintId')
173
+				=> ConstraintCheckerServices::getConflictsWithChecker($services),
174
+			$config->get('WBQualityConstraintsItemRequiresClaimConstraintId')
175
+				=> ConstraintCheckerServices::getItemChecker($services),
176
+			$config->get('WBQualityConstraintsValueRequiresClaimConstraintId')
177
+				=> ConstraintCheckerServices::getTargetRequiredClaimChecker($services),
178
+			$config->get('WBQualityConstraintsSymmetricConstraintId')
179
+				=> ConstraintCheckerServices::getSymmetricChecker($services),
180
+			$config->get('WBQualityConstraintsInverseConstraintId')
181
+				=> ConstraintCheckerServices::getInverseChecker($services),
182
+			$config->get('WBQualityConstraintsUsedAsQualifierConstraintId')
183
+				=> ConstraintCheckerServices::getQualifierChecker($services),
184
+			$config->get('WBQualityConstraintsAllowedQualifiersConstraintId')
185
+				=> ConstraintCheckerServices::getQualifiersChecker($services),
186
+			$config->get('WBQualityConstraintsMandatoryQualifierConstraintId')
187
+				=> ConstraintCheckerServices::getMandatoryQualifiersChecker($services),
188
+			$config->get('WBQualityConstraintsRangeConstraintId')
189
+				=> ConstraintCheckerServices::getRangeChecker($services),
190
+			$config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId')
191
+				=> ConstraintCheckerServices::getDiffWithinRangeChecker($services),
192
+			$config->get('WBQualityConstraintsTypeConstraintId')
193
+				=> ConstraintCheckerServices::getTypeChecker($services),
194
+			$config->get('WBQualityConstraintsValueTypeConstraintId')
195
+				=> ConstraintCheckerServices::getValueTypeChecker($services),
196
+			$config->get('WBQualityConstraintsSingleValueConstraintId')
197
+				=> ConstraintCheckerServices::getSingleValueChecker($services),
198
+			$config->get('WBQualityConstraintsMultiValueConstraintId')
199
+				=> ConstraintCheckerServices::getMultiValueChecker($services),
200
+			$config->get('WBQualityConstraintsDistinctValuesConstraintId')
201
+				=> ConstraintCheckerServices::getUniqueValueChecker($services),
202
+			$config->get('WBQualityConstraintsFormatConstraintId')
203
+				=> ConstraintCheckerServices::getFormatChecker($services),
204
+			$config->get('WBQualityConstraintsCommonsLinkConstraintId')
205
+				=> ConstraintCheckerServices::getCommonsLinkChecker($services),
206
+			$config->get('WBQualityConstraintsOneOfConstraintId')
207
+				=> ConstraintCheckerServices::getOneOfChecker($services),
208
+			$config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId')
209
+				=> ConstraintCheckerServices::getValueOnlyChecker($services),
210
+			$config->get('WBQualityConstraintsUsedAsReferenceConstraintId')
211
+				=> ConstraintCheckerServices::getReferenceChecker($services),
212
+			$config->get('WBQualityConstraintsNoBoundsConstraintId')
213
+				=> ConstraintCheckerServices::getNoBoundsChecker($services),
214
+			$config->get('WBQualityConstraintsAllowedUnitsConstraintId')
215
+				=> ConstraintCheckerServices::getAllowedUnitsChecker($services),
216
+			$config->get('WBQualityConstraintsSingleBestValueConstraintId')
217
+				=> ConstraintCheckerServices::getSingleBestValueChecker($services),
218
+			$config->get('WBQualityConstraintsAllowedEntityTypesConstraintId')
219
+				=> ConstraintCheckerServices::getEntityTypeChecker($services),
220
+			$config->get('WBQualityConstraintsNoneOfConstraintId')
221
+				=> ConstraintCheckerServices::getNoneOfChecker($services),
222
+			$config->get('WBQualityConstraintsIntegerConstraintId')
223
+				=> ConstraintCheckerServices::getIntegerChecker($services),
224
+			$config->get('WBQualityConstraintsCitationNeededConstraintId')
225
+				=> ConstraintCheckerServices::getCitationNeededChecker($services),
226
+			$config->get('WBQualityConstraintsPropertyScopeConstraintId')
227
+				=> ConstraintCheckerServices::getPropertyScopeChecker($services),
228
+			$config->get('WBQualityConstraintsContemporaryConstraintId')
229
+				=> ConstraintCheckerServices::getContemporaryChecker($services),
230 230
 		];
231 231
 
232 232
 		return new DelegatingConstraintChecker(
233
-			WikibaseServices::getEntityLookup( $services ),
233
+			WikibaseServices::getEntityLookup($services),
234 234
 			$checkerMap,
235
-			ConstraintsServices::getConstraintLookup( $services ),
236
-			ConstraintsServices::getConstraintParameterParser( $services ),
235
+			ConstraintsServices::getConstraintLookup($services),
236
+			ConstraintsServices::getConstraintParameterParser($services),
237 237
 			$statementGuidParser,
238
-			ConstraintsServices::getLoggingHelper( $services ),
239
-			$config->get( 'WBQualityConstraintsCheckQualifiers' ),
240
-			$config->get( 'WBQualityConstraintsCheckReferences' ),
241
-			$config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' )
238
+			ConstraintsServices::getLoggingHelper($services),
239
+			$config->get('WBQualityConstraintsCheckQualifiers'),
240
+			$config->get('WBQualityConstraintsCheckReferences'),
241
+			$config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers')
242 242
 		);
243 243
 	},
244 244
 
245
-	ConstraintsServices::RESULTS_SOURCE => function ( MediaWikiServices $services ) {
245
+	ConstraintsServices::RESULTS_SOURCE => function(MediaWikiServices $services) {
246 246
 		$config = $services->getMainConfig();
247 247
 		$resultsSource = new CheckingResultsSource(
248
-			ConstraintsServices::getDelegatingConstraintChecker( $services )
248
+			ConstraintsServices::getDelegatingConstraintChecker($services)
249 249
 		);
250 250
 
251 251
 		$cacheCheckConstraintsResults = false;
252 252
 
253
-		if ( $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) {
253
+		if ($config->get('WBQualityConstraintsCacheCheckConstraintsResults')) {
254 254
 			$cacheCheckConstraintsResults = true;
255 255
 			// check that we can use getLocalRepoWikiPageMetaDataAccessor()
256 256
 			// TODO we should always be able to cache constraint check results (T244726)
257
-			$entitySources = WikibaseRepo::getEntitySourceDefinitions( $services )->getSources();
258
-			$localEntitySourceName = WikibaseRepo::getLocalEntitySource( $services )->getSourceName();
257
+			$entitySources = WikibaseRepo::getEntitySourceDefinitions($services)->getSources();
258
+			$localEntitySourceName = WikibaseRepo::getLocalEntitySource($services)->getSourceName();
259 259
 
260
-			foreach ( $entitySources as $entitySource ) {
261
-				if ( $entitySource->getSourceName() !== $localEntitySourceName ) {
262
-					LoggerFactory::getInstance( 'WikibaseQualityConstraints' )->warning(
263
-						'Cannot cache constraint check results for non-local source: ' .
260
+			foreach ($entitySources as $entitySource) {
261
+				if ($entitySource->getSourceName() !== $localEntitySourceName) {
262
+					LoggerFactory::getInstance('WikibaseQualityConstraints')->warning(
263
+						'Cannot cache constraint check results for non-local source: '.
264 264
 						$entitySource->getSourceName()
265 265
 					);
266 266
 					$cacheCheckConstraintsResults = false;
@@ -269,28 +269,28 @@  discard block
 block discarded – undo
269 269
 			}
270 270
 		}
271 271
 
272
-		if ( $cacheCheckConstraintsResults ) {
272
+		if ($cacheCheckConstraintsResults) {
273 273
 			$possiblyStaleConstraintTypes = [
274
-				$config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ),
275
-				$config->get( 'WBQualityConstraintsTypeConstraintId' ),
276
-				$config->get( 'WBQualityConstraintsValueTypeConstraintId' ),
277
-				$config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ),
274
+				$config->get('WBQualityConstraintsCommonsLinkConstraintId'),
275
+				$config->get('WBQualityConstraintsTypeConstraintId'),
276
+				$config->get('WBQualityConstraintsValueTypeConstraintId'),
277
+				$config->get('WBQualityConstraintsDistinctValuesConstraintId'),
278 278
 			];
279
-			$entityIdParser = WikibaseRepo::getEntityIdParser( $services );
279
+			$entityIdParser = WikibaseRepo::getEntityIdParser($services);
280 280
 			$wikiPageEntityMetaDataAccessor = WikibaseRepo::getLocalRepoWikiPageMetaDataAccessor(
281 281
 				$services );
282 282
 
283 283
 			$resultsSource = new CachingResultsSource(
284 284
 				$resultsSource,
285 285
 				ResultsCache::getDefaultInstance(),
286
-				ConstraintsServices::getCheckResultSerializer( $services ),
287
-				ConstraintsServices::getCheckResultDeserializer( $services ),
286
+				ConstraintsServices::getCheckResultSerializer($services),
287
+				ConstraintsServices::getCheckResultDeserializer($services),
288 288
 				$wikiPageEntityMetaDataAccessor,
289 289
 				$entityIdParser,
290
-				$config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ),
290
+				$config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'),
291 291
 				$possiblyStaleConstraintTypes,
292
-				$config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ),
293
-				ConstraintsServices::getLoggingHelper( $services )
292
+				$config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'),
293
+				ConstraintsServices::getLoggingHelper($services)
294 294
 			);
295 295
 		}
296 296
 
Please login to merge, or discard this patch.
src/ServiceWiring-Wikibase.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
 use Wikibase\Repo\WikibaseRepo;
9 9
 
10 10
 return [
11
-	WikibaseServices::ENTITY_LOOKUP => function ( MediaWikiServices $services ) {
11
+	WikibaseServices::ENTITY_LOOKUP => function(MediaWikiServices $services) {
12 12
 		return new ExceptionIgnoringEntityLookup(
13
-			WikibaseRepo::getEntityLookup( $services )
13
+			WikibaseRepo::getEntityLookup($services)
14 14
 		);
15 15
 	},
16 16
 
17
-	WikibaseServices::ENTITY_LOOKUP_WITHOUT_CACHE => function ( MediaWikiServices $services ) {
17
+	WikibaseServices::ENTITY_LOOKUP_WITHOUT_CACHE => function(MediaWikiServices $services) {
18 18
 		return new ExceptionIgnoringEntityLookup(
19
-			WikibaseRepo::getStore( $services )
20
-				->getEntityLookup( Store::LOOKUP_CACHING_RETRIEVE_ONLY )
19
+			WikibaseRepo::getStore($services)
20
+				->getEntityLookup(Store::LOOKUP_CACHING_RETRIEVE_ONLY)
21 21
 		);
22 22
 	},
23 23
 
24
-	WikibaseServices::PROPERTY_DATA_TYPE_LOOKUP => function ( MediaWikiServices $services ) {
25
-		return WikibaseRepo::getPropertyDataTypeLookup( $services );
24
+	WikibaseServices::PROPERTY_DATA_TYPE_LOOKUP => function(MediaWikiServices $services) {
25
+		return WikibaseRepo::getPropertyDataTypeLookup($services);
26 26
 	},
27 27
 ];
Please login to merge, or discard this patch.
src/Job/UpdateConstraintsTableJob.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	private const BATCH_SIZE = 50;
40 40
 
41
-	public static function newFromGlobalState( Title $title, array $params ) {
42
-		Assert::parameterType( 'string', $params['propertyId'], '$params["propertyId"]' );
41
+	public static function newFromGlobalState(Title $title, array $params) {
42
+		Assert::parameterType('string', $params['propertyId'], '$params["propertyId"]');
43 43
 		$services = MediaWikiServices::getInstance();
44 44
 		return new UpdateConstraintsTableJob(
45 45
 			$title,
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 			$services->getMainConfig(),
50 50
 			ConstraintsServices::getConstraintStore(),
51 51
 			$services->getDBLoadBalancerFactory(),
52
-			WikibaseRepo::getStore()->getEntityRevisionLookup( Store::LOOKUP_CACHING_DISABLED ),
53
-			WikibaseRepo::getBaseDataModelSerializerFactory( $services )
52
+			WikibaseRepo::getStore()->getEntityRevisionLookup(Store::LOOKUP_CACHING_DISABLED),
53
+			WikibaseRepo::getBaseDataModelSerializerFactory($services)
54 54
 				->newSnakSerializer()
55 55
 		);
56 56
 	}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		EntityRevisionLookup $entityRevisionLookup,
111 111
 		Serializer $snakSerializer
112 112
 	) {
113
-		parent::__construct( 'constraintsTableUpdate', $title, $params );
113
+		parent::__construct('constraintsTableUpdate', $title, $params);
114 114
 
115 115
 		$this->propertyId = $propertyId;
116 116
 		$this->revisionId = $revisionId;
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 		$this->snakSerializer = $snakSerializer;
122 122
 	}
123 123
 
124
-	public function extractParametersFromQualifiers( SnakList $qualifiers ) {
124
+	public function extractParametersFromQualifiers(SnakList $qualifiers) {
125 125
 		$parameters = [];
126
-		foreach ( $qualifiers as $qualifier ) {
126
+		foreach ($qualifiers as $qualifier) {
127 127
 			$qualifierId = $qualifier->getPropertyId()->getSerialization();
128
-			$paramSerialization = $this->snakSerializer->serialize( $qualifier );
128
+			$paramSerialization = $this->snakSerializer->serialize($qualifier);
129 129
 			$parameters[$qualifierId][] = $paramSerialization;
130 130
 		}
131 131
 		return $parameters;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		'@phan-var \Wikibase\DataModel\Entity\EntityIdValue $dataValue';
143 143
 		$entityId = $dataValue->getEntityId();
144 144
 		$constraintTypeQid = $entityId->getSerialization();
145
-		$parameters = $this->extractParametersFromQualifiers( $constraintStatement->getQualifiers() );
145
+		$parameters = $this->extractParametersFromQualifiers($constraintStatement->getQualifiers());
146 146
 		return new Constraint(
147 147
 			$constraintId,
148 148
 			$propertyId,
@@ -157,24 +157,24 @@  discard block
 block discarded – undo
157 157
 		PropertyId $propertyConstraintPropertyId
158 158
 	) {
159 159
 		$constraintsStatements = $property->getStatements()
160
-			->getByPropertyId( $propertyConstraintPropertyId )
161
-			->getByRank( [ Statement::RANK_PREFERRED, Statement::RANK_NORMAL ] );
160
+			->getByPropertyId($propertyConstraintPropertyId)
161
+			->getByRank([Statement::RANK_PREFERRED, Statement::RANK_NORMAL]);
162 162
 		$constraints = [];
163
-		foreach ( $constraintsStatements->getIterator() as $constraintStatement ) {
164
-			$constraints[] = $this->extractConstraintFromStatement( $property->getId(), $constraintStatement );
165
-			if ( count( $constraints ) >= self::BATCH_SIZE ) {
166
-				$constraintStore->insertBatch( $constraints );
163
+		foreach ($constraintsStatements->getIterator() as $constraintStatement) {
164
+			$constraints[] = $this->extractConstraintFromStatement($property->getId(), $constraintStatement);
165
+			if (count($constraints) >= self::BATCH_SIZE) {
166
+				$constraintStore->insertBatch($constraints);
167 167
 				// interrupt transaction and wait for replication
168
-				$connection = $this->lbFactory->getMainLB()->getConnection( DB_MASTER );
169
-				$connection->endAtomic( __CLASS__ );
170
-				if ( !$connection->explicitTrxActive() ) {
168
+				$connection = $this->lbFactory->getMainLB()->getConnection(DB_MASTER);
169
+				$connection->endAtomic(__CLASS__);
170
+				if (!$connection->explicitTrxActive()) {
171 171
 					$this->lbFactory->waitForReplication();
172 172
 				}
173
-				$connection->startAtomic( __CLASS__ );
173
+				$connection->startAtomic(__CLASS__);
174 174
 				$constraints = [];
175 175
 			}
176 176
 		}
177
-		$constraintStore->insertBatch( $constraints );
177
+		$constraintStore->insertBatch($constraints);
178 178
 	}
179 179
 
180 180
 	/**
@@ -185,24 +185,24 @@  discard block
 block discarded – undo
185 185
 	public function run() {
186 186
 		// TODO in the future: only touch constraints affected by the edit (requires T163465)
187 187
 
188
-		$propertyId = new PropertyId( $this->propertyId );
188
+		$propertyId = new PropertyId($this->propertyId);
189 189
 		$propertyRevision = $this->entityRevisionLookup->getEntityRevision(
190 190
 			$propertyId,
191 191
 			0, // latest
192 192
 			LookupConstants::LATEST_FROM_REPLICA
193 193
 		);
194 194
 
195
-		if ( $this->revisionId !== null && $propertyRevision->getRevisionId() < $this->revisionId ) {
196
-			JobQueueGroup::singleton()->push( $this );
195
+		if ($this->revisionId !== null && $propertyRevision->getRevisionId() < $this->revisionId) {
196
+			JobQueueGroup::singleton()->push($this);
197 197
 			return true;
198 198
 		}
199 199
 
200
-		$connection = $this->lbFactory->getMainLB()->getConnection( DB_MASTER );
200
+		$connection = $this->lbFactory->getMainLB()->getConnection(DB_MASTER);
201 201
 		// start transaction (if not started yet) – using __CLASS__, not __METHOD__,
202 202
 		// because importConstraintsForProperty() can interrupt the transaction
203
-		$connection->startAtomic( __CLASS__ );
203
+		$connection->startAtomic(__CLASS__);
204 204
 
205
-		$this->constraintStore->deleteForProperty( $propertyId );
205
+		$this->constraintStore->deleteForProperty($propertyId);
206 206
 
207 207
 		/** @var Property $property */
208 208
 		$property = $propertyRevision->getEntity();
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
 		$this->importConstraintsForProperty(
211 211
 			$property,
212 212
 			$this->constraintStore,
213
-			new PropertyId( $this->config->get( 'WBQualityConstraintsPropertyConstraintId' ) )
213
+			new PropertyId($this->config->get('WBQualityConstraintsPropertyConstraintId'))
214 214
 		);
215 215
 
216
-		$connection->endAtomic( __CLASS__ );
216
+		$connection->endAtomic(__CLASS__);
217 217
 
218 218
 		return true;
219 219
 	}
Please login to merge, or discard this patch.
src/Api/CheckResultsRendererFactory.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types=1);
4 4
 
5 5
 namespace WikibaseQuality\ConstraintReport\Api;
6 6
 
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 		$this->violationMessageRendererFactory = $violationMessageRendererFactory;
34 34
 	}
35 35
 
36
-	public function getCheckResultsRenderer( Language $language ): CheckResultsRenderer {
36
+	public function getCheckResultsRenderer(Language $language): CheckResultsRenderer {
37 37
 		return new CheckResultsRenderer(
38 38
 			$this->entityTitleLookup,
39 39
 			$this->entityIdLabelFormatterFactory
40
-				->getEntityIdFormatter( $language ),
40
+				->getEntityIdFormatter($language),
41 41
 			$this->violationMessageRendererFactory
42
-				->getViolationMessageRenderer( $language )
42
+				->getViolationMessageRenderer($language)
43 43
 		);
44 44
 	}
45 45
 
Please login to merge, or discard this patch.
src/Api/CheckConstraintParameters.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 		StatementGuidParser $statementGuidParser,
103 103
 		IBufferingStatsdDataFactory $dataFactory
104 104
 	) {
105
-		parent::__construct( $main, $name );
105
+		parent::__construct($main, $name);
106 106
 
107
-		$this->apiErrorReporter = $apiHelperFactory->getErrorReporter( $this );
107
+		$this->apiErrorReporter = $apiHelperFactory->getErrorReporter($this);
108 108
 		$this->delegatingConstraintChecker = $delegatingConstraintChecker;
109 109
 		$this->violationMessageRendererFactory = $violationMessageRendererFactory;
110 110
 		$this->statementGuidParser = $statementGuidParser;
@@ -119,39 +119,39 @@  discard block
 block discarded – undo
119 119
 		$params = $this->extractRequestParams();
120 120
 		$result = $this->getResult();
121 121
 
122
-		$propertyIds = $this->parsePropertyIds( $params[self::PARAM_PROPERTY_ID] );
123
-		$constraintIds = $this->parseConstraintIds( $params[self::PARAM_CONSTRAINT_ID] );
122
+		$propertyIds = $this->parsePropertyIds($params[self::PARAM_PROPERTY_ID]);
123
+		$constraintIds = $this->parseConstraintIds($params[self::PARAM_CONSTRAINT_ID]);
124 124
 
125
-		$this->checkPropertyIds( $propertyIds, $result );
126
-		$this->checkConstraintIds( $constraintIds, $result );
125
+		$this->checkPropertyIds($propertyIds, $result);
126
+		$this->checkConstraintIds($constraintIds, $result);
127 127
 
128
-		$result->addValue( null, 'success', 1 );
128
+		$result->addValue(null, 'success', 1);
129 129
 	}
130 130
 
131 131
 	/**
132 132
 	 * @param array|null $propertyIdSerializations
133 133
 	 * @return PropertyId[]
134 134
 	 */
135
-	private function parsePropertyIds( $propertyIdSerializations ) {
136
-		if ( $propertyIdSerializations === null ) {
135
+	private function parsePropertyIds($propertyIdSerializations) {
136
+		if ($propertyIdSerializations === null) {
137 137
 			return [];
138
-		} elseif ( empty( $propertyIdSerializations ) ) {
138
+		} elseif (empty($propertyIdSerializations)) {
139 139
 			$this->apiErrorReporter->dieError(
140
-				'If ' . self::PARAM_PROPERTY_ID . ' is specified, it must be nonempty.',
140
+				'If '.self::PARAM_PROPERTY_ID.' is specified, it must be nonempty.',
141 141
 				'no-data'
142 142
 			);
143 143
 		}
144 144
 
145 145
 		return array_map(
146
-			function ( $propertyIdSerialization ) {
146
+			function($propertyIdSerialization) {
147 147
 				try {
148
-					return new PropertyId( $propertyIdSerialization );
149
-				} catch ( InvalidArgumentException $e ) {
148
+					return new PropertyId($propertyIdSerialization);
149
+				} catch (InvalidArgumentException $e) {
150 150
 					$this->apiErrorReporter->dieError(
151 151
 						"Invalid id: $propertyIdSerialization",
152 152
 						'invalid-property-id',
153 153
 						0, // default argument
154
-						[ self::PARAM_PROPERTY_ID => $propertyIdSerialization ]
154
+						[self::PARAM_PROPERTY_ID => $propertyIdSerialization]
155 155
 					);
156 156
 				}
157 157
 			},
@@ -163,35 +163,35 @@  discard block
 block discarded – undo
163 163
 	 * @param array|null $constraintIds
164 164
 	 * @return string[]
165 165
 	 */
166
-	private function parseConstraintIds( $constraintIds ) {
167
-		if ( $constraintIds === null ) {
166
+	private function parseConstraintIds($constraintIds) {
167
+		if ($constraintIds === null) {
168 168
 			return [];
169
-		} elseif ( empty( $constraintIds ) ) {
169
+		} elseif (empty($constraintIds)) {
170 170
 			$this->apiErrorReporter->dieError(
171
-				'If ' . self::PARAM_CONSTRAINT_ID . ' is specified, it must be nonempty.',
171
+				'If '.self::PARAM_CONSTRAINT_ID.' is specified, it must be nonempty.',
172 172
 				'no-data'
173 173
 			);
174 174
 		}
175 175
 
176 176
 		return array_map(
177
-			function ( $constraintId ) {
177
+			function($constraintId) {
178 178
 				try {
179
-					$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
180
-					if ( !$propertyId instanceof PropertyId ) {
179
+					$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
180
+					if (!$propertyId instanceof PropertyId) {
181 181
 						$this->apiErrorReporter->dieError(
182 182
 							"Invalid property ID: {$propertyId->getSerialization()}",
183 183
 							'invalid-property-id',
184 184
 							0, // default argument
185
-							[ self::PARAM_CONSTRAINT_ID => $constraintId ]
185
+							[self::PARAM_CONSTRAINT_ID => $constraintId]
186 186
 						);
187 187
 					}
188 188
 					return $constraintId;
189
-				} catch ( StatementGuidParsingException $e ) {
189
+				} catch (StatementGuidParsingException $e) {
190 190
 					$this->apiErrorReporter->dieError(
191 191
 						"Invalid statement GUID: $constraintId",
192 192
 						'invalid-guid',
193 193
 						0, // default argument
194
-						[ self::PARAM_CONSTRAINT_ID => $constraintId ]
194
+						[self::PARAM_CONSTRAINT_ID => $constraintId]
195 195
 					);
196 196
 				}
197 197
 			},
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
 	 * @param PropertyId[] $propertyIds
204 204
 	 * @param ApiResult $result
205 205
 	 */
206
-	private function checkPropertyIds( array $propertyIds, ApiResult $result ) {
207
-		foreach ( $propertyIds as $propertyId ) {
208
-			$result->addArrayType( $this->getResultPathForPropertyId( $propertyId ), 'assoc' );
206
+	private function checkPropertyIds(array $propertyIds, ApiResult $result) {
207
+		foreach ($propertyIds as $propertyId) {
208
+			$result->addArrayType($this->getResultPathForPropertyId($propertyId), 'assoc');
209 209
 			$allConstraintExceptions = $this->delegatingConstraintChecker
210
-				->checkConstraintParametersOnPropertyId( $propertyId );
211
-			foreach ( $allConstraintExceptions as $constraintId => $constraintParameterExceptions ) {
210
+				->checkConstraintParametersOnPropertyId($propertyId);
211
+			foreach ($allConstraintExceptions as $constraintId => $constraintParameterExceptions) {
212 212
 				$this->addConstraintParameterExceptionsToResult(
213 213
 					$constraintId,
214 214
 					$constraintParameterExceptions,
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
 	 * @param string[] $constraintIds
223 223
 	 * @param ApiResult $result
224 224
 	 */
225
-	private function checkConstraintIds( array $constraintIds, ApiResult $result ) {
226
-		foreach ( $constraintIds as $constraintId ) {
227
-			if ( $result->getResultData( $this->getResultPathForConstraintId( $constraintId ) ) ) {
225
+	private function checkConstraintIds(array $constraintIds, ApiResult $result) {
226
+		foreach ($constraintIds as $constraintId) {
227
+			if ($result->getResultData($this->getResultPathForConstraintId($constraintId))) {
228 228
 				// already checked as part of checkPropertyIds()
229 229
 				continue;
230 230
 			}
231 231
 			$constraintParameterExceptions = $this->delegatingConstraintChecker
232
-				->checkConstraintParametersOnConstraintId( $constraintId );
233
-			$this->addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, $result );
232
+				->checkConstraintParametersOnConstraintId($constraintId);
233
+			$this->addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, $result);
234 234
 		}
235 235
 	}
236 236
 
@@ -238,18 +238,18 @@  discard block
 block discarded – undo
238 238
 	 * @param PropertyId $propertyId
239 239
 	 * @return string[]
240 240
 	 */
241
-	private function getResultPathForPropertyId( PropertyId $propertyId ) {
242
-		return [ $this->getModuleName(), $propertyId->getSerialization() ];
241
+	private function getResultPathForPropertyId(PropertyId $propertyId) {
242
+		return [$this->getModuleName(), $propertyId->getSerialization()];
243 243
 	}
244 244
 
245 245
 	/**
246 246
 	 * @param string $constraintId
247 247
 	 * @return string[]
248 248
 	 */
249
-	private function getResultPathForConstraintId( $constraintId ) {
250
-		$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
249
+	private function getResultPathForConstraintId($constraintId) {
250
+		$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
251 251
 		'@phan-var PropertyId $propertyId';
252
-		return array_merge( $this->getResultPathForPropertyId( $propertyId ), [ $constraintId ] );
252
+		return array_merge($this->getResultPathForPropertyId($propertyId), [$constraintId]);
253 253
 	}
254 254
 
255 255
 	/**
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 		$constraintParameterExceptions,
265 265
 		ApiResult $result
266 266
 	) {
267
-		$path = $this->getResultPathForConstraintId( $constraintId );
268
-		if ( $constraintParameterExceptions === null ) {
267
+		$path = $this->getResultPathForConstraintId($constraintId);
268
+		if ($constraintParameterExceptions === null) {
269 269
 			$result->addValue(
270 270
 				$path,
271 271
 				self::KEY_STATUS,
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
 			$result->addValue(
276 276
 				$path,
277 277
 				self::KEY_STATUS,
278
-				empty( $constraintParameterExceptions ) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY
278
+				empty($constraintParameterExceptions) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY
279 279
 			);
280 280
 
281 281
 			$violationMessageRenderer = $this->violationMessageRendererFactory
282
-				->getViolationMessageRenderer( $this->getLanguage() );
282
+				->getViolationMessageRenderer($this->getLanguage());
283 283
 			$problems = [];
284
-			foreach ( $constraintParameterExceptions as $constraintParameterException ) {
284
+			foreach ($constraintParameterExceptions as $constraintParameterException) {
285 285
 				$problems[] = [
286 286
 					self::KEY_MESSAGE_HTML => $violationMessageRenderer->render(
287 287
 						$constraintParameterException->getViolationMessage() ),
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 		return [
321 321
 			'action=wbcheckconstraintparameters&propertyid=P247'
322 322
 				=> 'apihelp-wbcheckconstraintparameters-example-propertyid-1',
323
-			'action=wbcheckconstraintparameters&' .
324
-			'constraintid=P247$0fe1711e-4c0f-82ce-3af0-830b721d0fba|' .
323
+			'action=wbcheckconstraintparameters&'.
324
+			'constraintid=P247$0fe1711e-4c0f-82ce-3af0-830b721d0fba|'.
325 325
 			'P225$cdc71e4a-47a0-12c5-dfb3-3f6fc0b6613f'
326 326
 				=> 'apihelp-wbcheckconstraintparameters-example-constraintid-2',
327 327
 		];
Please login to merge, or discard this patch.
src/Api/CheckConstraints.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 		CheckResultsRendererFactory $checkResultsRendererFactory,
117 117
 		IBufferingStatsdDataFactory $dataFactory
118 118
 	) {
119
-		parent::__construct( $main, $name );
119
+		parent::__construct($main, $name);
120 120
 		$this->entityIdParser = $entityIdParser;
121 121
 		$this->statementGuidValidator = $statementGuidValidator;
122
-		$this->resultBuilder = $apiHelperFactory->getResultBuilder( $this );
123
-		$this->errorReporter = $apiHelperFactory->getErrorReporter( $this );
122
+		$this->resultBuilder = $apiHelperFactory->getResultBuilder($this);
123
+		$this->errorReporter = $apiHelperFactory->getErrorReporter($this);
124 124
 		$this->resultsSource = $resultsSource;
125 125
 		$this->checkResultsRendererFactory = $checkResultsRendererFactory;
126 126
 		$this->dataFactory = $dataFactory;
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 
137 137
 		$params = $this->extractRequestParams();
138 138
 
139
-		$this->validateParameters( $params );
140
-		$entityIds = $this->parseEntityIds( $params );
141
-		$claimIds = $this->parseClaimIds( $params );
139
+		$this->validateParameters($params);
140
+		$entityIds = $this->parseEntityIds($params);
141
+		$claimIds = $this->parseClaimIds($params);
142 142
 		$constraintIDs = $params[self::PARAM_CONSTRAINT_ID];
143 143
 		$statuses = $params[self::PARAM_STATUS];
144 144
 
145 145
 		$checkResultsRenderer = $this->checkResultsRendererFactory
146
-			->getCheckResultsRenderer( $this->getLanguage() );
146
+			->getCheckResultsRenderer($this->getLanguage());
147 147
 
148 148
 		$this->getResult()->addValue(
149 149
 			null,
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 				)
158 158
 			)->getArray()
159 159
 		);
160
-		$this->resultBuilder->markSuccess( 1 );
160
+		$this->resultBuilder->markSuccess(1);
161 161
 	}
162 162
 
163 163
 	/**
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return EntityId[]
167 167
 	 */
168
-	private function parseEntityIds( array $params ) {
168
+	private function parseEntityIds(array $params) {
169 169
 		$ids = $params[self::PARAM_ID];
170 170
 
171
-		if ( $ids === null ) {
171
+		if ($ids === null) {
172 172
 			return [];
173
-		} elseif ( $ids === [] ) {
173
+		} elseif ($ids === []) {
174 174
 			$this->errorReporter->dieError(
175
-				'If ' . self::PARAM_ID . ' is specified, it must be nonempty.', 'no-data' );
175
+				'If '.self::PARAM_ID.' is specified, it must be nonempty.', 'no-data' );
176 176
 		}
177 177
 
178
-		return array_map( function ( $id ) {
178
+		return array_map(function($id) {
179 179
 			try {
180
-				return $this->entityIdParser->parse( $id );
181
-			} catch ( EntityIdParsingException $e ) {
180
+				return $this->entityIdParser->parse($id);
181
+			} catch (EntityIdParsingException $e) {
182 182
 				$this->errorReporter->dieError(
183
-					"Invalid id: $id", 'invalid-entity-id', 0, [ self::PARAM_ID => $id ] );
183
+					"Invalid id: $id", 'invalid-entity-id', 0, [self::PARAM_ID => $id] );
184 184
 			}
185
-		}, $ids );
185
+		}, $ids);
186 186
 	}
187 187
 
188 188
 	/**
@@ -190,35 +190,35 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @return string[]
192 192
 	 */
193
-	private function parseClaimIds( array $params ) {
193
+	private function parseClaimIds(array $params) {
194 194
 		$ids = $params[self::PARAM_CLAIM_ID];
195 195
 
196
-		if ( $ids === null ) {
196
+		if ($ids === null) {
197 197
 			return [];
198
-		} elseif ( $ids === [] ) {
198
+		} elseif ($ids === []) {
199 199
 			$this->errorReporter->dieError(
200
-				'If ' . self::PARAM_CLAIM_ID . ' is specified, it must be nonempty.', 'no-data' );
200
+				'If '.self::PARAM_CLAIM_ID.' is specified, it must be nonempty.', 'no-data' );
201 201
 		}
202 202
 
203
-		foreach ( $ids as $id ) {
204
-			if ( !$this->statementGuidValidator->validate( $id ) ) {
203
+		foreach ($ids as $id) {
204
+			if (!$this->statementGuidValidator->validate($id)) {
205 205
 				$this->errorReporter->dieError(
206
-					"Invalid claim id: $id", 'invalid-guid', 0, [ self::PARAM_CLAIM_ID => $id ] );
206
+					"Invalid claim id: $id", 'invalid-guid', 0, [self::PARAM_CLAIM_ID => $id] );
207 207
 			}
208 208
 		}
209 209
 
210 210
 		return $ids;
211 211
 	}
212 212
 
213
-	private function validateParameters( array $params ) {
214
-		if ( $params[self::PARAM_CONSTRAINT_ID] !== null
215
-			 && empty( $params[self::PARAM_CONSTRAINT_ID] )
213
+	private function validateParameters(array $params) {
214
+		if ($params[self::PARAM_CONSTRAINT_ID] !== null
215
+			 && empty($params[self::PARAM_CONSTRAINT_ID])
216 216
 		) {
217 217
 			$paramConstraintId = self::PARAM_CONSTRAINT_ID;
218 218
 			$this->errorReporter->dieError(
219 219
 				"If $paramConstraintId is specified, it must be nonempty.", 'no-data' );
220 220
 		}
221
-		if ( $params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null ) {
221
+		if ($params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null) {
222 222
 			$paramId = self::PARAM_ID;
223 223
 			$paramClaimId = self::PARAM_CLAIM_ID;
224 224
 			$this->errorReporter->dieError(
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 				],
260 260
 				ApiBase::PARAM_ISMULTI => true,
261 261
 				ApiBase::PARAM_ALL => true,
262
-				ApiBase::PARAM_DFLT => implode( '|', CachingResultsSource::CACHED_STATUSES ),
262
+				ApiBase::PARAM_DFLT => implode('|', CachingResultsSource::CACHED_STATUSES),
263 263
 				ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
264 264
 			],
265 265
 		];
Please login to merge, or discard this patch.
src/ConstraintCheck/Message/ViolationMessageRendererFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types=1);
4 4
 
5 5
 namespace WikibaseQuality\ConstraintReport\ConstraintCheck\Message;
6 6
 
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 		$this->valueFormatterFactory = $valueFormatterFactory;
42 42
 	}
43 43
 
44
-	public function getViolationMessageRenderer( Language $language ): ViolationMessageRenderer {
44
+	public function getViolationMessageRenderer(Language $language): ViolationMessageRenderer {
45 45
 		$formatterOptions = new FormatterOptions();
46
-		$formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() );
46
+		$formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode());
47 47
 		return new MultilingualTextViolationMessageRenderer(
48 48
 			$this->entityIdHtmlLinkFormatterFactory
49
-				->getEntityIdFormatter( $language ),
49
+				->getEntityIdFormatter($language),
50 50
 			$this->valueFormatterFactory
51
-				->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions ),
51
+				->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions),
52 52
 			$this->messageLocalizer,
53 53
 			$this->config
54 54
 		);
Please login to merge, or discard this patch.