Completed
Push — master ( f6c8aa...bad1fb )
by
unknown
36s queued 12s
created
src/ConstraintCheck/Context/MainSnakContext.php 1 patch
Spacing   +32 added lines, -32 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\Context;
6 6
 
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
 	private Statement $statement;
23 23
 
24
-	public function __construct( StatementListProvidingEntity $entity, Statement $statement ) {
25
-		parent::__construct( $entity, $statement->getMainSnak() );
24
+	public function __construct(StatementListProvidingEntity $entity, Statement $statement) {
25
+		parent::__construct($entity, $statement->getMainSnak());
26 26
 
27 27
 		$this->statement = $statement;
28 28
 	}
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
 		return $this->statement;
40 40
 	}
41 41
 
42
-	public function getSnakGroup( string $groupingMode, array $separators = [] ): array {
42
+	public function getSnakGroup(string $groupingMode, array $separators = []): array {
43 43
 		/** @var StatementList $statements */
44 44
 		$statements = $this->entity->getStatements();
45
-		switch ( $groupingMode ) {
45
+		switch ($groupingMode) {
46 46
 			case Context::GROUP_NON_DEPRECATED:
47
-				$statements = $statements->getByRank( [
47
+				$statements = $statements->getByRank([
48 48
 					Statement::RANK_NORMAL,
49 49
 					Statement::RANK_PREFERRED,
50
-				] );
50
+				]);
51 51
 				break;
52 52
 			case Context::GROUP_BEST_RANK:
53
-				$statements = $this->getBestStatementsPerPropertyId( $statements );
53
+				$statements = $this->getBestStatementsPerPropertyId($statements);
54 54
 				break;
55 55
 			default:
56
-				throw new LogicException( 'Unknown $groupingMode ' . $groupingMode );
56
+				throw new LogicException('Unknown $groupingMode '.$groupingMode);
57 57
 		}
58 58
 		return $this->getStatementsWithSameQualifiersForProperties(
59 59
 			$this->statement,
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 		)->getMainSnaks();
63 63
 	}
64 64
 
65
-	private function getBestStatementsPerPropertyId( StatementList $statements ): StatementList {
65
+	private function getBestStatementsPerPropertyId(StatementList $statements): StatementList {
66 66
 		$allBestStatements = new StatementList();
67
-		foreach ( $statements->getPropertyIds() as $propertyId ) {
68
-			$bestStatements = $statements->getByPropertyId( $propertyId )
67
+		foreach ($statements->getPropertyIds() as $propertyId) {
68
+			$bestStatements = $statements->getByPropertyId($propertyId)
69 69
 				->getBestStatements();
70
-			foreach ( $bestStatements as $bestStatement ) {
71
-				$allBestStatements->addStatement( $bestStatement );
70
+			foreach ($bestStatements as $bestStatement) {
71
+				$allBestStatements->addStatement($bestStatement);
72 72
 			}
73 73
 		}
74 74
 		return $allBestStatements;
@@ -90,20 +90,20 @@  discard block
 block discarded – undo
90 90
 		array $qualifierPropertyIds
91 91
 	): StatementList {
92 92
 		$similarStatements = new StatementList();
93
-		foreach ( $allStatements as $statement ) {
94
-			if ( $statement === $currentStatement ) {
93
+		foreach ($allStatements as $statement) {
94
+			if ($statement === $currentStatement) {
95 95
 				// if the statement has an “unknown value” qualifier,
96 96
 				// it might be considered different from itself,
97 97
 				// so add it explicitly to ensure it’s always included
98
-				$similarStatements->addStatement( $statement );
98
+				$similarStatements->addStatement($statement);
99 99
 				continue;
100 100
 			}
101
-			foreach ( $qualifierPropertyIds as $qualifierPropertyId ) {
102
-				if ( !$this->haveSameQualifiers( $currentStatement, $statement, $qualifierPropertyId ) ) {
101
+			foreach ($qualifierPropertyIds as $qualifierPropertyId) {
102
+				if (!$this->haveSameQualifiers($currentStatement, $statement, $qualifierPropertyId)) {
103 103
 					continue 2;
104 104
 				}
105 105
 			}
106
-			$similarStatements->addStatement( $statement );
106
+			$similarStatements->addStatement($statement);
107 107
 		}
108 108
 		return $similarStatements;
109 109
 	}
@@ -112,19 +112,19 @@  discard block
 block discarded – undo
112 112
 	 * Tests whether two statements have the same qualifiers with a certain property ID.
113 113
 	 * “unknown value” qualifiers are considered different from each other.
114 114
 	 */
115
-	private function haveSameQualifiers( Statement $s1, Statement $s2, PropertyId $propertyId ): bool {
116
-		$q1 = $this->getSnaksWithPropertyId( $s1->getQualifiers(), $propertyId );
117
-		$q2 = $this->getSnaksWithPropertyId( $s2->getQualifiers(), $propertyId );
115
+	private function haveSameQualifiers(Statement $s1, Statement $s2, PropertyId $propertyId): bool {
116
+		$q1 = $this->getSnaksWithPropertyId($s1->getQualifiers(), $propertyId);
117
+		$q2 = $this->getSnaksWithPropertyId($s2->getQualifiers(), $propertyId);
118 118
 
119
-		if ( $q1->count() !== $q2->count() ) {
119
+		if ($q1->count() !== $q2->count()) {
120 120
 			return false;
121 121
 		}
122 122
 
123
-		foreach ( $q1 as $qualifier ) {
124
-			switch ( $qualifier->getType() ) {
123
+		foreach ($q1 as $qualifier) {
124
+			switch ($qualifier->getType()) {
125 125
 				case 'value':
126 126
 				case 'novalue':
127
-					if ( !$q2->hasSnak( $qualifier ) ) {
127
+					if (!$q2->hasSnak($qualifier)) {
128 128
 						return false;
129 129
 					}
130 130
 					break;
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 	/**
143 143
 	 * Returns the snaks of the given snak list with the specified property ID.
144 144
 	 */
145
-	private function getSnaksWithPropertyId( SnakList $allSnaks, PropertyId $propertyId ): SnakList {
145
+	private function getSnaksWithPropertyId(SnakList $allSnaks, PropertyId $propertyId): SnakList {
146 146
 		$snaks = new SnakList();
147 147
 		/** @var Snak $snak */
148
-		foreach ( $allSnaks as $snak ) {
149
-			if ( $snak->getPropertyId()->equals( $propertyId ) ) {
150
-				$snaks->addSnak( $snak );
148
+		foreach ($allSnaks as $snak) {
149
+			if ($snak->getPropertyId()->equals($propertyId)) {
150
+				$snaks->addSnak($snak);
151 151
 			}
152 152
 		}
153 153
 		return $snaks;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		return new MainSnakContextCursor(
158 158
 			$this->entity->getId()->getSerialization(),
159 159
 			$this->statement->getPropertyId()->getSerialization(),
160
-			$this->getStatementGuid( $this->statement ),
160
+			$this->getStatementGuid($this->statement),
161 161
 			$this->statement->getMainSnak()->getHash()
162 162
 		);
163 163
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Message/ViolationMessageRenderer.php 1 patch
Spacing   +87 added lines, -87 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
 
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 		$this->maxListLength = $maxListLength;
60 60
 	}
61 61
 
62
-	public function render( ViolationMessage $violationMessage ): string {
62
+	public function render(ViolationMessage $violationMessage): string {
63 63
 		$messageKey = $violationMessage->getMessageKey();
64
-		$paramsLists = [ [] ];
65
-		foreach ( $violationMessage->getArguments() as $argument ) {
66
-			$params = $this->renderArgument( $argument );
64
+		$paramsLists = [[]];
65
+		foreach ($violationMessage->getArguments() as $argument) {
66
+			$params = $this->renderArgument($argument);
67 67
 			$paramsLists[] = $params;
68 68
 		}
69
-		$allParams = call_user_func_array( 'array_merge', $paramsLists );
69
+		$allParams = call_user_func_array('array_merge', $paramsLists);
70 70
 		return $this->messageLocalizer
71
-			->msg( $messageKey )
72
-			->params( $allParams )
71
+			->msg($messageKey)
72
+			->params($allParams)
73 73
 			->escaped();
74 74
 	}
75 75
 
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
 	 * @param string|null $role one of the Role::* constants
79 79
 	 * @return string HTML
80 80
 	 */
81
-	protected function addRole( string $value, ?string $role ): string {
82
-		if ( $role === null ) {
81
+	protected function addRole(string $value, ?string $role): string {
82
+		if ($role === null) {
83 83
 			return $value;
84 84
 		}
85 85
 
86
-		return '<span class="wbqc-role wbqc-role-' . htmlspecialchars( $role ) . '">' .
87
-			$value .
86
+		return '<span class="wbqc-role wbqc-role-'.htmlspecialchars($role).'">'.
87
+			$value.
88 88
 			'</span>';
89 89
 	}
90 90
 
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
 	 * @param string $key message key
93 93
 	 * @return string HTML
94 94
 	 */
95
-	protected function msgEscaped( string $key ): string {
96
-		return $this->messageLocalizer->msg( $key )->escaped();
95
+	protected function msgEscaped(string $key): string {
96
+		return $this->messageLocalizer->msg($key)->escaped();
97 97
 	}
98 98
 
99 99
 	/**
100 100
 	 * @param array $argument
101 101
 	 * @return array[] params (for Message::params)
102 102
 	 */
103
-	protected function renderArgument( array $argument ): array {
103
+	protected function renderArgument(array $argument): array {
104 104
 		$methods = [
105 105
 			ViolationMessage::TYPE_ENTITY_ID => 'renderEntityId',
106 106
 			ViolationMessage::TYPE_ENTITY_ID_LIST => 'renderEntityIdList',
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 		$value = $argument['value'];
122 122
 		$role = $argument['role'];
123 123
 
124
-		if ( array_key_exists( $type, $methods ) ) {
124
+		if (array_key_exists($type, $methods)) {
125 125
 			$method = $methods[$type];
126
-			$params = $this->$method( $value, $role );
126
+			$params = $this->$method($value, $role);
127 127
 		} else {
128 128
 			throw new InvalidArgumentException(
129
-				'Unknown ViolationMessage argument type ' . $type . '!'
129
+				'Unknown ViolationMessage argument type '.$type.'!'
130 130
 			);
131 131
 		}
132 132
 
@@ -140,36 +140,36 @@  discard block
 block discarded – undo
140 140
 	 * and return a single-element array with a raw message param (i. e. [ Message::rawParam( … ) ])
141 141
 	 * @return array[] list of parameters as accepted by Message::params()
142 142
 	 */
143
-	private function renderList( array $list, ?string $role, callable $render ): array {
144
-		if ( $list === [] ) {
143
+	private function renderList(array $list, ?string $role, callable $render): array {
144
+		if ($list === []) {
145 145
 			return [
146
-				Message::numParam( 0 ),
147
-				Message::rawParam( '<ul></ul>' ),
146
+				Message::numParam(0),
147
+				Message::rawParam('<ul></ul>'),
148 148
 			];
149 149
 		}
150 150
 
151
-		if ( count( $list ) > $this->maxListLength ) {
152
-			$list = array_slice( $list, 0, $this->maxListLength );
151
+		if (count($list) > $this->maxListLength) {
152
+			$list = array_slice($list, 0, $this->maxListLength);
153 153
 			$truncated = true;
154 154
 		}
155 155
 
156 156
 		$renderedParamsLists = array_map(
157 157
 			$render,
158 158
 			$list,
159
-			array_fill( 0, count( $list ), $role )
159
+			array_fill(0, count($list), $role)
160 160
 		);
161
-		$renderedParams = array_column( $renderedParamsLists, 0 );
162
-		$renderedElements = array_column( $renderedParams, 'raw' );
163
-		if ( isset( $truncated ) ) {
164
-			$renderedElements[] = $this->msgEscaped( 'ellipsis' );
161
+		$renderedParams = array_column($renderedParamsLists, 0);
162
+		$renderedElements = array_column($renderedParams, 'raw');
163
+		if (isset($truncated)) {
164
+			$renderedElements[] = $this->msgEscaped('ellipsis');
165 165
 		}
166 166
 
167 167
 		return array_merge(
168 168
 			[
169
-				Message::numParam( count( $list ) ),
169
+				Message::numParam(count($list)),
170 170
 				Message::rawParam(
171
-					'<ul><li>' .
172
-					implode( '</li><li>', $renderedElements ) .
171
+					'<ul><li>'.
172
+					implode('</li><li>', $renderedElements).
173 173
 					'</li></ul>'
174 174
 				),
175 175
 			],
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param string|null $role one of the Role::* constants
183 183
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
184 184
 	 */
185
-	private function renderEntityId( EntityId $entityId, ?string $role ): array {
186
-		return [ Message::rawParam( $this->addRole(
187
-			$this->entityIdFormatter->formatEntityId( $entityId ),
185
+	private function renderEntityId(EntityId $entityId, ?string $role): array {
186
+		return [Message::rawParam($this->addRole(
187
+			$this->entityIdFormatter->formatEntityId($entityId),
188 188
 			$role
189
-		) ) ];
189
+		))];
190 190
 	}
191 191
 
192 192
 	/**
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	 * @param string|null $role one of the Role::* constants
195 195
 	 * @return array[] list of parameters as accepted by Message::params()
196 196
 	 */
197
-	private function renderEntityIdList( array $entityIdList, ?string $role ): array {
198
-		return $this->renderList( $entityIdList, $role, [ $this, 'renderEntityId' ] );
197
+	private function renderEntityIdList(array $entityIdList, ?string $role): array {
198
+		return $this->renderList($entityIdList, $role, [$this, 'renderEntityId']);
199 199
 	}
200 200
 
201 201
 	/**
@@ -203,24 +203,24 @@  discard block
 block discarded – undo
203 203
 	 * @param string|null $role one of the Role::* constants
204 204
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
205 205
 	 */
206
-	private function renderItemIdSnakValue( ItemIdSnakValue $value, ?string $role ): array {
207
-		switch ( true ) {
206
+	private function renderItemIdSnakValue(ItemIdSnakValue $value, ?string $role): array {
207
+		switch (true) {
208 208
 			case $value->isValue():
209
-				return $this->renderEntityId( $value->getItemId(), $role );
209
+				return $this->renderEntityId($value->getItemId(), $role);
210 210
 			case $value->isSomeValue():
211
-				return [ Message::rawParam( $this->addRole(
212
-					'<span class="wikibase-snakview-variation-somevaluesnak">' .
213
-						$this->msgEscaped( 'wikibase-snakview-snaktypeselector-somevalue' ) .
211
+				return [Message::rawParam($this->addRole(
212
+					'<span class="wikibase-snakview-variation-somevaluesnak">'.
213
+						$this->msgEscaped('wikibase-snakview-snaktypeselector-somevalue').
214 214
 						'</span>',
215 215
 					$role
216
-				) ) ];
216
+				))];
217 217
 			case $value->isNoValue():
218
-				return [ Message::rawParam( $this->addRole(
219
-					'<span class="wikibase-snakview-variation-novaluesnak">' .
220
-					$this->msgEscaped( 'wikibase-snakview-snaktypeselector-novalue' ) .
218
+				return [Message::rawParam($this->addRole(
219
+					'<span class="wikibase-snakview-variation-novaluesnak">'.
220
+					$this->msgEscaped('wikibase-snakview-snaktypeselector-novalue').
221 221
 						'</span>',
222 222
 					$role
223
-				) ) ];
223
+				))];
224 224
 			default:
225 225
 				// @codeCoverageIgnoreStart
226 226
 				throw new LogicException(
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 * @param string|null $role one of the Role::* constants
236 236
 	 * @return array[] list of parameters as accepted by Message::params()
237 237
 	 */
238
-	private function renderItemIdSnakValueList( array $valueList, ?string $role ): array {
239
-		return $this->renderList( $valueList, $role, [ $this, 'renderItemIdSnakValue' ] );
238
+	private function renderItemIdSnakValueList(array $valueList, ?string $role): array {
239
+		return $this->renderList($valueList, $role, [$this, 'renderItemIdSnakValue']);
240 240
 	}
241 241
 
242 242
 	/**
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 	 * @param string|null $role one of the Role::* constants
245 245
 	 * @return array[] list of parameters as accepted by Message::params()
246 246
 	 */
247
-	private function renderDataValue( DataValue $dataValue, ?string $role ): array {
248
-		return [ Message::rawParam( $this->addRole(
249
-			$this->dataValueFormatter->format( $dataValue ),
247
+	private function renderDataValue(DataValue $dataValue, ?string $role): array {
248
+		return [Message::rawParam($this->addRole(
249
+			$this->dataValueFormatter->format($dataValue),
250 250
 			$role
251
-		) ) ];
251
+		))];
252 252
 	}
253 253
 
254 254
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @param string|null $role one of the Role::* constants
257 257
 	 * @return array[] list of parameters as accepted by Message::params()
258 258
 	 */
259
-	private function renderDataValueType( string $dataValueType, ?string $role ): array {
259
+	private function renderDataValueType(string $dataValueType, ?string $role): array {
260 260
 		$messageKeys = [
261 261
 			'string' => 'datatypes-type-string',
262 262
 			'monolingualtext' => 'datatypes-type-monolingualtext',
@@ -265,15 +265,15 @@  discard block
 block discarded – undo
265 265
 			'wikibase-entityid' => 'wbqc-dataValueType-wikibase-entityid',
266 266
 		];
267 267
 
268
-		if ( array_key_exists( $dataValueType, $messageKeys ) ) {
269
-			return [ Message::rawParam( $this->addRole(
270
-				$this->msgEscaped( $messageKeys[$dataValueType] ),
268
+		if (array_key_exists($dataValueType, $messageKeys)) {
269
+			return [Message::rawParam($this->addRole(
270
+				$this->msgEscaped($messageKeys[$dataValueType]),
271 271
 				$role
272
-			) ) ];
272
+			))];
273 273
 		} else {
274 274
 			// @codeCoverageIgnoreStart
275 275
 			throw new LogicException(
276
-				'Unknown data value type ' . $dataValueType
276
+				'Unknown data value type '.$dataValueType
277 277
 			);
278 278
 			// @codeCoverageIgnoreEnd
279 279
 		}
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
 	 * @param string|null $role one of the Role::* constants
285 285
 	 * @return array[] list of parameters as accepted by Message::params()
286 286
 	 */
287
-	private function renderInlineCode( string $code, ?string $role ): array {
288
-		return [ Message::rawParam( $this->addRole(
289
-			'<code>' . htmlspecialchars( $code ) . '</code>',
287
+	private function renderInlineCode(string $code, ?string $role): array {
288
+		return [Message::rawParam($this->addRole(
289
+			'<code>'.htmlspecialchars($code).'</code>',
290 290
 			$role
291
-		) ) ];
291
+		))];
292 292
 	}
293 293
 
294 294
 	/**
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
 	 * @param string|null $role one of the Role::* constants
297 297
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
298 298
 	 */
299
-	private function renderConstraintScope( string $scope, ?string $role ): array {
300
-		switch ( $scope ) {
299
+	private function renderConstraintScope(string $scope, ?string $role): array {
300
+		switch ($scope) {
301 301
 			case Context::TYPE_STATEMENT:
302 302
 				$itemId = $this->config->get(
303 303
 					'WBQualityConstraintsConstraintCheckedOnMainValueId'
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 				// callers should never let this happen, but if it does happen,
318 318
 				// showing “unknown value” seems reasonable
319 319
 				// @codeCoverageIgnoreStart
320
-				return $this->renderItemIdSnakValue( ItemIdSnakValue::someValue(), $role );
320
+				return $this->renderItemIdSnakValue(ItemIdSnakValue::someValue(), $role);
321 321
 				// @codeCoverageIgnoreEnd
322 322
 		}
323
-		return $this->renderEntityId( new ItemId( $itemId ), $role );
323
+		return $this->renderEntityId(new ItemId($itemId), $role);
324 324
 	}
325 325
 
326 326
 	/**
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * @param string|null $role one of the Role::* constants
329 329
 	 * @return array[] list of parameters as accepted by Message::params()
330 330
 	 */
331
-	private function renderConstraintScopeList( array $scopeList, ?string $role ): array {
332
-		return $this->renderList( $scopeList, $role, [ $this, 'renderConstraintScope' ] );
331
+	private function renderConstraintScopeList(array $scopeList, ?string $role): array {
332
+		return $this->renderList($scopeList, $role, [$this, 'renderConstraintScope']);
333 333
 	}
334 334
 
335 335
 	/**
@@ -337,25 +337,25 @@  discard block
 block discarded – undo
337 337
 	 * @param string|null $role one of the Role::* constants
338 338
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
339 339
 	 */
340
-	private function renderPropertyScope( string $scope, ?string $role ): array {
341
-		switch ( $scope ) {
340
+	private function renderPropertyScope(string $scope, ?string $role): array {
341
+		switch ($scope) {
342 342
 			case Context::TYPE_STATEMENT:
343
-				$itemId = $this->config->get( 'WBQualityConstraintsAsMainValueId' );
343
+				$itemId = $this->config->get('WBQualityConstraintsAsMainValueId');
344 344
 				break;
345 345
 			case Context::TYPE_QUALIFIER:
346
-				$itemId = $this->config->get( 'WBQualityConstraintsAsQualifiersId' );
346
+				$itemId = $this->config->get('WBQualityConstraintsAsQualifiersId');
347 347
 				break;
348 348
 			case Context::TYPE_REFERENCE:
349
-				$itemId = $this->config->get( 'WBQualityConstraintsAsReferencesId' );
349
+				$itemId = $this->config->get('WBQualityConstraintsAsReferencesId');
350 350
 				break;
351 351
 			default:
352 352
 				// callers should never let this happen, but if it does happen,
353 353
 				// showing “unknown value” seems reasonable
354 354
 				// @codeCoverageIgnoreStart
355
-				return $this->renderItemIdSnakValue( ItemIdSnakValue::someValue(), $role );
355
+				return $this->renderItemIdSnakValue(ItemIdSnakValue::someValue(), $role);
356 356
 				// @codeCoverageIgnoreEnd
357 357
 		}
358
-		return $this->renderEntityId( new ItemId( $itemId ), $role );
358
+		return $this->renderEntityId(new ItemId($itemId), $role);
359 359
 	}
360 360
 
361 361
 	/**
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
 	 * @param string|null $role one of the Role::* constants
364 364
 	 * @return array[] list of parameters as accepted by Message::params()
365 365
 	 */
366
-	private function renderPropertyScopeList( array $scopeList, ?string $role ): array {
367
-		return $this->renderList( $scopeList, $role, [ $this, 'renderPropertyScope' ] );
366
+	private function renderPropertyScopeList(array $scopeList, ?string $role): array {
367
+		return $this->renderList($scopeList, $role, [$this, 'renderPropertyScope']);
368 368
 	}
369 369
 
370 370
 	/**
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 	 * @param string|null $role one of the Role::* constants
373 373
 	 * @return array[] list of parameters as accepted by Message::params()
374 374
 	 */
375
-	private function renderLanguage( string $languageCode, ?string $role ): array {
375
+	private function renderLanguage(string $languageCode, ?string $role): array {
376 376
 		return [
377 377
 			// ::renderList (through ::renderLanguageList) requires 'raw' parameter
378 378
 			// so we effectively build Message::plaintextParam here
379
-			Message::rawParam( htmlspecialchars(
380
-				$this->languageNameUtils->getLanguageName( $languageCode )
381
-			) ),
382
-			Message::plaintextParam( $languageCode ),
379
+			Message::rawParam(htmlspecialchars(
380
+				$this->languageNameUtils->getLanguageName($languageCode)
381
+			)),
382
+			Message::plaintextParam($languageCode),
383 383
 		];
384 384
 	}
385 385
 
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
 	 * @param string|null $role one of the Role::* constants
389 389
 	 * @return array[] list of parameters as accepted by Message::params()
390 390
 	 */
391
-	private function renderLanguageList( array $languageCodes, ?string $role ): array {
392
-		return $this->renderList( $languageCodes, $role, [ $this, 'renderLanguage' ] );
391
+	private function renderLanguageList(array $languageCodes, ?string $role): array {
392
+		return $this->renderList($languageCodes, $role, [$this, 'renderLanguage']);
393 393
 	}
394 394
 
395 395
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/Message/MultilingualTextViolationMessageRenderer.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 		'wbqc-violation-message-format-clarification' => 'wbqc-violation-message-format',
26 26
 	];
27 27
 
28
-	public function render( ViolationMessage $violationMessage ): string {
29
-		if ( !array_key_exists( $violationMessage->getMessageKey(), self::ALTERNATIVE_MESSAGE_KEYS ) ) {
30
-			return parent::render( $violationMessage );
28
+	public function render(ViolationMessage $violationMessage): string {
29
+		if (!array_key_exists($violationMessage->getMessageKey(), self::ALTERNATIVE_MESSAGE_KEYS)) {
30
+			return parent::render($violationMessage);
31 31
 		}
32 32
 
33 33
 		$arguments = $violationMessage->getArguments();
34
-		$multilingualTextArgument = array_pop( $arguments );
34
+		$multilingualTextArgument = array_pop($arguments);
35 35
 		$multilingualTextParams = $this->renderMultilingualText(
36 36
 			// @phan-suppress-next-line PhanTypeArraySuspiciousNullable TODO Ensure this is not an actual issue
37 37
 			$multilingualTextArgument['value'],
@@ -39,22 +39,22 @@  discard block
 block discarded – undo
39 39
 			$multilingualTextArgument['role']
40 40
 		);
41 41
 
42
-		$paramsLists = [ [] ];
43
-		foreach ( $arguments as $argument ) {
44
-			$paramsLists[] = $this->renderArgument( $argument );
42
+		$paramsLists = [[]];
43
+		foreach ($arguments as $argument) {
44
+			$paramsLists[] = $this->renderArgument($argument);
45 45
 		}
46
-		$regularParams = call_user_func_array( 'array_merge', $paramsLists );
46
+		$regularParams = call_user_func_array('array_merge', $paramsLists);
47 47
 
48
-		if ( $multilingualTextParams === null ) {
48
+		if ($multilingualTextParams === null) {
49 49
 			return $this->messageLocalizer
50
-				->msg( self::ALTERNATIVE_MESSAGE_KEYS[$violationMessage->getMessageKey()] )
51
-				->params( $regularParams )
50
+				->msg(self::ALTERNATIVE_MESSAGE_KEYS[$violationMessage->getMessageKey()])
51
+				->params($regularParams)
52 52
 				->escaped();
53 53
 		} else {
54 54
 			return $this->messageLocalizer
55
-				->msg( $violationMessage->getMessageKey() )
56
-				->params( $regularParams )
57
-				->params( $multilingualTextParams )
55
+				->msg($violationMessage->getMessageKey())
56
+				->params($regularParams)
57
+				->params($multilingualTextParams)
58 58
 				->escaped();
59 59
 		}
60 60
 	}
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
 	 * @return array[]|null list of parameters as accepted by Message::params(),
66 66
 	 * or null if the text is not available in the user’s language
67 67
 	 */
68
-	protected function renderMultilingualText( MultilingualTextValue $text, $role ) {
68
+	protected function renderMultilingualText(MultilingualTextValue $text, $role) {
69 69
 		global $wgLang;
70 70
 		$languageCodes = $wgLang->getFallbackLanguages();
71
-		array_unshift( $languageCodes, $wgLang->getCode() );
71
+		array_unshift($languageCodes, $wgLang->getCode());
72 72
 
73 73
 		$texts = $text->getTexts();
74
-		foreach ( $languageCodes as $languageCode ) {
75
-			if ( array_key_exists( $languageCode, $texts ) ) {
76
-				return [ Message::rawParam( $this->addRole(
77
-					htmlspecialchars( $texts[$languageCode]->getText() ),
74
+		foreach ($languageCodes as $languageCode) {
75
+			if (array_key_exists($languageCode, $texts)) {
76
+				return [Message::rawParam($this->addRole(
77
+					htmlspecialchars($texts[$languageCode]->getText()),
78 78
 					$role
79
-				) ) ];
79
+				))];
80 80
 			}
81 81
 		}
82 82
 
Please login to merge, or discard this patch.
src/Api/CheckResultsRendererFactory.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 		return new CheckResultsRenderer(
42 42
 			$this->entityTitleLookup,
43 43
 			$this->entityIdLabelFormatterFactory
44
-				->getEntityIdFormatter( $userLanguage ),
44
+				->getEntityIdFormatter($userLanguage),
45 45
 			$this->violationMessageRendererFactory
46
-				->getViolationMessageRenderer( $userLanguage, $messageLocalizer )
46
+				->getViolationMessageRenderer($userLanguage, $messageLocalizer)
47 47
 		);
48 48
 	}
49 49
 
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
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 		CheckResultsRendererFactory $checkResultsRendererFactory,
120 120
 		IBufferingStatsdDataFactory $dataFactory
121 121
 	) {
122
-		parent::__construct( $main, $name );
122
+		parent::__construct($main, $name);
123 123
 		$this->entityIdParser = $entityIdParser;
124 124
 		$this->statementGuidValidator = $statementGuidValidator;
125
-		$this->resultBuilder = $apiHelperFactory->getResultBuilder( $this );
126
-		$this->errorReporter = $apiHelperFactory->getErrorReporter( $this );
125
+		$this->resultBuilder = $apiHelperFactory->getResultBuilder($this);
126
+		$this->errorReporter = $apiHelperFactory->getErrorReporter($this);
127 127
 		$this->resultsSource = $resultsSource;
128 128
 		$this->checkResultsRendererFactory = $checkResultsRendererFactory;
129 129
 		$this->dataFactory = $dataFactory;
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 
140 140
 		$params = $this->extractRequestParams();
141 141
 
142
-		$this->validateParameters( $params );
143
-		$entityIds = $this->parseEntityIds( $params );
144
-		$claimIds = $this->parseClaimIds( $params );
142
+		$this->validateParameters($params);
143
+		$entityIds = $this->parseEntityIds($params);
144
+		$claimIds = $this->parseClaimIds($params);
145 145
 		$constraintIDs = $params[self::PARAM_CONSTRAINT_ID];
146 146
 		$statuses = $params[self::PARAM_STATUS];
147 147
 
148 148
 		$checkResultsRenderer = $this->checkResultsRendererFactory
149
-			->getCheckResultsRenderer( $this->getLanguage(), $this );
149
+			->getCheckResultsRenderer($this->getLanguage(), $this);
150 150
 
151 151
 		$this->getResult()->addValue(
152 152
 			null,
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 				)
161 161
 			)->getArray()
162 162
 		);
163
-		$this->resultBuilder->markSuccess( 1 );
163
+		$this->resultBuilder->markSuccess(1);
164 164
 	}
165 165
 
166 166
 	/**
@@ -168,24 +168,24 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return EntityId[]
170 170
 	 */
171
-	private function parseEntityIds( array $params ) {
171
+	private function parseEntityIds(array $params) {
172 172
 		$ids = $params[self::PARAM_ID];
173 173
 
174
-		if ( $ids === null ) {
174
+		if ($ids === null) {
175 175
 			return [];
176
-		} elseif ( $ids === [] ) {
176
+		} elseif ($ids === []) {
177 177
 			$this->errorReporter->dieError(
178
-				'If ' . self::PARAM_ID . ' is specified, it must be nonempty.', 'no-data' );
178
+				'If '.self::PARAM_ID.' is specified, it must be nonempty.', 'no-data' );
179 179
 		}
180 180
 
181
-		return array_map( function ( $id ) {
181
+		return array_map(function($id) {
182 182
 			try {
183
-				return $this->entityIdParser->parse( $id );
184
-			} catch ( EntityIdParsingException $e ) {
183
+				return $this->entityIdParser->parse($id);
184
+			} catch (EntityIdParsingException $e) {
185 185
 				$this->errorReporter->dieError(
186
-					"Invalid id: $id", 'invalid-entity-id', 0, [ self::PARAM_ID => $id ] );
186
+					"Invalid id: $id", 'invalid-entity-id', 0, [self::PARAM_ID => $id] );
187 187
 			}
188
-		}, $ids );
188
+		}, $ids);
189 189
 	}
190 190
 
191 191
 	/**
@@ -193,35 +193,35 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @return string[]
195 195
 	 */
196
-	private function parseClaimIds( array $params ) {
196
+	private function parseClaimIds(array $params) {
197 197
 		$ids = $params[self::PARAM_CLAIM_ID];
198 198
 
199
-		if ( $ids === null ) {
199
+		if ($ids === null) {
200 200
 			return [];
201
-		} elseif ( $ids === [] ) {
201
+		} elseif ($ids === []) {
202 202
 			$this->errorReporter->dieError(
203
-				'If ' . self::PARAM_CLAIM_ID . ' is specified, it must be nonempty.', 'no-data' );
203
+				'If '.self::PARAM_CLAIM_ID.' is specified, it must be nonempty.', 'no-data' );
204 204
 		}
205 205
 
206
-		foreach ( $ids as $id ) {
207
-			if ( !$this->statementGuidValidator->validate( $id ) ) {
206
+		foreach ($ids as $id) {
207
+			if (!$this->statementGuidValidator->validate($id)) {
208 208
 				$this->errorReporter->dieError(
209
-					"Invalid claim id: $id", 'invalid-guid', 0, [ self::PARAM_CLAIM_ID => $id ] );
209
+					"Invalid claim id: $id", 'invalid-guid', 0, [self::PARAM_CLAIM_ID => $id] );
210 210
 			}
211 211
 		}
212 212
 
213 213
 		return $ids;
214 214
 	}
215 215
 
216
-	private function validateParameters( array $params ) {
217
-		if ( $params[self::PARAM_CONSTRAINT_ID] !== null
218
-			 && empty( $params[self::PARAM_CONSTRAINT_ID] )
216
+	private function validateParameters(array $params) {
217
+		if ($params[self::PARAM_CONSTRAINT_ID] !== null
218
+			 && empty($params[self::PARAM_CONSTRAINT_ID])
219 219
 		) {
220 220
 			$paramConstraintId = self::PARAM_CONSTRAINT_ID;
221 221
 			$this->errorReporter->dieError(
222 222
 				"If $paramConstraintId is specified, it must be nonempty.", 'no-data' );
223 223
 		}
224
-		if ( $params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null ) {
224
+		if ($params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null) {
225 225
 			$paramId = self::PARAM_ID;
226 226
 			$paramClaimId = self::PARAM_CLAIM_ID;
227 227
 			$this->errorReporter->dieError(
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 				],
263 263
 				ParamValidator::PARAM_ISMULTI => true,
264 264
 				ParamValidator::PARAM_ALL => true,
265
-				ParamValidator::PARAM_DEFAULT => implode( '|', CachingResultsSource::CACHED_STATUSES ),
265
+				ParamValidator::PARAM_DEFAULT => implode('|', CachingResultsSource::CACHED_STATUSES),
266 266
 				ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
267 267
 			],
268 268
 		];
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
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 		StatementGuidParser $statementGuidParser,
106 106
 		IBufferingStatsdDataFactory $dataFactory
107 107
 	) {
108
-		parent::__construct( $main, $name );
108
+		parent::__construct($main, $name);
109 109
 
110
-		$this->apiErrorReporter = $apiHelperFactory->getErrorReporter( $this );
110
+		$this->apiErrorReporter = $apiHelperFactory->getErrorReporter($this);
111 111
 		$this->delegatingConstraintChecker = $delegatingConstraintChecker;
112 112
 		$this->violationMessageRendererFactory = $violationMessageRendererFactory;
113 113
 		$this->statementGuidParser = $statementGuidParser;
@@ -122,39 +122,39 @@  discard block
 block discarded – undo
122 122
 		$params = $this->extractRequestParams();
123 123
 		$result = $this->getResult();
124 124
 
125
-		$propertyIds = $this->parsePropertyIds( $params[self::PARAM_PROPERTY_ID] );
126
-		$constraintIds = $this->parseConstraintIds( $params[self::PARAM_CONSTRAINT_ID] );
125
+		$propertyIds = $this->parsePropertyIds($params[self::PARAM_PROPERTY_ID]);
126
+		$constraintIds = $this->parseConstraintIds($params[self::PARAM_CONSTRAINT_ID]);
127 127
 
128
-		$this->checkPropertyIds( $propertyIds, $result );
129
-		$this->checkConstraintIds( $constraintIds, $result );
128
+		$this->checkPropertyIds($propertyIds, $result);
129
+		$this->checkConstraintIds($constraintIds, $result);
130 130
 
131
-		$result->addValue( null, 'success', 1 );
131
+		$result->addValue(null, 'success', 1);
132 132
 	}
133 133
 
134 134
 	/**
135 135
 	 * @param array|null $propertyIdSerializations
136 136
 	 * @return NumericPropertyId[]
137 137
 	 */
138
-	private function parsePropertyIds( $propertyIdSerializations ) {
139
-		if ( $propertyIdSerializations === null ) {
138
+	private function parsePropertyIds($propertyIdSerializations) {
139
+		if ($propertyIdSerializations === null) {
140 140
 			return [];
141
-		} elseif ( empty( $propertyIdSerializations ) ) {
141
+		} elseif (empty($propertyIdSerializations)) {
142 142
 			$this->apiErrorReporter->dieError(
143
-				'If ' . self::PARAM_PROPERTY_ID . ' is specified, it must be nonempty.',
143
+				'If '.self::PARAM_PROPERTY_ID.' is specified, it must be nonempty.',
144 144
 				'no-data'
145 145
 			);
146 146
 		}
147 147
 
148 148
 		return array_map(
149
-			function ( $propertyIdSerialization ) {
149
+			function($propertyIdSerialization) {
150 150
 				try {
151
-					return new NumericPropertyId( $propertyIdSerialization );
152
-				} catch ( InvalidArgumentException $e ) {
151
+					return new NumericPropertyId($propertyIdSerialization);
152
+				} catch (InvalidArgumentException $e) {
153 153
 					$this->apiErrorReporter->dieError(
154 154
 						"Invalid id: $propertyIdSerialization",
155 155
 						'invalid-property-id',
156 156
 						0, // default argument
157
-						[ self::PARAM_PROPERTY_ID => $propertyIdSerialization ]
157
+						[self::PARAM_PROPERTY_ID => $propertyIdSerialization]
158 158
 					);
159 159
 				}
160 160
 			},
@@ -166,35 +166,35 @@  discard block
 block discarded – undo
166 166
 	 * @param array|null $constraintIds
167 167
 	 * @return string[]
168 168
 	 */
169
-	private function parseConstraintIds( $constraintIds ) {
170
-		if ( $constraintIds === null ) {
169
+	private function parseConstraintIds($constraintIds) {
170
+		if ($constraintIds === null) {
171 171
 			return [];
172
-		} elseif ( empty( $constraintIds ) ) {
172
+		} elseif (empty($constraintIds)) {
173 173
 			$this->apiErrorReporter->dieError(
174
-				'If ' . self::PARAM_CONSTRAINT_ID . ' is specified, it must be nonempty.',
174
+				'If '.self::PARAM_CONSTRAINT_ID.' is specified, it must be nonempty.',
175 175
 				'no-data'
176 176
 			);
177 177
 		}
178 178
 
179 179
 		return array_map(
180
-			function ( $constraintId ) {
180
+			function($constraintId) {
181 181
 				try {
182
-					$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
183
-					if ( !$propertyId instanceof NumericPropertyId ) {
182
+					$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
183
+					if (!$propertyId instanceof NumericPropertyId) {
184 184
 						$this->apiErrorReporter->dieError(
185 185
 							"Invalid property ID: {$propertyId->getSerialization()}",
186 186
 							'invalid-property-id',
187 187
 							0, // default argument
188
-							[ self::PARAM_CONSTRAINT_ID => $constraintId ]
188
+							[self::PARAM_CONSTRAINT_ID => $constraintId]
189 189
 						);
190 190
 					}
191 191
 					return $constraintId;
192
-				} catch ( StatementGuidParsingException $e ) {
192
+				} catch (StatementGuidParsingException $e) {
193 193
 					$this->apiErrorReporter->dieError(
194 194
 						"Invalid statement GUID: $constraintId",
195 195
 						'invalid-guid',
196 196
 						0, // default argument
197
-						[ self::PARAM_CONSTRAINT_ID => $constraintId ]
197
+						[self::PARAM_CONSTRAINT_ID => $constraintId]
198 198
 					);
199 199
 				}
200 200
 			},
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 	 * @param NumericPropertyId[] $propertyIds
207 207
 	 * @param ApiResult $result
208 208
 	 */
209
-	private function checkPropertyIds( array $propertyIds, ApiResult $result ) {
210
-		foreach ( $propertyIds as $propertyId ) {
211
-			$result->addArrayType( $this->getResultPathForPropertyId( $propertyId ), 'assoc' );
209
+	private function checkPropertyIds(array $propertyIds, ApiResult $result) {
210
+		foreach ($propertyIds as $propertyId) {
211
+			$result->addArrayType($this->getResultPathForPropertyId($propertyId), 'assoc');
212 212
 			$allConstraintExceptions = $this->delegatingConstraintChecker
213
-				->checkConstraintParametersOnPropertyId( $propertyId );
214
-			foreach ( $allConstraintExceptions as $constraintId => $constraintParameterExceptions ) {
213
+				->checkConstraintParametersOnPropertyId($propertyId);
214
+			foreach ($allConstraintExceptions as $constraintId => $constraintParameterExceptions) {
215 215
 				$this->addConstraintParameterExceptionsToResult(
216 216
 					$constraintId,
217 217
 					$constraintParameterExceptions,
@@ -225,15 +225,15 @@  discard block
 block discarded – undo
225 225
 	 * @param string[] $constraintIds
226 226
 	 * @param ApiResult $result
227 227
 	 */
228
-	private function checkConstraintIds( array $constraintIds, ApiResult $result ) {
229
-		foreach ( $constraintIds as $constraintId ) {
230
-			if ( $result->getResultData( $this->getResultPathForConstraintId( $constraintId ) ) ) {
228
+	private function checkConstraintIds(array $constraintIds, ApiResult $result) {
229
+		foreach ($constraintIds as $constraintId) {
230
+			if ($result->getResultData($this->getResultPathForConstraintId($constraintId))) {
231 231
 				// already checked as part of checkPropertyIds()
232 232
 				continue;
233 233
 			}
234 234
 			$constraintParameterExceptions = $this->delegatingConstraintChecker
235
-				->checkConstraintParametersOnConstraintId( $constraintId );
236
-			$this->addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, $result );
235
+				->checkConstraintParametersOnConstraintId($constraintId);
236
+			$this->addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, $result);
237 237
 		}
238 238
 	}
239 239
 
@@ -241,18 +241,18 @@  discard block
 block discarded – undo
241 241
 	 * @param NumericPropertyId $propertyId
242 242
 	 * @return string[]
243 243
 	 */
244
-	private function getResultPathForPropertyId( NumericPropertyId $propertyId ) {
245
-		return [ $this->getModuleName(), $propertyId->getSerialization() ];
244
+	private function getResultPathForPropertyId(NumericPropertyId $propertyId) {
245
+		return [$this->getModuleName(), $propertyId->getSerialization()];
246 246
 	}
247 247
 
248 248
 	/**
249 249
 	 * @param string $constraintId
250 250
 	 * @return string[]
251 251
 	 */
252
-	private function getResultPathForConstraintId( $constraintId ) {
253
-		$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
252
+	private function getResultPathForConstraintId($constraintId) {
253
+		$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
254 254
 		'@phan-var NumericPropertyId $propertyId';
255
-		return array_merge( $this->getResultPathForPropertyId( $propertyId ), [ $constraintId ] );
255
+		return array_merge($this->getResultPathForPropertyId($propertyId), [$constraintId]);
256 256
 	}
257 257
 
258 258
 	/**
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 		$constraintParameterExceptions,
268 268
 		ApiResult $result
269 269
 	) {
270
-		$path = $this->getResultPathForConstraintId( $constraintId );
271
-		if ( $constraintParameterExceptions === null ) {
270
+		$path = $this->getResultPathForConstraintId($constraintId);
271
+		if ($constraintParameterExceptions === null) {
272 272
 			$result->addValue(
273 273
 				$path,
274 274
 				self::KEY_STATUS,
@@ -278,13 +278,13 @@  discard block
 block discarded – undo
278 278
 			$result->addValue(
279 279
 				$path,
280 280
 				self::KEY_STATUS,
281
-				empty( $constraintParameterExceptions ) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY
281
+				empty($constraintParameterExceptions) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY
282 282
 			);
283 283
 
284 284
 			$violationMessageRenderer = $this->violationMessageRendererFactory
285
-				->getViolationMessageRenderer( $this->getLanguage(), $this );
285
+				->getViolationMessageRenderer($this->getLanguage(), $this);
286 286
 			$problems = [];
287
-			foreach ( $constraintParameterExceptions as $constraintParameterException ) {
287
+			foreach ($constraintParameterExceptions as $constraintParameterException) {
288 288
 				$problems[] = [
289 289
 					self::KEY_MESSAGE_HTML => $violationMessageRenderer->render(
290 290
 						$constraintParameterException->getViolationMessage() ),
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
 		return [
324 324
 			'action=wbcheckconstraintparameters&propertyid=P247'
325 325
 				=> 'apihelp-wbcheckconstraintparameters-example-propertyid-1',
326
-			'action=wbcheckconstraintparameters&' .
327
-			'constraintid=P247$0fe1711e-4c0f-82ce-3af0-830b721d0fba|' .
326
+			'action=wbcheckconstraintparameters&'.
327
+			'constraintid=P247$0fe1711e-4c0f-82ce-3af0-830b721d0fba|'.
328 328
 			'P225$cdc71e4a-47a0-12c5-dfb3-3f6fc0b6613f'
329 329
 				=> 'apihelp-wbcheckconstraintparameters-example-constraintid-2',
330 330
 		];
Please login to merge, or discard this patch.
src/ConstraintCheck/Message/ViolationMessageRendererFactory.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\ConstraintCheck\Message;
6 6
 
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	): ViolationMessageRenderer {
42 42
 		$userLanguageCode = $userLanguage->getCode();
43 43
 		$formatterOptions = new FormatterOptions();
44
-		$formatterOptions->setOption( SnakFormatter::OPT_LANG, $userLanguageCode );
44
+		$formatterOptions->setOption(SnakFormatter::OPT_LANG, $userLanguageCode);
45 45
 		return new MultilingualTextViolationMessageRenderer(
46 46
 			$this->entityIdHtmlLinkFormatterFactory
47
-				->getEntityIdFormatter( $userLanguage ),
47
+				->getEntityIdFormatter($userLanguage),
48 48
 			$this->valueFormatterFactory
49
-				->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions ),
49
+				->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions),
50 50
 			$this->languageNameUtils,
51 51
 			$messageLocalizer,
52 52
 			$this->config
Please login to merge, or discard this patch.
src/ConstraintsServices.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -40,93 +40,93 @@
 block discarded – undo
40 40
 	public const EXPIRY_LOCK = 'WBQC_ExpiryLock';
41 41
 	public const VIOLATION_MESSAGE_RENDERER_FACTORY = 'WBQC_ViolationMessageRendererFactory';
42 42
 
43
-	private static function getService( ?MediaWikiServices $services, $name ) {
44
-		if ( $services === null ) {
43
+	private static function getService(?MediaWikiServices $services, $name) {
44
+		if ($services === null) {
45 45
 			$services = MediaWikiServices::getInstance();
46 46
 		}
47
-		return $services->getService( $name );
47
+		return $services->getService($name);
48 48
 	}
49 49
 
50
-	public static function getLoggingHelper( MediaWikiServices $services = null ): LoggingHelper {
51
-		return self::getService( $services, self::LOGGING_HELPER );
50
+	public static function getLoggingHelper(MediaWikiServices $services = null): LoggingHelper {
51
+		return self::getService($services, self::LOGGING_HELPER);
52 52
 	}
53 53
 
54 54
 	public static function getConstraintStore(
55 55
 		MediaWikiServices $services = null
56 56
 	): ConstraintStore {
57
-		return self::getService( $services, self::CONSTRAINT_STORE );
57
+		return self::getService($services, self::CONSTRAINT_STORE);
58 58
 	}
59 59
 
60
-	public static function getConstraintLookup( MediaWikiServices $services = null ): ConstraintLookup {
61
-		return self::getService( $services, self::CONSTRAINT_LOOKUP );
60
+	public static function getConstraintLookup(MediaWikiServices $services = null): ConstraintLookup {
61
+		return self::getService($services, self::CONSTRAINT_LOOKUP);
62 62
 	}
63 63
 
64 64
 	public static function getCheckResultSerializer(
65 65
 		MediaWikiServices $services = null
66 66
 	): CheckResultSerializer {
67
-		return self::getService( $services, self::CHECK_RESULT_SERIALIZER );
67
+		return self::getService($services, self::CHECK_RESULT_SERIALIZER);
68 68
 	}
69 69
 
70 70
 	public static function getCheckResultDeserializer(
71 71
 		MediaWikiServices $services = null
72 72
 	): CheckResultDeserializer {
73
-		return self::getService( $services, self::CHECK_RESULT_DESERIALIZER );
73
+		return self::getService($services, self::CHECK_RESULT_DESERIALIZER);
74 74
 	}
75 75
 
76 76
 	public static function getViolationMessageSerializer(
77 77
 		MediaWikiServices $services = null
78 78
 	): ViolationMessageSerializer {
79
-		return self::getService( $services, self::VIOLATION_MESSAGE_SERIALIZER );
79
+		return self::getService($services, self::VIOLATION_MESSAGE_SERIALIZER);
80 80
 	}
81 81
 
82 82
 	public static function getViolationMessageDeserializer(
83 83
 		MediaWikiServices $services = null
84 84
 	): ViolationMessageDeserializer {
85
-		return self::getService( $services, self::VIOLATION_MESSAGE_DESERIALIZER );
85
+		return self::getService($services, self::VIOLATION_MESSAGE_DESERIALIZER);
86 86
 	}
87 87
 
88 88
 	public static function getConstraintParameterParser(
89 89
 		MediaWikiServices $services = null
90 90
 	): ConstraintParameterParser {
91
-		return self::getService( $services, self::CONSTRAINT_PARAMETER_PARSER );
91
+		return self::getService($services, self::CONSTRAINT_PARAMETER_PARSER);
92 92
 	}
93 93
 
94 94
 	public static function getConnectionCheckerHelper(
95 95
 		MediaWikiServices $services = null
96 96
 	): ConnectionCheckerHelper {
97
-		return self::getService( $services, self::CONNECTION_CHECKER_HELPER );
97
+		return self::getService($services, self::CONNECTION_CHECKER_HELPER);
98 98
 	}
99 99
 
100
-	public static function getRangeCheckerHelper( MediaWikiServices $services = null ): RangeCheckerHelper {
101
-		return self::getService( $services, self::RANGE_CHECKER_HELPER );
100
+	public static function getRangeCheckerHelper(MediaWikiServices $services = null): RangeCheckerHelper {
101
+		return self::getService($services, self::RANGE_CHECKER_HELPER);
102 102
 	}
103 103
 
104
-	public static function getSparqlHelper( MediaWikiServices $services = null ): SparqlHelper {
105
-		return self::getService( $services, self::SPARQL_HELPER );
104
+	public static function getSparqlHelper(MediaWikiServices $services = null): SparqlHelper {
105
+		return self::getService($services, self::SPARQL_HELPER);
106 106
 	}
107 107
 
108
-	public static function getTypeCheckerHelper( MediaWikiServices $services = null ): TypeCheckerHelper {
109
-		return self::getService( $services, self::TYPE_CHECKER_HELPER );
108
+	public static function getTypeCheckerHelper(MediaWikiServices $services = null): TypeCheckerHelper {
109
+		return self::getService($services, self::TYPE_CHECKER_HELPER);
110 110
 	}
111 111
 
112 112
 	public static function getDelegatingConstraintChecker(
113 113
 		MediaWikiServices $services = null
114 114
 	): DelegatingConstraintChecker {
115
-		return self::getService( $services, self::DELEGATING_CONSTRAINT_CHECKER );
115
+		return self::getService($services, self::DELEGATING_CONSTRAINT_CHECKER);
116 116
 	}
117 117
 
118
-	public static function getResultsSource( MediaWikiServices $services = null ): ResultsSource {
119
-		return self::getService( $services, self::RESULTS_SOURCE );
118
+	public static function getResultsSource(MediaWikiServices $services = null): ResultsSource {
119
+		return self::getService($services, self::RESULTS_SOURCE);
120 120
 	}
121 121
 
122
-	public static function getExpiryLock( MediaWikiServices $services = null ): ExpiryLock {
123
-		return self::getService( $services, self::EXPIRY_LOCK );
122
+	public static function getExpiryLock(MediaWikiServices $services = null): ExpiryLock {
123
+		return self::getService($services, self::EXPIRY_LOCK);
124 124
 	}
125 125
 
126 126
 	public static function getViolationMessageRendererFactory(
127 127
 		MediaWikiServices $services = null
128 128
 	): ViolationMessageRendererFactory {
129
-		return self::getService( $services, self::VIOLATION_MESSAGE_RENDERER_FACTORY );
129
+		return self::getService($services, self::VIOLATION_MESSAGE_RENDERER_FACTORY);
130 130
 	}
131 131
 
132 132
 }
Please login to merge, or discard this patch.
src/ServiceWiring.php 1 patch
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -30,53 +30,53 @@  discard block
 block discarded – undo
30 30
 use WikiMap;
31 31
 
32 32
 return [
33
-	ConstraintsServices::EXPIRY_LOCK => static function ( MediaWikiServices $services ) {
34
-		return new ExpiryLock( ObjectCache::getInstance( CACHE_ANYTHING ) );
33
+	ConstraintsServices::EXPIRY_LOCK => static function(MediaWikiServices $services) {
34
+		return new ExpiryLock(ObjectCache::getInstance(CACHE_ANYTHING));
35 35
 	},
36 36
 
37
-	ConstraintsServices::LOGGING_HELPER => static function ( MediaWikiServices $services ) {
37
+	ConstraintsServices::LOGGING_HELPER => static function(MediaWikiServices $services) {
38 38
 		return new LoggingHelper(
39 39
 			$services->getStatsdDataFactory(),
40
-			LoggerFactory::getInstance( 'WikibaseQualityConstraints' ),
40
+			LoggerFactory::getInstance('WikibaseQualityConstraints'),
41 41
 			$services->getMainConfig()
42 42
 		);
43 43
 	},
44 44
 
45
-	ConstraintsServices::CONSTRAINT_STORE => static function ( MediaWikiServices $services ) {
46
-		$sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions( $services );
47
-		$propertySource = $sourceDefinitions->getDatabaseSourceForEntityType( Property::ENTITY_TYPE );
48
-		if ( $propertySource === null ) {
49
-			throw new RuntimeException( 'Can\'t get a ConstraintStore for properties not stored in a database.' );
45
+	ConstraintsServices::CONSTRAINT_STORE => static function(MediaWikiServices $services) {
46
+		$sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions($services);
47
+		$propertySource = $sourceDefinitions->getDatabaseSourceForEntityType(Property::ENTITY_TYPE);
48
+		if ($propertySource === null) {
49
+			throw new RuntimeException('Can\'t get a ConstraintStore for properties not stored in a database.');
50 50
 		}
51 51
 
52
-		$localEntitySourceName = WikibaseRepo::getLocalEntitySource( $services )->getSourceName();
53
-		if ( $propertySource->getSourceName() !== $localEntitySourceName ) {
54
-			throw new RuntimeException( 'Can\'t get a ConstraintStore for a non local entity source.' );
52
+		$localEntitySourceName = WikibaseRepo::getLocalEntitySource($services)->getSourceName();
53
+		if ($propertySource->getSourceName() !== $localEntitySourceName) {
54
+			throw new RuntimeException('Can\'t get a ConstraintStore for a non local entity source.');
55 55
 		}
56 56
 
57 57
 		$dbName = $propertySource->getDatabaseName();
58 58
 		return new ConstraintRepositoryStore(
59
-			$services->getDBLoadBalancerFactory()->getMainLB( $dbName ),
59
+			$services->getDBLoadBalancerFactory()->getMainLB($dbName),
60 60
 			$dbName
61 61
 		);
62 62
 	},
63 63
 
64
-	ConstraintsServices::CONSTRAINT_LOOKUP => static function ( MediaWikiServices $services ) {
65
-		$sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions( $services );
66
-		$propertySource = $sourceDefinitions->getDatabaseSourceForEntityType( Property::ENTITY_TYPE );
67
-		if ( $propertySource === null ) {
68
-			throw new RuntimeException( 'Can\'t get a ConstraintStore for properties not stored in a database.' );
64
+	ConstraintsServices::CONSTRAINT_LOOKUP => static function(MediaWikiServices $services) {
65
+		$sourceDefinitions = WikibaseRepo::getEntitySourceDefinitions($services);
66
+		$propertySource = $sourceDefinitions->getDatabaseSourceForEntityType(Property::ENTITY_TYPE);
67
+		if ($propertySource === null) {
68
+			throw new RuntimeException('Can\'t get a ConstraintStore for properties not stored in a database.');
69 69
 		}
70 70
 
71 71
 		$dbName = $propertySource->getDatabaseName();
72 72
 		$rawLookup = new ConstraintRepositoryLookup(
73
-			$services->getDBLoadBalancerFactory()->getMainLB( $dbName ),
73
+			$services->getDBLoadBalancerFactory()->getMainLB($dbName),
74 74
 			$dbName
75 75
 		);
76
-		return new CachingConstraintLookup( $rawLookup );
76
+		return new CachingConstraintLookup($rawLookup);
77 77
 	},
78 78
 
79
-	ConstraintsServices::CHECK_RESULT_SERIALIZER => static function ( MediaWikiServices $services ) {
79
+	ConstraintsServices::CHECK_RESULT_SERIALIZER => static function(MediaWikiServices $services) {
80 80
 		return new CheckResultSerializer(
81 81
 			new ConstraintSerializer(
82 82
 				false // constraint parameters are not exposed
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 		);
88 88
 	},
89 89
 
90
-	ConstraintsServices::CHECK_RESULT_DESERIALIZER => static function ( MediaWikiServices $services ) {
91
-		$entityIdParser = WikibaseRepo::getEntityIdParser( $services );
92
-		$dataValueFactory = WikibaseRepo::getDataValueFactory( $services );
90
+	ConstraintsServices::CHECK_RESULT_DESERIALIZER => static function(MediaWikiServices $services) {
91
+		$entityIdParser = WikibaseRepo::getEntityIdParser($services);
92
+		$dataValueFactory = WikibaseRepo::getDataValueFactory($services);
93 93
 
94 94
 		return new CheckResultDeserializer(
95 95
 			new ConstraintDeserializer(),
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 		);
103 103
 	},
104 104
 
105
-	ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => static function ( MediaWikiServices $services ) {
105
+	ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => static function(MediaWikiServices $services) {
106 106
 		return new ViolationMessageSerializer();
107 107
 	},
108 108
 
109
-	ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => static function ( MediaWikiServices $services ) {
110
-		$entityIdParser = WikibaseRepo::getEntityIdParser( $services );
111
-		$dataValueFactory = WikibaseRepo::getDataValueFactory( $services );
109
+	ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => static function(MediaWikiServices $services) {
110
+		$entityIdParser = WikibaseRepo::getEntityIdParser($services);
111
+		$dataValueFactory = WikibaseRepo::getDataValueFactory($services);
112 112
 
113 113
 		return new ViolationMessageDeserializer(
114 114
 			$entityIdParser,
@@ -116,37 +116,37 @@  discard block
 block discarded – undo
116 116
 		);
117 117
 	},
118 118
 
119
-	ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => static function ( MediaWikiServices $services ) {
120
-		$deserializerFactory = WikibaseRepo::getBaseDataModelDeserializerFactory( $services );
121
-		$entitySourceDefinitions = WikibaseRepo::getEntitySourceDefinitions( $services );
119
+	ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => static function(MediaWikiServices $services) {
120
+		$deserializerFactory = WikibaseRepo::getBaseDataModelDeserializerFactory($services);
121
+		$entitySourceDefinitions = WikibaseRepo::getEntitySourceDefinitions($services);
122 122
 
123 123
 		return new ConstraintParameterParser(
124 124
 			$services->getMainConfig(),
125 125
 			$deserializerFactory,
126
-			$entitySourceDefinitions->getDatabaseSourceForEntityType( 'item' )->getConceptBaseUri()
126
+			$entitySourceDefinitions->getDatabaseSourceForEntityType('item')->getConceptBaseUri()
127 127
 		);
128 128
 	},
129 129
 
130
-	ConstraintsServices::CONNECTION_CHECKER_HELPER => static function ( MediaWikiServices $services ) {
130
+	ConstraintsServices::CONNECTION_CHECKER_HELPER => static function(MediaWikiServices $services) {
131 131
 		return new ConnectionCheckerHelper();
132 132
 	},
133 133
 
134
-	ConstraintsServices::RANGE_CHECKER_HELPER => static function ( MediaWikiServices $services ) {
134
+	ConstraintsServices::RANGE_CHECKER_HELPER => static function(MediaWikiServices $services) {
135 135
 		return new RangeCheckerHelper(
136 136
 			$services->getMainConfig(),
137
-			WikibaseRepo::getUnitConverter( $services )
137
+			WikibaseRepo::getUnitConverter($services)
138 138
 		);
139 139
 	},
140 140
 
141
-	ConstraintsServices::SPARQL_HELPER => static function ( MediaWikiServices $services ) {
142
-		$endpoint = $services->getMainConfig()->get( 'WBQualityConstraintsSparqlEndpoint' );
143
-		if ( $endpoint === '' ) {
141
+	ConstraintsServices::SPARQL_HELPER => static function(MediaWikiServices $services) {
142
+		$endpoint = $services->getMainConfig()->get('WBQualityConstraintsSparqlEndpoint');
143
+		if ($endpoint === '') {
144 144
 			return new DummySparqlHelper();
145 145
 		}
146 146
 
147
-		$rdfVocabulary = WikibaseRepo::getRdfVocabulary( $services );
148
-		$entityIdParser = WikibaseRepo::getEntityIdParser( $services );
149
-		$propertyDataTypeLookup = WikibaseRepo::getPropertyDataTypeLookup( $services );
147
+		$rdfVocabulary = WikibaseRepo::getRdfVocabulary($services);
148
+		$entityIdParser = WikibaseRepo::getEntityIdParser($services);
149
+		$propertyDataTypeLookup = WikibaseRepo::getPropertyDataTypeLookup($services);
150 150
 
151 151
 		return new SparqlHelper(
152 152
 			$services->getMainConfig(),
@@ -154,126 +154,126 @@  discard block
 block discarded – undo
154 154
 			$entityIdParser,
155 155
 			$propertyDataTypeLookup,
156 156
 			$services->getMainWANObjectCache(),
157
-			ConstraintsServices::getViolationMessageSerializer( $services ),
158
-			ConstraintsServices::getViolationMessageDeserializer( $services ),
157
+			ConstraintsServices::getViolationMessageSerializer($services),
158
+			ConstraintsServices::getViolationMessageDeserializer($services),
159 159
 			$services->getStatsdDataFactory(),
160
-			ConstraintsServices::getExpiryLock( $services ),
161
-			ConstraintsServices::getLoggingHelper( $services ),
162
-			WikiMap::getCurrentWikiId() . ' WikibaseQualityConstraints ' . $services->getHttpRequestFactory()->getUserAgent(),
160
+			ConstraintsServices::getExpiryLock($services),
161
+			ConstraintsServices::getLoggingHelper($services),
162
+			WikiMap::getCurrentWikiId().' WikibaseQualityConstraints '.$services->getHttpRequestFactory()->getUserAgent(),
163 163
 			$services->getHttpRequestFactory()
164 164
 		);
165 165
 	},
166 166
 
167
-	ConstraintsServices::TYPE_CHECKER_HELPER => static function ( MediaWikiServices $services ) {
167
+	ConstraintsServices::TYPE_CHECKER_HELPER => static function(MediaWikiServices $services) {
168 168
 		return new TypeCheckerHelper(
169
-			WikibaseServices::getEntityLookup( $services ),
169
+			WikibaseServices::getEntityLookup($services),
170 170
 			$services->getMainConfig(),
171
-			ConstraintsServices::getSparqlHelper( $services ),
171
+			ConstraintsServices::getSparqlHelper($services),
172 172
 			$services->getStatsdDataFactory()
173 173
 		);
174 174
 	},
175 175
 
176
-	ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => static function ( MediaWikiServices $services ) {
177
-		$statementGuidParser = WikibaseRepo::getStatementGuidParser( $services );
176
+	ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => static function(MediaWikiServices $services) {
177
+		$statementGuidParser = WikibaseRepo::getStatementGuidParser($services);
178 178
 
179 179
 		$config = $services->getMainConfig();
180 180
 		$checkerMap = [
181
-			$config->get( 'WBQualityConstraintsConflictsWithConstraintId' )
182
-				=> ConstraintCheckerServices::getConflictsWithChecker( $services ),
183
-			$config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' )
184
-				=> ConstraintCheckerServices::getItemChecker( $services ),
185
-			$config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' )
186
-				=> ConstraintCheckerServices::getTargetRequiredClaimChecker( $services ),
187
-			$config->get( 'WBQualityConstraintsSymmetricConstraintId' )
188
-				=> ConstraintCheckerServices::getSymmetricChecker( $services ),
189
-			$config->get( 'WBQualityConstraintsInverseConstraintId' )
190
-				=> ConstraintCheckerServices::getInverseChecker( $services ),
191
-			$config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' )
192
-				=> ConstraintCheckerServices::getQualifierChecker( $services ),
193
-			$config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' )
194
-				=> ConstraintCheckerServices::getQualifiersChecker( $services ),
195
-			$config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' )
196
-				=> ConstraintCheckerServices::getMandatoryQualifiersChecker( $services ),
197
-			$config->get( 'WBQualityConstraintsRangeConstraintId' )
198
-				=> ConstraintCheckerServices::getRangeChecker( $services ),
199
-			$config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' )
200
-				=> ConstraintCheckerServices::getDiffWithinRangeChecker( $services ),
201
-			$config->get( 'WBQualityConstraintsTypeConstraintId' )
202
-				=> ConstraintCheckerServices::getTypeChecker( $services ),
203
-			$config->get( 'WBQualityConstraintsValueTypeConstraintId' )
204
-				=> ConstraintCheckerServices::getValueTypeChecker( $services ),
205
-			$config->get( 'WBQualityConstraintsSingleValueConstraintId' )
206
-				=> ConstraintCheckerServices::getSingleValueChecker( $services ),
207
-			$config->get( 'WBQualityConstraintsMultiValueConstraintId' )
208
-				=> ConstraintCheckerServices::getMultiValueChecker( $services ),
209
-			$config->get( 'WBQualityConstraintsDistinctValuesConstraintId' )
210
-				=> ConstraintCheckerServices::getUniqueValueChecker( $services ),
211
-			$config->get( 'WBQualityConstraintsFormatConstraintId' )
212
-				=> ConstraintCheckerServices::getFormatChecker( $services ),
213
-			$config->get( 'WBQualityConstraintsCommonsLinkConstraintId' )
214
-				=> ConstraintCheckerServices::getCommonsLinkChecker( $services ),
215
-			$config->get( 'WBQualityConstraintsOneOfConstraintId' )
216
-				=> ConstraintCheckerServices::getOneOfChecker( $services ),
217
-			$config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' )
218
-				=> ConstraintCheckerServices::getValueOnlyChecker( $services ),
219
-			$config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' )
220
-				=> ConstraintCheckerServices::getReferenceChecker( $services ),
221
-			$config->get( 'WBQualityConstraintsNoBoundsConstraintId' )
222
-				=> ConstraintCheckerServices::getNoBoundsChecker( $services ),
223
-			$config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' )
224
-				=> ConstraintCheckerServices::getAllowedUnitsChecker( $services ),
225
-			$config->get( 'WBQualityConstraintsSingleBestValueConstraintId' )
226
-				=> ConstraintCheckerServices::getSingleBestValueChecker( $services ),
227
-			$config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' )
228
-				=> ConstraintCheckerServices::getEntityTypeChecker( $services ),
229
-			$config->get( 'WBQualityConstraintsNoneOfConstraintId' )
230
-				=> ConstraintCheckerServices::getNoneOfChecker( $services ),
231
-			$config->get( 'WBQualityConstraintsIntegerConstraintId' )
232
-				=> ConstraintCheckerServices::getIntegerChecker( $services ),
233
-			$config->get( 'WBQualityConstraintsCitationNeededConstraintId' )
234
-				=> ConstraintCheckerServices::getCitationNeededChecker( $services ),
235
-			$config->get( 'WBQualityConstraintsPropertyScopeConstraintId' )
236
-				=> ConstraintCheckerServices::getPropertyScopeChecker( $services ),
237
-			$config->get( 'WBQualityConstraintsContemporaryConstraintId' )
238
-				=> ConstraintCheckerServices::getContemporaryChecker( $services ),
239
-			$config->get( 'WBQualityConstraintsLexemeLanguageConstraintId' )
240
-				=> ConstraintCheckerServices::getLexemeLanguageChecker( $services ),
241
-			$config->get( 'WBQualityConstraintsLabelInLanguageConstraintId' )
242
-				=> ConstraintCheckerServices::getLabelInLanguageChecker( $services ),
181
+			$config->get('WBQualityConstraintsConflictsWithConstraintId')
182
+				=> ConstraintCheckerServices::getConflictsWithChecker($services),
183
+			$config->get('WBQualityConstraintsItemRequiresClaimConstraintId')
184
+				=> ConstraintCheckerServices::getItemChecker($services),
185
+			$config->get('WBQualityConstraintsValueRequiresClaimConstraintId')
186
+				=> ConstraintCheckerServices::getTargetRequiredClaimChecker($services),
187
+			$config->get('WBQualityConstraintsSymmetricConstraintId')
188
+				=> ConstraintCheckerServices::getSymmetricChecker($services),
189
+			$config->get('WBQualityConstraintsInverseConstraintId')
190
+				=> ConstraintCheckerServices::getInverseChecker($services),
191
+			$config->get('WBQualityConstraintsUsedAsQualifierConstraintId')
192
+				=> ConstraintCheckerServices::getQualifierChecker($services),
193
+			$config->get('WBQualityConstraintsAllowedQualifiersConstraintId')
194
+				=> ConstraintCheckerServices::getQualifiersChecker($services),
195
+			$config->get('WBQualityConstraintsMandatoryQualifierConstraintId')
196
+				=> ConstraintCheckerServices::getMandatoryQualifiersChecker($services),
197
+			$config->get('WBQualityConstraintsRangeConstraintId')
198
+				=> ConstraintCheckerServices::getRangeChecker($services),
199
+			$config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId')
200
+				=> ConstraintCheckerServices::getDiffWithinRangeChecker($services),
201
+			$config->get('WBQualityConstraintsTypeConstraintId')
202
+				=> ConstraintCheckerServices::getTypeChecker($services),
203
+			$config->get('WBQualityConstraintsValueTypeConstraintId')
204
+				=> ConstraintCheckerServices::getValueTypeChecker($services),
205
+			$config->get('WBQualityConstraintsSingleValueConstraintId')
206
+				=> ConstraintCheckerServices::getSingleValueChecker($services),
207
+			$config->get('WBQualityConstraintsMultiValueConstraintId')
208
+				=> ConstraintCheckerServices::getMultiValueChecker($services),
209
+			$config->get('WBQualityConstraintsDistinctValuesConstraintId')
210
+				=> ConstraintCheckerServices::getUniqueValueChecker($services),
211
+			$config->get('WBQualityConstraintsFormatConstraintId')
212
+				=> ConstraintCheckerServices::getFormatChecker($services),
213
+			$config->get('WBQualityConstraintsCommonsLinkConstraintId')
214
+				=> ConstraintCheckerServices::getCommonsLinkChecker($services),
215
+			$config->get('WBQualityConstraintsOneOfConstraintId')
216
+				=> ConstraintCheckerServices::getOneOfChecker($services),
217
+			$config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId')
218
+				=> ConstraintCheckerServices::getValueOnlyChecker($services),
219
+			$config->get('WBQualityConstraintsUsedAsReferenceConstraintId')
220
+				=> ConstraintCheckerServices::getReferenceChecker($services),
221
+			$config->get('WBQualityConstraintsNoBoundsConstraintId')
222
+				=> ConstraintCheckerServices::getNoBoundsChecker($services),
223
+			$config->get('WBQualityConstraintsAllowedUnitsConstraintId')
224
+				=> ConstraintCheckerServices::getAllowedUnitsChecker($services),
225
+			$config->get('WBQualityConstraintsSingleBestValueConstraintId')
226
+				=> ConstraintCheckerServices::getSingleBestValueChecker($services),
227
+			$config->get('WBQualityConstraintsAllowedEntityTypesConstraintId')
228
+				=> ConstraintCheckerServices::getEntityTypeChecker($services),
229
+			$config->get('WBQualityConstraintsNoneOfConstraintId')
230
+				=> ConstraintCheckerServices::getNoneOfChecker($services),
231
+			$config->get('WBQualityConstraintsIntegerConstraintId')
232
+				=> ConstraintCheckerServices::getIntegerChecker($services),
233
+			$config->get('WBQualityConstraintsCitationNeededConstraintId')
234
+				=> ConstraintCheckerServices::getCitationNeededChecker($services),
235
+			$config->get('WBQualityConstraintsPropertyScopeConstraintId')
236
+				=> ConstraintCheckerServices::getPropertyScopeChecker($services),
237
+			$config->get('WBQualityConstraintsContemporaryConstraintId')
238
+				=> ConstraintCheckerServices::getContemporaryChecker($services),
239
+			$config->get('WBQualityConstraintsLexemeLanguageConstraintId')
240
+				=> ConstraintCheckerServices::getLexemeLanguageChecker($services),
241
+			$config->get('WBQualityConstraintsLabelInLanguageConstraintId')
242
+				=> ConstraintCheckerServices::getLabelInLanguageChecker($services),
243 243
 		];
244 244
 
245 245
 		return new DelegatingConstraintChecker(
246
-			WikibaseServices::getEntityLookup( $services ),
246
+			WikibaseServices::getEntityLookup($services),
247 247
 			$checkerMap,
248
-			ConstraintsServices::getConstraintLookup( $services ),
249
-			ConstraintsServices::getConstraintParameterParser( $services ),
248
+			ConstraintsServices::getConstraintLookup($services),
249
+			ConstraintsServices::getConstraintParameterParser($services),
250 250
 			$statementGuidParser,
251
-			ConstraintsServices::getLoggingHelper( $services ),
252
-			$config->get( 'WBQualityConstraintsCheckQualifiers' ),
253
-			$config->get( 'WBQualityConstraintsCheckReferences' ),
254
-			$config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' )
251
+			ConstraintsServices::getLoggingHelper($services),
252
+			$config->get('WBQualityConstraintsCheckQualifiers'),
253
+			$config->get('WBQualityConstraintsCheckReferences'),
254
+			$config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers')
255 255
 		);
256 256
 	},
257 257
 
258
-	ConstraintsServices::RESULTS_SOURCE => static function ( MediaWikiServices $services ) {
258
+	ConstraintsServices::RESULTS_SOURCE => static function(MediaWikiServices $services) {
259 259
 		$config = $services->getMainConfig();
260 260
 		$resultsSource = new CheckingResultsSource(
261
-			ConstraintsServices::getDelegatingConstraintChecker( $services )
261
+			ConstraintsServices::getDelegatingConstraintChecker($services)
262 262
 		);
263 263
 
264 264
 		$cacheCheckConstraintsResults = false;
265 265
 
266
-		if ( $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) {
266
+		if ($config->get('WBQualityConstraintsCacheCheckConstraintsResults')) {
267 267
 			$cacheCheckConstraintsResults = true;
268 268
 			// check that we can use getLocalRepoWikiPageMetaDataAccessor()
269 269
 			// TODO we should always be able to cache constraint check results (T244726)
270
-			$entitySources = WikibaseRepo::getEntitySourceDefinitions( $services )->getSources();
271
-			$localEntitySourceName = WikibaseRepo::getLocalEntitySource( $services )->getSourceName();
270
+			$entitySources = WikibaseRepo::getEntitySourceDefinitions($services)->getSources();
271
+			$localEntitySourceName = WikibaseRepo::getLocalEntitySource($services)->getSourceName();
272 272
 
273
-			foreach ( $entitySources as $entitySource ) {
274
-				if ( $entitySource->getSourceName() !== $localEntitySourceName ) {
275
-					LoggerFactory::getInstance( 'WikibaseQualityConstraints' )->warning(
276
-						'Cannot cache constraint check results for non-local source: ' .
273
+			foreach ($entitySources as $entitySource) {
274
+				if ($entitySource->getSourceName() !== $localEntitySourceName) {
275
+					LoggerFactory::getInstance('WikibaseQualityConstraints')->warning(
276
+						'Cannot cache constraint check results for non-local source: '.
277 277
 						$entitySource->getSourceName()
278 278
 					);
279 279
 					$cacheCheckConstraintsResults = false;
@@ -282,40 +282,40 @@  discard block
 block discarded – undo
282 282
 			}
283 283
 		}
284 284
 
285
-		if ( $cacheCheckConstraintsResults ) {
285
+		if ($cacheCheckConstraintsResults) {
286 286
 			$possiblyStaleConstraintTypes = [
287
-				$config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ),
288
-				$config->get( 'WBQualityConstraintsTypeConstraintId' ),
289
-				$config->get( 'WBQualityConstraintsValueTypeConstraintId' ),
290
-				$config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ),
287
+				$config->get('WBQualityConstraintsCommonsLinkConstraintId'),
288
+				$config->get('WBQualityConstraintsTypeConstraintId'),
289
+				$config->get('WBQualityConstraintsValueTypeConstraintId'),
290
+				$config->get('WBQualityConstraintsDistinctValuesConstraintId'),
291 291
 			];
292
-			$entityIdParser = WikibaseRepo::getEntityIdParser( $services );
292
+			$entityIdParser = WikibaseRepo::getEntityIdParser($services);
293 293
 			$wikiPageEntityMetaDataAccessor = WikibaseRepo::getLocalRepoWikiPageMetaDataAccessor(
294 294
 				$services );
295 295
 
296 296
 			$resultsSource = new CachingResultsSource(
297 297
 				$resultsSource,
298 298
 				ResultsCache::getDefaultInstance(),
299
-				ConstraintsServices::getCheckResultSerializer( $services ),
300
-				ConstraintsServices::getCheckResultDeserializer( $services ),
299
+				ConstraintsServices::getCheckResultSerializer($services),
300
+				ConstraintsServices::getCheckResultDeserializer($services),
301 301
 				$wikiPageEntityMetaDataAccessor,
302 302
 				$entityIdParser,
303
-				$config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ),
303
+				$config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'),
304 304
 				$possiblyStaleConstraintTypes,
305
-				$config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ),
306
-				ConstraintsServices::getLoggingHelper( $services )
305
+				$config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'),
306
+				ConstraintsServices::getLoggingHelper($services)
307 307
 			);
308 308
 		}
309 309
 
310 310
 		return $resultsSource;
311 311
 	},
312 312
 
313
-	ConstraintsServices::VIOLATION_MESSAGE_RENDERER_FACTORY => static function ( MediaWikiServices $services ) {
313
+	ConstraintsServices::VIOLATION_MESSAGE_RENDERER_FACTORY => static function(MediaWikiServices $services) {
314 314
 		return new ViolationMessageRendererFactory(
315 315
 			$services->getMainConfig(),
316 316
 			$services->getLanguageNameUtils(),
317
-			WikibaseRepo::getEntityIdHtmlLinkFormatterFactory( $services ),
318
-			WikibaseRepo::getValueFormatterFactory( $services )
317
+			WikibaseRepo::getEntityIdHtmlLinkFormatterFactory($services),
318
+			WikibaseRepo::getValueFormatterFactory($services)
319 319
 		);
320 320
 	},
321 321
 ];
Please login to merge, or discard this patch.