Completed
Push — master ( 31ef9a...fea290 )
by
unknown
36s queued 12s
created
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.
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
 
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
 		$this->maxListLength = $maxListLength;
63 63
 	}
64 64
 
65
-	public function render( ViolationMessage $violationMessage ): string {
65
+	public function render(ViolationMessage $violationMessage): string {
66 66
 		$messageKey = $violationMessage->getMessageKey();
67
-		$paramsLists = [ [] ];
68
-		foreach ( $violationMessage->getArguments() as $argument ) {
69
-			$params = $this->renderArgument( $argument );
67
+		$paramsLists = [[]];
68
+		foreach ($violationMessage->getArguments() as $argument) {
69
+			$params = $this->renderArgument($argument);
70 70
 			$paramsLists[] = $params;
71 71
 		}
72
-		$allParams = call_user_func_array( 'array_merge', $paramsLists );
72
+		$allParams = call_user_func_array('array_merge', $paramsLists);
73 73
 		return $this->messageLocalizer
74
-			->msg( $messageKey )
75
-			->params( $allParams )
74
+			->msg($messageKey)
75
+			->params($allParams)
76 76
 			->escaped();
77 77
 	}
78 78
 
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 	 * @param string|null $role one of the Role::* constants
82 82
 	 * @return string HTML
83 83
 	 */
84
-	protected function addRole( string $value, ?string $role ): string {
85
-		if ( $role === null ) {
84
+	protected function addRole(string $value, ?string $role): string {
85
+		if ($role === null) {
86 86
 			return $value;
87 87
 		}
88 88
 
89
-		return '<span class="wbqc-role wbqc-role-' . htmlspecialchars( $role ) . '">' .
90
-			$value .
89
+		return '<span class="wbqc-role wbqc-role-'.htmlspecialchars($role).'">'.
90
+			$value.
91 91
 			'</span>';
92 92
 	}
93 93
 
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 	 * @param string $key message key
96 96
 	 * @return string HTML
97 97
 	 */
98
-	protected function msgEscaped( string $key ): string {
99
-		return $this->messageLocalizer->msg( $key )->escaped();
98
+	protected function msgEscaped(string $key): string {
99
+		return $this->messageLocalizer->msg($key)->escaped();
100 100
 	}
101 101
 
102 102
 	/**
103 103
 	 * @param array $argument
104 104
 	 * @return array[] params (for Message::params)
105 105
 	 */
106
-	protected function renderArgument( array $argument ): array {
106
+	protected function renderArgument(array $argument): array {
107 107
 		$methods = [
108 108
 			ViolationMessage::TYPE_ENTITY_ID => 'renderEntityId',
109 109
 			ViolationMessage::TYPE_ENTITY_ID_LIST => 'renderEntityIdList',
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 		$value = $argument['value'];
125 125
 		$role = $argument['role'];
126 126
 
127
-		if ( array_key_exists( $type, $methods ) ) {
127
+		if (array_key_exists($type, $methods)) {
128 128
 			$method = $methods[$type];
129
-			$params = $this->$method( $value, $role );
129
+			$params = $this->$method($value, $role);
130 130
 		} else {
131 131
 			throw new InvalidArgumentException(
132
-				'Unknown ViolationMessage argument type ' . $type . '!'
132
+				'Unknown ViolationMessage argument type '.$type.'!'
133 133
 			);
134 134
 		}
135 135
 
@@ -143,36 +143,36 @@  discard block
 block discarded – undo
143 143
 	 * and return a single-element array with a raw message param (i. e. [ Message::rawParam( … ) ])
144 144
 	 * @return array[] list of parameters as accepted by Message::params()
145 145
 	 */
146
-	private function renderList( array $list, ?string $role, callable $render ): array {
147
-		if ( $list === [] ) {
146
+	private function renderList(array $list, ?string $role, callable $render): array {
147
+		if ($list === []) {
148 148
 			return [
149
-				Message::numParam( 0 ),
150
-				Message::rawParam( '<ul></ul>' ),
149
+				Message::numParam(0),
150
+				Message::rawParam('<ul></ul>'),
151 151
 			];
152 152
 		}
153 153
 
154
-		if ( count( $list ) > $this->maxListLength ) {
155
-			$list = array_slice( $list, 0, $this->maxListLength );
154
+		if (count($list) > $this->maxListLength) {
155
+			$list = array_slice($list, 0, $this->maxListLength);
156 156
 			$truncated = true;
157 157
 		}
158 158
 
159 159
 		$renderedParamsLists = array_map(
160 160
 			$render,
161 161
 			$list,
162
-			array_fill( 0, count( $list ), $role )
162
+			array_fill(0, count($list), $role)
163 163
 		);
164
-		$renderedParams = array_column( $renderedParamsLists, 0 );
165
-		$renderedElements = array_column( $renderedParams, 'raw' );
166
-		if ( isset( $truncated ) ) {
167
-			$renderedElements[] = $this->msgEscaped( 'ellipsis' );
164
+		$renderedParams = array_column($renderedParamsLists, 0);
165
+		$renderedElements = array_column($renderedParams, 'raw');
166
+		if (isset($truncated)) {
167
+			$renderedElements[] = $this->msgEscaped('ellipsis');
168 168
 		}
169 169
 
170 170
 		return array_merge(
171 171
 			[
172
-				Message::numParam( count( $list ) ),
172
+				Message::numParam(count($list)),
173 173
 				Message::rawParam(
174
-					'<ul><li>' .
175
-					implode( '</li><li>', $renderedElements ) .
174
+					'<ul><li>'.
175
+					implode('</li><li>', $renderedElements).
176 176
 					'</li></ul>'
177 177
 				),
178 178
 			],
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 	 * @param string|null $role one of the Role::* constants
186 186
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
187 187
 	 */
188
-	private function renderEntityId( EntityId $entityId, ?string $role ): array {
189
-		return [ Message::rawParam( $this->addRole(
190
-			$this->entityIdFormatter->formatEntityId( $entityId ),
188
+	private function renderEntityId(EntityId $entityId, ?string $role): array {
189
+		return [Message::rawParam($this->addRole(
190
+			$this->entityIdFormatter->formatEntityId($entityId),
191 191
 			$role
192
-		) ) ];
192
+		))];
193 193
 	}
194 194
 
195 195
 	/**
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	 * @param string|null $role one of the Role::* constants
198 198
 	 * @return array[] list of parameters as accepted by Message::params()
199 199
 	 */
200
-	private function renderEntityIdList( array $entityIdList, ?string $role ): array {
201
-		return $this->renderList( $entityIdList, $role, [ $this, 'renderEntityId' ] );
200
+	private function renderEntityIdList(array $entityIdList, ?string $role): array {
201
+		return $this->renderList($entityIdList, $role, [$this, 'renderEntityId']);
202 202
 	}
203 203
 
204 204
 	/**
@@ -206,24 +206,24 @@  discard block
 block discarded – undo
206 206
 	 * @param string|null $role one of the Role::* constants
207 207
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
208 208
 	 */
209
-	private function renderItemIdSnakValue( ItemIdSnakValue $value, ?string $role ): array {
210
-		switch ( true ) {
209
+	private function renderItemIdSnakValue(ItemIdSnakValue $value, ?string $role): array {
210
+		switch (true) {
211 211
 			case $value->isValue():
212
-				return $this->renderEntityId( $value->getItemId(), $role );
212
+				return $this->renderEntityId($value->getItemId(), $role);
213 213
 			case $value->isSomeValue():
214
-				return [ Message::rawParam( $this->addRole(
215
-					'<span class="wikibase-snakview-variation-somevaluesnak">' .
216
-						$this->msgEscaped( 'wikibase-snakview-snaktypeselector-somevalue' ) .
214
+				return [Message::rawParam($this->addRole(
215
+					'<span class="wikibase-snakview-variation-somevaluesnak">'.
216
+						$this->msgEscaped('wikibase-snakview-snaktypeselector-somevalue').
217 217
 						'</span>',
218 218
 					$role
219
-				) ) ];
219
+				))];
220 220
 			case $value->isNoValue():
221
-				return [ Message::rawParam( $this->addRole(
222
-					'<span class="wikibase-snakview-variation-novaluesnak">' .
223
-					$this->msgEscaped( 'wikibase-snakview-snaktypeselector-novalue' ) .
221
+				return [Message::rawParam($this->addRole(
222
+					'<span class="wikibase-snakview-variation-novaluesnak">'.
223
+					$this->msgEscaped('wikibase-snakview-snaktypeselector-novalue').
224 224
 						'</span>',
225 225
 					$role
226
-				) ) ];
226
+				))];
227 227
 			default:
228 228
 				// @codeCoverageIgnoreStart
229 229
 				throw new LogicException(
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 * @param string|null $role one of the Role::* constants
239 239
 	 * @return array[] list of parameters as accepted by Message::params()
240 240
 	 */
241
-	private function renderItemIdSnakValueList( array $valueList, ?string $role ): array {
242
-		return $this->renderList( $valueList, $role, [ $this, 'renderItemIdSnakValue' ] );
241
+	private function renderItemIdSnakValueList(array $valueList, ?string $role): array {
242
+		return $this->renderList($valueList, $role, [$this, 'renderItemIdSnakValue']);
243 243
 	}
244 244
 
245 245
 	/**
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 	 * @param string|null $role one of the Role::* constants
248 248
 	 * @return array[] list of parameters as accepted by Message::params()
249 249
 	 */
250
-	private function renderDataValue( DataValue $dataValue, ?string $role ): array {
251
-		return [ Message::rawParam( $this->addRole(
252
-			$this->dataValueFormatter->format( $dataValue ),
250
+	private function renderDataValue(DataValue $dataValue, ?string $role): array {
251
+		return [Message::rawParam($this->addRole(
252
+			$this->dataValueFormatter->format($dataValue),
253 253
 			$role
254
-		) ) ];
254
+		))];
255 255
 	}
256 256
 
257 257
 	/**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * @param string|null $role one of the Role::* constants
260 260
 	 * @return array[] list of parameters as accepted by Message::params()
261 261
 	 */
262
-	private function renderDataValueType( string $dataValueType, ?string $role ): array {
262
+	private function renderDataValueType(string $dataValueType, ?string $role): array {
263 263
 		$messageKeys = [
264 264
 			'string' => 'datatypes-type-string',
265 265
 			'monolingualtext' => 'datatypes-type-monolingualtext',
@@ -268,15 +268,15 @@  discard block
 block discarded – undo
268 268
 			'wikibase-entityid' => 'wbqc-dataValueType-wikibase-entityid',
269 269
 		];
270 270
 
271
-		if ( array_key_exists( $dataValueType, $messageKeys ) ) {
272
-			return [ Message::rawParam( $this->addRole(
273
-				$this->msgEscaped( $messageKeys[$dataValueType] ),
271
+		if (array_key_exists($dataValueType, $messageKeys)) {
272
+			return [Message::rawParam($this->addRole(
273
+				$this->msgEscaped($messageKeys[$dataValueType]),
274 274
 				$role
275
-			) ) ];
275
+			))];
276 276
 		} else {
277 277
 			// @codeCoverageIgnoreStart
278 278
 			throw new LogicException(
279
-				'Unknown data value type ' . $dataValueType
279
+				'Unknown data value type '.$dataValueType
280 280
 			);
281 281
 			// @codeCoverageIgnoreEnd
282 282
 		}
@@ -287,11 +287,11 @@  discard block
 block discarded – undo
287 287
 	 * @param string|null $role one of the Role::* constants
288 288
 	 * @return array[] list of parameters as accepted by Message::params()
289 289
 	 */
290
-	private function renderInlineCode( string $code, ?string $role ): array {
291
-		return [ Message::rawParam( $this->addRole(
292
-			'<code>' . htmlspecialchars( $code ) . '</code>',
290
+	private function renderInlineCode(string $code, ?string $role): array {
291
+		return [Message::rawParam($this->addRole(
292
+			'<code>'.htmlspecialchars($code).'</code>',
293 293
 			$role
294
-		) ) ];
294
+		))];
295 295
 	}
296 296
 
297 297
 	/**
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	 * @param string|null $role one of the Role::* constants
300 300
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
301 301
 	 */
302
-	private function renderConstraintScope( string $scope, ?string $role ): array {
303
-		switch ( $scope ) {
302
+	private function renderConstraintScope(string $scope, ?string $role): array {
303
+		switch ($scope) {
304 304
 			case Context::TYPE_STATEMENT:
305 305
 				$itemId = $this->config->get(
306 306
 					'WBQualityConstraintsConstraintCheckedOnMainValueId'
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
 				// callers should never let this happen, but if it does happen,
321 321
 				// showing “unknown value” seems reasonable
322 322
 				// @codeCoverageIgnoreStart
323
-				return $this->renderItemIdSnakValue( ItemIdSnakValue::someValue(), $role );
323
+				return $this->renderItemIdSnakValue(ItemIdSnakValue::someValue(), $role);
324 324
 				// @codeCoverageIgnoreEnd
325 325
 		}
326
-		return $this->renderEntityId( new ItemId( $itemId ), $role );
326
+		return $this->renderEntityId(new ItemId($itemId), $role);
327 327
 	}
328 328
 
329 329
 	/**
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 	 * @param string|null $role one of the Role::* constants
332 332
 	 * @return array[] list of parameters as accepted by Message::params()
333 333
 	 */
334
-	private function renderConstraintScopeList( array $scopeList, ?string $role ): array {
335
-		return $this->renderList( $scopeList, $role, [ $this, 'renderConstraintScope' ] );
334
+	private function renderConstraintScopeList(array $scopeList, ?string $role): array {
335
+		return $this->renderList($scopeList, $role, [$this, 'renderConstraintScope']);
336 336
 	}
337 337
 
338 338
 	/**
@@ -340,25 +340,25 @@  discard block
 block discarded – undo
340 340
 	 * @param string|null $role one of the Role::* constants
341 341
 	 * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ])
342 342
 	 */
343
-	private function renderPropertyScope( string $scope, ?string $role ): array {
344
-		switch ( $scope ) {
343
+	private function renderPropertyScope(string $scope, ?string $role): array {
344
+		switch ($scope) {
345 345
 			case Context::TYPE_STATEMENT:
346
-				$itemId = $this->config->get( 'WBQualityConstraintsAsMainValueId' );
346
+				$itemId = $this->config->get('WBQualityConstraintsAsMainValueId');
347 347
 				break;
348 348
 			case Context::TYPE_QUALIFIER:
349
-				$itemId = $this->config->get( 'WBQualityConstraintsAsQualifiersId' );
349
+				$itemId = $this->config->get('WBQualityConstraintsAsQualifiersId');
350 350
 				break;
351 351
 			case Context::TYPE_REFERENCE:
352
-				$itemId = $this->config->get( 'WBQualityConstraintsAsReferencesId' );
352
+				$itemId = $this->config->get('WBQualityConstraintsAsReferencesId');
353 353
 				break;
354 354
 			default:
355 355
 				// callers should never let this happen, but if it does happen,
356 356
 				// showing “unknown value” seems reasonable
357 357
 				// @codeCoverageIgnoreStart
358
-				return $this->renderItemIdSnakValue( ItemIdSnakValue::someValue(), $role );
358
+				return $this->renderItemIdSnakValue(ItemIdSnakValue::someValue(), $role);
359 359
 				// @codeCoverageIgnoreEnd
360 360
 		}
361
-		return $this->renderEntityId( new ItemId( $itemId ), $role );
361
+		return $this->renderEntityId(new ItemId($itemId), $role);
362 362
 	}
363 363
 
364 364
 	/**
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 	 * @param string|null $role one of the Role::* constants
367 367
 	 * @return array[] list of parameters as accepted by Message::params()
368 368
 	 */
369
-	private function renderPropertyScopeList( array $scopeList, ?string $role ): array {
370
-		return $this->renderList( $scopeList, $role, [ $this, 'renderPropertyScope' ] );
369
+	private function renderPropertyScopeList(array $scopeList, ?string $role): array {
370
+		return $this->renderList($scopeList, $role, [$this, 'renderPropertyScope']);
371 371
 	}
372 372
 
373 373
 	/**
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
 	 * @param string|null $role one of the Role::* constants
376 376
 	 * @return array[] list of parameters as accepted by Message::params()
377 377
 	 */
378
-	private function renderLanguage( string $languageCode, ?string $role ): array {
378
+	private function renderLanguage(string $languageCode, ?string $role): array {
379 379
 		return [
380 380
 			// ::renderList (through ::renderLanguageList) requires 'raw' parameter
381 381
 			// so we effectively build Message::plaintextParam here
382
-			Message::rawParam( htmlspecialchars(
383
-				$this->languageNameUtils->getLanguageName( $languageCode, $this->userLanguageCode )
384
-			) ),
385
-			Message::plaintextParam( $languageCode ),
382
+			Message::rawParam(htmlspecialchars(
383
+				$this->languageNameUtils->getLanguageName($languageCode, $this->userLanguageCode)
384
+			)),
385
+			Message::plaintextParam($languageCode),
386 386
 		];
387 387
 	}
388 388
 
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
 	 * @param string|null $role one of the Role::* constants
392 392
 	 * @return array[] list of parameters as accepted by Message::params()
393 393
 	 */
394
-	private function renderLanguageList( array $languageCodes, ?string $role ): array {
395
-		return $this->renderList( $languageCodes, $role, [ $this, 'renderLanguage' ] );
394
+	private function renderLanguageList(array $languageCodes, ?string $role): array {
395
+		return $this->renderList($languageCodes, $role, [$this, 'renderLanguage']);
396 396
 	}
397 397
 
398 398
 }
Please login to merge, or discard this patch.
src/WikibaseQualityConstraintsHooks.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -28,27 +28,27 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @param DatabaseUpdater $updater
30 30
 	 */
31
-	public static function onCreateSchema( DatabaseUpdater $updater ) {
32
-		$dir = dirname( __DIR__ ) . '/sql/';
31
+	public static function onCreateSchema(DatabaseUpdater $updater) {
32
+		$dir = dirname(__DIR__).'/sql/';
33 33
 
34 34
 		$updater->addExtensionTable(
35 35
 			'wbqc_constraints',
36
-			$dir . "/{$updater->getDB()->getType()}/tables-generated.sql"
36
+			$dir."/{$updater->getDB()->getType()}/tables-generated.sql"
37 37
 		);
38 38
 		$updater->addExtensionField(
39 39
 			'wbqc_constraints',
40 40
 			'constraint_id',
41
-			$dir . '/patch-wbqc_constraints-constraint_id.sql'
41
+			$dir.'/patch-wbqc_constraints-constraint_id.sql'
42 42
 		);
43 43
 		$updater->addExtensionIndex(
44 44
 			'wbqc_constraints',
45 45
 			'wbqc_constraints_guid_uniq',
46
-			$dir . '/patch-wbqc_constraints-wbqc_constraints_guid_uniq.sql'
46
+			$dir.'/patch-wbqc_constraints-wbqc_constraints_guid_uniq.sql'
47 47
 		);
48 48
 	}
49 49
 
50
-	public static function onWikibaseChange( Change $change ) {
51
-		if ( !( $change instanceof EntityChange ) ) {
50
+	public static function onWikibaseChange(Change $change) {
51
+		if (!($change instanceof EntityChange)) {
52 52
 			return;
53 53
 		}
54 54
 		/** @var EntityChange $change */
@@ -59,48 +59,48 @@  discard block
 block discarded – undo
59 59
 
60 60
 		// If jobs are enabled and the results would be stored in some way run a job.
61 61
 		if (
62
-			$config->get( 'WBQualityConstraintsEnableConstraintsCheckJobs' ) &&
63
-			$config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) &&
62
+			$config->get('WBQualityConstraintsEnableConstraintsCheckJobs') &&
63
+			$config->get('WBQualityConstraintsCacheCheckConstraintsResults') &&
64 64
 			self::isSelectedForJobRunBasedOnPercentage()
65 65
 		) {
66
-			$params = [ 'entityId' => $change->getEntityId()->getSerialization() ];
66
+			$params = ['entityId' => $change->getEntityId()->getSerialization()];
67 67
 			$jobQueueGroup->lazyPush(
68
-				new JobSpecification( CheckConstraintsJob::COMMAND, $params )
68
+				new JobSpecification(CheckConstraintsJob::COMMAND, $params)
69 69
 			);
70 70
 		}
71 71
 
72
-		if ( $config->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) &&
73
-			self::isConstraintStatementsChange( $config, $change )
72
+		if ($config->get('WBQualityConstraintsEnableConstraintsImportFromStatements') &&
73
+			self::isConstraintStatementsChange($config, $change)
74 74
 		) {
75
-			$params = [ 'propertyId' => $change->getEntityId()->getSerialization() ];
75
+			$params = ['propertyId' => $change->getEntityId()->getSerialization()];
76 76
 			$metadata = $change->getMetadata();
77
-			if ( array_key_exists( 'rev_id', $metadata ) ) {
77
+			if (array_key_exists('rev_id', $metadata)) {
78 78
 				$params['revisionId'] = $metadata['rev_id'];
79 79
 			}
80 80
 			$jobQueueGroup->push(
81
-				new JobSpecification( 'constraintsTableUpdate', $params )
81
+				new JobSpecification('constraintsTableUpdate', $params)
82 82
 			);
83 83
 		}
84 84
 	}
85 85
 
86 86
 	private static function isSelectedForJobRunBasedOnPercentage() {
87 87
 		$config = MediaWikiServices::getInstance()->getMainConfig();
88
-		$percentage = $config->get( 'WBQualityConstraintsEnableConstraintsCheckJobsRatio' );
88
+		$percentage = $config->get('WBQualityConstraintsEnableConstraintsCheckJobsRatio');
89 89
 
90
-		return mt_rand( 1, 100 ) <= $percentage;
90
+		return mt_rand(1, 100) <= $percentage;
91 91
 	}
92 92
 
93
-	public static function isConstraintStatementsChange( Config $config, Change $change ) {
94
-		if ( !( $change instanceof EntityChange ) ||
93
+	public static function isConstraintStatementsChange(Config $config, Change $change) {
94
+		if (!($change instanceof EntityChange) ||
95 95
 			 $change->getAction() !== EntityChange::UPDATE ||
96
-			 !( $change->getEntityId() instanceof NumericPropertyId )
96
+			 !($change->getEntityId() instanceof NumericPropertyId)
97 97
 		) {
98 98
 			return false;
99 99
 		}
100 100
 
101 101
 		$info = $change->getInfo();
102 102
 
103
-		if ( !array_key_exists( 'compactDiff', $info ) ) {
103
+		if (!array_key_exists('compactDiff', $info)) {
104 104
 			// the non-compact diff ($info['diff']) does not contain statement diffs (T110996),
105 105
 			// so we only know that the change *might* affect the constraint statements
106 106
 			return true;
@@ -109,50 +109,50 @@  discard block
 block discarded – undo
109 109
 		/** @var EntityDiffChangedAspects $aspects */
110 110
 		$aspects = $info['compactDiff'];
111 111
 
112
-		$propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' );
113
-		return in_array( $propertyConstraintId, $aspects->getStatementChanges() );
112
+		$propertyConstraintId = $config->get('WBQualityConstraintsPropertyConstraintId');
113
+		return in_array($propertyConstraintId, $aspects->getStatementChanges());
114 114
 	}
115 115
 
116
-	public static function onArticlePurge( WikiPage $wikiPage ) {
116
+	public static function onArticlePurge(WikiPage $wikiPage) {
117 117
 		$entityContentFactory = WikibaseRepo::getEntityContentFactory();
118
-		if ( $entityContentFactory->isEntityContentModel( $wikiPage->getContentModel() ) ) {
118
+		if ($entityContentFactory->isEntityContentModel($wikiPage->getContentModel())) {
119 119
 			$entityIdLookup = WikibaseRepo::getEntityIdLookup();
120
-			$entityId = $entityIdLookup->getEntityIdForTitle( $wikiPage->getTitle() );
121
-			if ( $entityId !== null ) {
120
+			$entityId = $entityIdLookup->getEntityIdForTitle($wikiPage->getTitle());
121
+			if ($entityId !== null) {
122 122
 				$resultsCache = ResultsCache::getDefaultInstance();
123
-				$resultsCache->delete( $entityId );
123
+				$resultsCache->delete($entityId);
124 124
 			}
125 125
 		}
126 126
 	}
127 127
 
128
-	public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
128
+	public static function onBeforePageDisplay(OutputPage $out, Skin $skin) {
129 129
 		$lookup = WikibaseRepo::getEntityNamespaceLookup();
130 130
 		$title = $out->getTitle();
131
-		if ( $title === null ) {
131
+		if ($title === null) {
132 132
 			return;
133 133
 		}
134 134
 
135
-		if ( !$lookup->isNamespaceWithEntities( $title->getNamespace() ) ) {
135
+		if (!$lookup->isNamespaceWithEntities($title->getNamespace())) {
136 136
 			return;
137 137
 		}
138
-		if ( empty( $out->getJsConfigVars()['wbIsEditView'] ) ) {
138
+		if (empty($out->getJsConfigVars()['wbIsEditView'])) {
139 139
 			return;
140 140
 		}
141 141
 
142 142
 		$services = MediaWikiServices::getInstance();
143 143
 		$config = $services->getMainConfig();
144 144
 
145
-		$isMobileView = ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) &&
146
-			$services->getService( 'MobileFrontend.Context' )->shouldDisplayMobileView();
147
-		if ( $isMobileView ) {
145
+		$isMobileView = ExtensionRegistry::getInstance()->isLoaded('MobileFrontend') &&
146
+			$services->getService('MobileFrontend.Context')->shouldDisplayMobileView();
147
+		if ($isMobileView) {
148 148
 			return;
149 149
 		}
150 150
 
151
-		$out->addModules( 'wikibase.quality.constraints.suggestions' );
151
+		$out->addModules('wikibase.quality.constraints.suggestions');
152 152
 
153
-		if ( $config->get( 'WBQualityConstraintsShowConstraintViolationToNonLoggedInUsers' )
154
-			|| $out->getUser()->isRegistered() ) {
155
-				$out->addModules( 'wikibase.quality.constraints.gadget' );
153
+		if ($config->get('WBQualityConstraintsShowConstraintViolationToNonLoggedInUsers')
154
+			|| $out->getUser()->isRegistered()) {
155
+				$out->addModules('wikibase.quality.constraints.gadget');
156 156
 		}
157 157
 	}
158 158
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Result/CheckResultDeserializer.php 1 patch
Spacing   +22 added lines, -22 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\Result;
6 6
 
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 		$this->entityIdParser = $entityIdParser;
40 40
 	}
41 41
 
42
-	public function deserialize( array $serialization ): CheckResult {
42
+	public function deserialize(array $serialization): CheckResult {
43 43
 		$contextCursor = $this->contextCursorDeserializer->deserialize(
44 44
 			$serialization[CheckResultSerializer::KEY_CONTEXT_CURSOR]
45 45
 		);
46 46
 
47
-		if ( array_key_exists( CheckResultSerializer::KEY_NULL_RESULT, $serialization ) ) {
48
-			$result = new NullResult( $contextCursor );
47
+		if (array_key_exists(CheckResultSerializer::KEY_NULL_RESULT, $serialization)) {
48
+			$result = new NullResult($contextCursor);
49 49
 			$cachingMetadata = CachingMetadata::fresh();
50 50
 		} else {
51 51
 			$constraint = $this->constraintDeserializer->deserialize(
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 			$status = $serialization[CheckResultSerializer::KEY_CHECK_RESULT_STATUS];
58 58
 
59
-			$violationMessage = $this->getViolationMessageFromSerialization( $serialization );
59
+			$violationMessage = $this->getViolationMessageFromSerialization($serialization);
60 60
 
61 61
 			$result = new CheckResult(
62 62
 				$contextCursor,
@@ -71,18 +71,18 @@  discard block
 block discarded – undo
71 71
 			);
72 72
 		}
73 73
 
74
-		$dependencyMetadata = $this->getDependencyMetadataFromSerialization( $serialization );
74
+		$dependencyMetadata = $this->getDependencyMetadataFromSerialization($serialization);
75 75
 
76 76
 		return $result->withMetadata(
77
-			Metadata::merge( [
78
-				Metadata::ofCachingMetadata( $cachingMetadata ),
79
-				Metadata::ofDependencyMetadata( $dependencyMetadata ),
80
-			] )
77
+			Metadata::merge([
78
+				Metadata::ofCachingMetadata($cachingMetadata),
79
+				Metadata::ofDependencyMetadata($dependencyMetadata),
80
+			])
81 81
 		);
82 82
 	}
83 83
 
84
-	private function getViolationMessageFromSerialization( array $serialization ): ?ViolationMessage {
85
-		if ( array_key_exists( CheckResultSerializer::KEY_VIOLATION_MESSAGE, $serialization ) ) {
84
+	private function getViolationMessageFromSerialization(array $serialization): ?ViolationMessage {
85
+		if (array_key_exists(CheckResultSerializer::KEY_VIOLATION_MESSAGE, $serialization)) {
86 86
 			return $this->violationMessageDeserializer->deserialize(
87 87
 				$serialization[CheckResultSerializer::KEY_VIOLATION_MESSAGE]
88 88
 			);
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		}
92 92
 	}
93 93
 
94
-	private function getDependencyMetadataFromSerialization( array $serialization ): DependencyMetadata {
95
-		if ( array_key_exists( CheckResultSerializer::KEY_DEPENDENCY_METADATA, $serialization ) ) {
94
+	private function getDependencyMetadataFromSerialization(array $serialization): DependencyMetadata {
95
+		if (array_key_exists(CheckResultSerializer::KEY_DEPENDENCY_METADATA, $serialization)) {
96 96
 			return $this->deserializeDependencyMetadata(
97 97
 				$serialization[CheckResultSerializer::KEY_DEPENDENCY_METADATA]
98 98
 			);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		}
102 102
 	}
103 103
 
104
-	private function deserializeCachingMetadata( array $serialization ): CachingMetadata {
104
+	private function deserializeCachingMetadata(array $serialization): CachingMetadata {
105 105
 		if (
106 106
 			array_key_exists(
107 107
 				CheckResultSerializer::KEY_CACHING_METADATA_MAX_AGE,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		}
117 117
 	}
118 118
 
119
-	private function deserializeDependencyMetadata( array $serialization ): DependencyMetadata {
119
+	private function deserializeDependencyMetadata(array $serialization): DependencyMetadata {
120 120
 		if (
121 121
 			array_key_exists(
122 122
 				CheckResultSerializer::KEY_DEPENDENCY_METADATA_FUTURE_TIME,
@@ -126,20 +126,20 @@  discard block
 block discarded – undo
126 126
 			$futureTime = TimeValue::newFromArray(
127 127
 				$serialization[CheckResultSerializer::KEY_DEPENDENCY_METADATA_FUTURE_TIME]
128 128
 			);
129
-			$futureTimeDependencyMetadata = DependencyMetadata::ofFutureTime( $futureTime );
129
+			$futureTimeDependencyMetadata = DependencyMetadata::ofFutureTime($futureTime);
130 130
 		} else {
131 131
 			$futureTimeDependencyMetadata = DependencyMetadata::blank();
132 132
 		}
133 133
 
134 134
 		$dependencyMetadata = array_reduce(
135 135
 			$serialization[CheckResultSerializer::KEY_DEPENDENCY_METADATA_ENTITY_IDS],
136
-			function ( DependencyMetadata $metadata, $entityIdSerialization ) {
137
-				$entityId = $this->entityIdParser->parse( $entityIdSerialization );
136
+			function(DependencyMetadata $metadata, $entityIdSerialization) {
137
+				$entityId = $this->entityIdParser->parse($entityIdSerialization);
138 138
 
139
-				return DependencyMetadata::merge( [
139
+				return DependencyMetadata::merge([
140 140
 					$metadata,
141
-					DependencyMetadata::ofEntityId( $entityId )
142
-				] );
141
+					DependencyMetadata::ofEntityId($entityId)
142
+				]);
143 143
 			},
144 144
 			$futureTimeDependencyMetadata
145 145
 		);
Please login to merge, or discard this patch.
src/ConstraintCheck/Result/NullResult.php 1 patch
Spacing   +6 added lines, -6 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\Result;
6 6
 
@@ -27,22 +27,22 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	private const NULL_PROPERTY_ID = 'P2147483647';
29 29
 
30
-	public function __construct( ContextCursor $contextCursor ) {
30
+	public function __construct(ContextCursor $contextCursor) {
31 31
 		$constraint = new Constraint(
32 32
 			'null',
33
-			new NumericPropertyId( self::NULL_PROPERTY_ID ),
33
+			new NumericPropertyId(self::NULL_PROPERTY_ID),
34 34
 			'none',
35 35
 			[]
36 36
 		);
37
-		parent::__construct( $contextCursor, $constraint );
37
+		parent::__construct($contextCursor, $constraint);
38 38
 	}
39 39
 
40 40
 	public function getConstraint(): Constraint {
41
-		throw new DomainException( 'NullResult holds no constraint' );
41
+		throw new DomainException('NullResult holds no constraint');
42 42
 	}
43 43
 
44 44
 	public function getConstraintId(): string {
45
-		throw new DomainException( 'NullResult holds no constraint' );
45
+		throw new DomainException('NullResult holds no constraint');
46 46
 	}
47 47
 
48 48
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/Result/CheckResultSerializer.php 1 patch
Spacing   +15 added lines, -15 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\Result;
6 6
 
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 		$this->serializeDependencyMetadata = $serializeDependencyMetadata;
60 60
 	}
61 61
 
62
-	public function serialize( CheckResult $checkResult ): array {
62
+	public function serialize(CheckResult $checkResult): array {
63 63
 		$contextCursor = $checkResult->getContextCursor();
64 64
 
65 65
 		$serialization = [
66
-			self::KEY_CONTEXT_CURSOR => $this->contextCursorSerializer->serialize( $contextCursor ),
66
+			self::KEY_CONTEXT_CURSOR => $this->contextCursorSerializer->serialize($contextCursor),
67 67
 		];
68 68
 
69
-		if ( $checkResult instanceof NullResult ) {
69
+		if ($checkResult instanceof NullResult) {
70 70
 			$serialization[self::KEY_NULL_RESULT] = 1;
71 71
 		} else {
72 72
 			$constraint = $checkResult->getConstraint();
@@ -74,53 +74,53 @@  discard block
 block discarded – undo
74 74
 			$violationMessage = $checkResult->getMessage();
75 75
 
76 76
 			$serialization[self::KEY_CONSTRAINT] =
77
-				$this->constraintSerializer->serialize( $constraint );
77
+				$this->constraintSerializer->serialize($constraint);
78 78
 			$serialization[self::KEY_CHECK_RESULT_STATUS] =
79 79
 				$checkResult->getStatus();
80 80
 			$serialization[self::KEY_CACHING_METADATA] =
81
-				$this->serializeCachingMetadata( $cachingMetadata );
81
+				$this->serializeCachingMetadata($cachingMetadata);
82 82
 
83
-			if ( $violationMessage !== null ) {
83
+			if ($violationMessage !== null) {
84 84
 				$serialization[self::KEY_VIOLATION_MESSAGE] =
85
-					$this->violationMessageSerializer->serialize( $violationMessage );
85
+					$this->violationMessageSerializer->serialize($violationMessage);
86 86
 			}
87 87
 		}
88 88
 
89
-		if ( $this->serializeDependencyMetadata ) {
89
+		if ($this->serializeDependencyMetadata) {
90 90
 			$serialization[self::KEY_DEPENDENCY_METADATA] =
91
-				$this->serializeDependencyMetadata( $checkResult );
91
+				$this->serializeDependencyMetadata($checkResult);
92 92
 		}
93 93
 
94 94
 		return $serialization;
95 95
 	}
96 96
 
97
-	private function serializeCachingMetadata( CachingMetadata $cachingMetadata ): array {
97
+	private function serializeCachingMetadata(CachingMetadata $cachingMetadata): array {
98 98
 		$maximumAge = $cachingMetadata->getMaximumAgeInSeconds();
99 99
 
100 100
 		$serialization = [];
101 101
 
102
-		if ( $maximumAge > 0 ) {
102
+		if ($maximumAge > 0) {
103 103
 			$serialization[self::KEY_CACHING_METADATA_MAX_AGE] = $maximumAge;
104 104
 		}
105 105
 
106 106
 		return $serialization;
107 107
 	}
108 108
 
109
-	private function serializeDependencyMetadata( CheckResult $checkResult ): array {
109
+	private function serializeDependencyMetadata(CheckResult $checkResult): array {
110 110
 		$dependencyMetadata = $checkResult->getMetadata()->getDependencyMetadata();
111 111
 		$entityIds = $dependencyMetadata->getEntityIds();
112 112
 		$futureTime = $dependencyMetadata->getFutureTime();
113 113
 
114 114
 		$serialization = [
115 115
 			self::KEY_DEPENDENCY_METADATA_ENTITY_IDS => array_map(
116
-				static function ( EntityId $entityId ) {
116
+				static function(EntityId $entityId) {
117 117
 					return $entityId->getSerialization();
118 118
 				},
119 119
 				$entityIds
120 120
 			),
121 121
 		];
122 122
 
123
-		if ( $futureTime !== null ) {
123
+		if ($futureTime !== null) {
124 124
 			$serialization[self::KEY_DEPENDENCY_METADATA_FUTURE_TIME] =
125 125
 				$futureTime->getArrayValue();
126 126
 		}
Please login to merge, or discard this patch.
src/ConstraintCheck/Helper/ConstraintParameterParser.php 1 patch
Spacing   +287 added lines, -287 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\Helper;
6 6
 
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
 	 * Check if any errors are recorded in the constraint parameters.
69 69
 	 * @throws ConstraintParameterException
70 70
 	 */
71
-	public function checkError( array $parameters ): void {
72
-		if ( array_key_exists( '@error', $parameters ) ) {
71
+	public function checkError(array $parameters): void {
72
+		if (array_key_exists('@error', $parameters)) {
73 73
 			$error = $parameters['@error'];
74
-			if ( array_key_exists( 'toolong', $error ) && $error['toolong'] ) {
74
+			if (array_key_exists('toolong', $error) && $error['toolong']) {
75 75
 				$msg = 'wbqc-violation-message-parameters-error-toolong';
76 76
 			} else {
77 77
 				$msg = 'wbqc-violation-message-parameters-error-unknown';
78 78
 			}
79
-			throw new ConstraintParameterException( new ViolationMessage( $msg ) );
79
+			throw new ConstraintParameterException(new ViolationMessage($msg));
80 80
 		}
81 81
 	}
82 82
 
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 	 * Require that $parameters contains exactly one $parameterId parameter.
85 85
 	 * @throws ConstraintParameterException
86 86
 	 */
87
-	private function requireSingleParameter( array $parameters, string $parameterId ): void {
88
-		if ( count( $parameters[$parameterId] ) !== 1 ) {
87
+	private function requireSingleParameter(array $parameters, string $parameterId): void {
88
+		if (count($parameters[$parameterId]) !== 1) {
89 89
 			throw new ConstraintParameterException(
90
-				( new ViolationMessage( 'wbqc-violation-message-parameter-single' ) )
91
-					->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
90
+				(new ViolationMessage('wbqc-violation-message-parameter-single'))
91
+					->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
92 92
 			);
93 93
 		}
94 94
 	}
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	 * Require that $snak is a {@link PropertyValueSnak}.
98 98
 	 * @throws ConstraintParameterException
99 99
 	 */
100
-	private function requireValueParameter( Snak $snak, string $parameterId ): void {
101
-		if ( !( $snak instanceof PropertyValueSnak ) ) {
100
+	private function requireValueParameter(Snak $snak, string $parameterId): void {
101
+		if (!($snak instanceof PropertyValueSnak)) {
102 102
 			throw new ConstraintParameterException(
103
-				( new ViolationMessage( 'wbqc-violation-message-parameter-value' ) )
104
-					->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
103
+				(new ViolationMessage('wbqc-violation-message-parameter-value'))
104
+					->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
105 105
 			);
106 106
 		}
107 107
 	}
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
 	 * Parse a single entity ID parameter.
111 111
 	 * @throws ConstraintParameterException
112 112
 	 */
113
-	private function parseEntityIdParameter( array $snakSerialization, string $parameterId ): EntityId {
114
-		$snak = $this->snakDeserializer->deserialize( $snakSerialization );
115
-		$this->requireValueParameter( $snak, $parameterId );
113
+	private function parseEntityIdParameter(array $snakSerialization, string $parameterId): EntityId {
114
+		$snak = $this->snakDeserializer->deserialize($snakSerialization);
115
+		$this->requireValueParameter($snak, $parameterId);
116 116
 		$value = $snak->getDataValue();
117
-		if ( $value instanceof EntityIdValue ) {
117
+		if ($value instanceof EntityIdValue) {
118 118
 			return $value->getEntityId();
119 119
 		} else {
120 120
 			throw new ConstraintParameterException(
121
-				( new ViolationMessage( 'wbqc-violation-message-parameter-entity' ) )
122
-					->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
123
-					->withDataValue( $value, Role::CONSTRAINT_PARAMETER_VALUE )
121
+				(new ViolationMessage('wbqc-violation-message-parameter-entity'))
122
+					->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
123
+					->withDataValue($value, Role::CONSTRAINT_PARAMETER_VALUE)
124 124
 			);
125 125
 		}
126 126
 	}
@@ -131,20 +131,20 @@  discard block
 block discarded – undo
131 131
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
132 132
 	 * @return string[] class entity ID serializations
133 133
 	 */
134
-	public function parseClassParameter( array $constraintParameters, string $constraintTypeItemId ): array {
135
-		$this->checkError( $constraintParameters );
136
-		$classId = $this->config->get( 'WBQualityConstraintsClassId' );
137
-		if ( !array_key_exists( $classId, $constraintParameters ) ) {
134
+	public function parseClassParameter(array $constraintParameters, string $constraintTypeItemId): array {
135
+		$this->checkError($constraintParameters);
136
+		$classId = $this->config->get('WBQualityConstraintsClassId');
137
+		if (!array_key_exists($classId, $constraintParameters)) {
138 138
 			throw new ConstraintParameterException(
139
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
140
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
141
-					->withEntityId( new NumericPropertyId( $classId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
139
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
140
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
141
+					->withEntityId(new NumericPropertyId($classId), Role::CONSTRAINT_PARAMETER_PROPERTY)
142 142
 			);
143 143
 		}
144 144
 
145 145
 		$classes = [];
146
-		foreach ( $constraintParameters[$classId] as $class ) {
147
-			$classes[] = $this->parseEntityIdParameter( $class, $classId )->getSerialization();
146
+		foreach ($constraintParameters[$classId] as $class) {
147
+			$classes[] = $this->parseEntityIdParameter($class, $classId)->getSerialization();
148 148
 		}
149 149
 		return $classes;
150 150
 	}
@@ -155,31 +155,31 @@  discard block
 block discarded – undo
155 155
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
156 156
 	 * @return string 'instance', 'subclass', or 'instanceOrSubclass'
157 157
 	 */
158
-	public function parseRelationParameter( array $constraintParameters, string $constraintTypeItemId ): string {
159
-		$this->checkError( $constraintParameters );
160
-		$relationId = $this->config->get( 'WBQualityConstraintsRelationId' );
161
-		if ( !array_key_exists( $relationId, $constraintParameters ) ) {
158
+	public function parseRelationParameter(array $constraintParameters, string $constraintTypeItemId): string {
159
+		$this->checkError($constraintParameters);
160
+		$relationId = $this->config->get('WBQualityConstraintsRelationId');
161
+		if (!array_key_exists($relationId, $constraintParameters)) {
162 162
 			throw new ConstraintParameterException(
163
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
164
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
165
-					->withEntityId( new NumericPropertyId( $relationId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
163
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
164
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
165
+					->withEntityId(new NumericPropertyId($relationId), Role::CONSTRAINT_PARAMETER_PROPERTY)
166 166
 			);
167 167
 		}
168 168
 
169
-		$this->requireSingleParameter( $constraintParameters, $relationId );
170
-		$relationEntityId = $this->parseEntityIdParameter( $constraintParameters[$relationId][0], $relationId );
171
-		if ( !( $relationEntityId instanceof ItemId ) ) {
169
+		$this->requireSingleParameter($constraintParameters, $relationId);
170
+		$relationEntityId = $this->parseEntityIdParameter($constraintParameters[$relationId][0], $relationId);
171
+		if (!($relationEntityId instanceof ItemId)) {
172 172
 			throw new ConstraintParameterException(
173
-				( new ViolationMessage( 'wbqc-violation-message-parameter-item' ) )
174
-					->withEntityId( new NumericPropertyId( $relationId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
175
-					->withDataValue( new EntityIdValue( $relationEntityId ), Role::CONSTRAINT_PARAMETER_VALUE )
173
+				(new ViolationMessage('wbqc-violation-message-parameter-item'))
174
+					->withEntityId(new NumericPropertyId($relationId), Role::CONSTRAINT_PARAMETER_PROPERTY)
175
+					->withDataValue(new EntityIdValue($relationEntityId), Role::CONSTRAINT_PARAMETER_VALUE)
176 176
 			);
177 177
 		}
178
-		return $this->mapItemId( $relationEntityId, [
179
-			$this->config->get( 'WBQualityConstraintsInstanceOfRelationId' ) => 'instance',
180
-			$this->config->get( 'WBQualityConstraintsSubclassOfRelationId' ) => 'subclass',
181
-			$this->config->get( 'WBQualityConstraintsInstanceOrSubclassOfRelationId' ) => 'instanceOrSubclass',
182
-		], $relationId );
178
+		return $this->mapItemId($relationEntityId, [
179
+			$this->config->get('WBQualityConstraintsInstanceOfRelationId') => 'instance',
180
+			$this->config->get('WBQualityConstraintsSubclassOfRelationId') => 'subclass',
181
+			$this->config->get('WBQualityConstraintsInstanceOrSubclassOfRelationId') => 'instanceOrSubclass',
182
+		], $relationId);
183 183
 	}
184 184
 
185 185
 	/**
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
 	 * @throws ConstraintParameterException
190 190
 	 * @return PropertyId
191 191
 	 */
192
-	private function parsePropertyIdParameter( array $snakSerialization, string $parameterId ): PropertyId {
193
-		$snak = $this->snakDeserializer->deserialize( $snakSerialization );
194
-		$this->requireValueParameter( $snak, $parameterId );
192
+	private function parsePropertyIdParameter(array $snakSerialization, string $parameterId): PropertyId {
193
+		$snak = $this->snakDeserializer->deserialize($snakSerialization);
194
+		$this->requireValueParameter($snak, $parameterId);
195 195
 		$value = $snak->getDataValue();
196
-		if ( $value instanceof EntityIdValue ) {
196
+		if ($value instanceof EntityIdValue) {
197 197
 			$id = $value->getEntityId();
198
-			if ( $id instanceof PropertyId ) {
198
+			if ($id instanceof PropertyId) {
199 199
 				return $id;
200 200
 			}
201 201
 		}
202 202
 		throw new ConstraintParameterException(
203
-			( new ViolationMessage( 'wbqc-violation-message-parameter-property' ) )
204
-				->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
205
-				->withDataValue( $value, Role::CONSTRAINT_PARAMETER_VALUE )
203
+			(new ViolationMessage('wbqc-violation-message-parameter-property'))
204
+				->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
205
+				->withDataValue($value, Role::CONSTRAINT_PARAMETER_VALUE)
206 206
 		);
207 207
 	}
208 208
 
@@ -213,33 +213,33 @@  discard block
 block discarded – undo
213 213
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
214 214
 	 * @return PropertyId
215 215
 	 */
216
-	public function parsePropertyParameter( array $constraintParameters, string $constraintTypeItemId ): PropertyId {
217
-		$this->checkError( $constraintParameters );
218
-		$propertyId = $this->config->get( 'WBQualityConstraintsPropertyId' );
219
-		if ( !array_key_exists( $propertyId, $constraintParameters ) ) {
216
+	public function parsePropertyParameter(array $constraintParameters, string $constraintTypeItemId): PropertyId {
217
+		$this->checkError($constraintParameters);
218
+		$propertyId = $this->config->get('WBQualityConstraintsPropertyId');
219
+		if (!array_key_exists($propertyId, $constraintParameters)) {
220 220
 			throw new ConstraintParameterException(
221
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
222
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
223
-					->withEntityId( new NumericPropertyId( $propertyId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
221
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
222
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
223
+					->withEntityId(new NumericPropertyId($propertyId), Role::CONSTRAINT_PARAMETER_PROPERTY)
224 224
 			);
225 225
 		}
226 226
 
227
-		$this->requireSingleParameter( $constraintParameters, $propertyId );
228
-		return $this->parsePropertyIdParameter( $constraintParameters[$propertyId][0], $propertyId );
227
+		$this->requireSingleParameter($constraintParameters, $propertyId);
228
+		return $this->parsePropertyIdParameter($constraintParameters[$propertyId][0], $propertyId);
229 229
 	}
230 230
 
231
-	private function parseItemIdParameter( PropertyValueSnak $snak, string $parameterId ): ItemIdSnakValue {
231
+	private function parseItemIdParameter(PropertyValueSnak $snak, string $parameterId): ItemIdSnakValue {
232 232
 		$dataValue = $snak->getDataValue();
233
-		if ( $dataValue instanceof EntityIdValue ) {
233
+		if ($dataValue instanceof EntityIdValue) {
234 234
 			$entityId = $dataValue->getEntityId();
235
-			if ( $entityId instanceof ItemId ) {
236
-				return ItemIdSnakValue::fromItemId( $entityId );
235
+			if ($entityId instanceof ItemId) {
236
+				return ItemIdSnakValue::fromItemId($entityId);
237 237
 			}
238 238
 		}
239 239
 		throw new ConstraintParameterException(
240
-			( new ViolationMessage( 'wbqc-violation-message-parameter-item' ) )
241
-				->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
242
-				->withDataValue( $dataValue, Role::CONSTRAINT_PARAMETER_VALUE )
240
+			(new ViolationMessage('wbqc-violation-message-parameter-item'))
241
+				->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
242
+				->withDataValue($dataValue, Role::CONSTRAINT_PARAMETER_VALUE)
243 243
 		);
244 244
 	}
245 245
 
@@ -257,16 +257,16 @@  discard block
 block discarded – undo
257 257
 		bool $required,
258 258
 		string $parameterId = null
259 259
 	): array {
260
-		$this->checkError( $constraintParameters );
261
-		if ( $parameterId === null ) {
262
-			$parameterId = $this->config->get( 'WBQualityConstraintsQualifierOfPropertyConstraintId' );
260
+		$this->checkError($constraintParameters);
261
+		if ($parameterId === null) {
262
+			$parameterId = $this->config->get('WBQualityConstraintsQualifierOfPropertyConstraintId');
263 263
 		}
264
-		if ( !array_key_exists( $parameterId, $constraintParameters ) ) {
265
-			if ( $required ) {
264
+		if (!array_key_exists($parameterId, $constraintParameters)) {
265
+			if ($required) {
266 266
 				throw new ConstraintParameterException(
267
-					( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
268
-						->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
269
-						->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
267
+					(new ViolationMessage('wbqc-violation-message-parameter-needed'))
268
+						->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
269
+						->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
270 270
 				);
271 271
 			} else {
272 272
 				return [];
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 		}
275 275
 
276 276
 		$values = [];
277
-		foreach ( $constraintParameters[$parameterId] as $parameter ) {
278
-			$snak = $this->snakDeserializer->deserialize( $parameter );
279
-			switch ( true ) {
277
+		foreach ($constraintParameters[$parameterId] as $parameter) {
278
+			$snak = $this->snakDeserializer->deserialize($parameter);
279
+			switch (true) {
280 280
 				case $snak instanceof PropertyValueSnak:
281
-					$values[] = $this->parseItemIdParameter( $snak, $parameterId );
281
+					$values[] = $this->parseItemIdParameter($snak, $parameterId);
282 282
 					break;
283 283
 				case $snak instanceof PropertySomeValueSnak:
284 284
 					$values[] = ItemIdSnakValue::someValue();
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
 		bool $required,
307 307
 		string $parameterId
308 308
 	): array {
309
-		return array_map( static function ( ItemIdSnakValue $value ) use ( $parameterId ): ItemId {
310
-			if ( $value->isValue() ) {
309
+		return array_map(static function(ItemIdSnakValue $value) use ($parameterId): ItemId {
310
+			if ($value->isValue()) {
311 311
 				return $value->getItemId();
312 312
 			} else {
313 313
 				throw new ConstraintParameterException(
314
-					( new ViolationMessage( 'wbqc-violation-message-parameter-value' ) )
315
-						->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
314
+					(new ViolationMessage('wbqc-violation-message-parameter-value'))
315
+						->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
316 316
 				);
317 317
 			}
318 318
 		}, $this->parseItemsParameter(
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			$constraintTypeItemId,
321 321
 			$required,
322 322
 			$parameterId
323
-		) );
323
+		));
324 324
 	}
325 325
 
326 326
 	/**
@@ -328,18 +328,18 @@  discard block
 block discarded – undo
328 328
 	 * @throws ConstraintParameterException
329 329
 	 * @return mixed elements of $mapping
330 330
 	 */
331
-	private function mapItemId( ItemId $itemId, array $mapping, string $parameterId ) {
331
+	private function mapItemId(ItemId $itemId, array $mapping, string $parameterId) {
332 332
 		$serialization = $itemId->getSerialization();
333
-		if ( array_key_exists( $serialization, $mapping ) ) {
333
+		if (array_key_exists($serialization, $mapping)) {
334 334
 			return $mapping[$serialization];
335 335
 		} else {
336
-			$allowed = array_map( static function ( $id ) {
337
-				return new ItemId( $id );
338
-			}, array_keys( $mapping ) );
336
+			$allowed = array_map(static function($id) {
337
+				return new ItemId($id);
338
+			}, array_keys($mapping));
339 339
 			throw new ConstraintParameterException(
340
-				( new ViolationMessage( 'wbqc-violation-message-parameter-oneof' ) )
341
-					->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
342
-					->withEntityIdList( $allowed, Role::CONSTRAINT_PARAMETER_VALUE )
340
+				(new ViolationMessage('wbqc-violation-message-parameter-oneof'))
341
+					->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
342
+					->withEntityIdList($allowed, Role::CONSTRAINT_PARAMETER_VALUE)
343 343
 			);
344 344
 		}
345 345
 	}
@@ -350,27 +350,27 @@  discard block
 block discarded – undo
350 350
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
351 351
 	 * @return PropertyId[]
352 352
 	 */
353
-	public function parsePropertiesParameter( array $constraintParameters, string $constraintTypeItemId ): array {
354
-		$this->checkError( $constraintParameters );
355
-		$propertyId = $this->config->get( 'WBQualityConstraintsPropertyId' );
356
-		if ( !array_key_exists( $propertyId, $constraintParameters ) ) {
353
+	public function parsePropertiesParameter(array $constraintParameters, string $constraintTypeItemId): array {
354
+		$this->checkError($constraintParameters);
355
+		$propertyId = $this->config->get('WBQualityConstraintsPropertyId');
356
+		if (!array_key_exists($propertyId, $constraintParameters)) {
357 357
 			throw new ConstraintParameterException(
358
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
359
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
360
-					->withEntityId( new NumericPropertyId( $propertyId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
358
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
359
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
360
+					->withEntityId(new NumericPropertyId($propertyId), Role::CONSTRAINT_PARAMETER_PROPERTY)
361 361
 			);
362 362
 		}
363 363
 
364 364
 		$parameters = $constraintParameters[$propertyId];
365
-		if ( count( $parameters ) === 1 &&
366
-			$this->snakDeserializer->deserialize( $parameters[0] ) instanceof PropertyNoValueSnak
365
+		if (count($parameters) === 1 &&
366
+			$this->snakDeserializer->deserialize($parameters[0]) instanceof PropertyNoValueSnak
367 367
 		) {
368 368
 			return [];
369 369
 		}
370 370
 
371 371
 		$properties = [];
372
-		foreach ( $parameters as $parameter ) {
373
-			$properties[] = $this->parsePropertyIdParameter( $parameter, $propertyId );
372
+		foreach ($parameters as $parameter) {
373
+			$properties[] = $this->parsePropertyIdParameter($parameter, $propertyId);
374 374
 		}
375 375
 		return $properties;
376 376
 	}
@@ -378,24 +378,24 @@  discard block
 block discarded – undo
378 378
 	/**
379 379
 	 * @throws ConstraintParameterException
380 380
 	 */
381
-	private function parseValueOrNoValueParameter( array $snakSerialization, string $parameterId ): ?DataValue {
382
-		$snak = $this->snakDeserializer->deserialize( $snakSerialization );
383
-		if ( $snak instanceof PropertyValueSnak ) {
381
+	private function parseValueOrNoValueParameter(array $snakSerialization, string $parameterId): ?DataValue {
382
+		$snak = $this->snakDeserializer->deserialize($snakSerialization);
383
+		if ($snak instanceof PropertyValueSnak) {
384 384
 			return $snak->getDataValue();
385
-		} elseif ( $snak instanceof PropertyNoValueSnak ) {
385
+		} elseif ($snak instanceof PropertyNoValueSnak) {
386 386
 			return null;
387 387
 		} else {
388 388
 			throw new ConstraintParameterException(
389
-				( new ViolationMessage( 'wbqc-violation-message-parameter-value-or-novalue' ) )
390
-					->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
389
+				(new ViolationMessage('wbqc-violation-message-parameter-value-or-novalue'))
390
+					->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
391 391
 			);
392 392
 		}
393 393
 	}
394 394
 
395
-	private function parseValueOrNoValueOrNowParameter( array $snakSerialization, string $parameterId ): ?DataValue {
395
+	private function parseValueOrNoValueOrNowParameter(array $snakSerialization, string $parameterId): ?DataValue {
396 396
 		try {
397
-			return $this->parseValueOrNoValueParameter( $snakSerialization, $parameterId );
398
-		} catch ( ConstraintParameterException $e ) {
397
+			return $this->parseValueOrNoValueParameter($snakSerialization, $parameterId);
398
+		} catch (ConstraintParameterException $e) {
399 399
 			// unknown value means “now”
400 400
 			return new NowValue();
401 401
 		}
@@ -404,14 +404,14 @@  discard block
 block discarded – undo
404 404
 	/**
405 405
 	 * Checks whether there is exactly one non-null quantity with the given unit.
406 406
 	 */
407
-	private function exactlyOneQuantityWithUnit( ?DataValue $min, ?DataValue $max, string $unit ): bool {
408
-		if ( !( $min instanceof UnboundedQuantityValue ) ||
409
-			!( $max instanceof UnboundedQuantityValue )
407
+	private function exactlyOneQuantityWithUnit(?DataValue $min, ?DataValue $max, string $unit): bool {
408
+		if (!($min instanceof UnboundedQuantityValue) ||
409
+			!($max instanceof UnboundedQuantityValue)
410 410
 		) {
411 411
 			return false;
412 412
 		}
413 413
 
414
-		return ( $min->getUnit() === $unit ) !== ( $max->getUnit() === $unit );
414
+		return ($min->getUnit() === $unit) !== ($max->getUnit() === $unit);
415 415
 	}
416 416
 
417 417
 	/**
@@ -431,41 +431,41 @@  discard block
 block discarded – undo
431 431
 		string $constraintTypeItemId,
432 432
 		string $type
433 433
 	): array {
434
-		$this->checkError( $constraintParameters );
435
-		if ( !array_key_exists( $minimumId, $constraintParameters ) ||
436
-			!array_key_exists( $maximumId, $constraintParameters )
434
+		$this->checkError($constraintParameters);
435
+		if (!array_key_exists($minimumId, $constraintParameters) ||
436
+			!array_key_exists($maximumId, $constraintParameters)
437 437
 		) {
438 438
 			throw new ConstraintParameterException(
439
-				( new ViolationMessage( 'wbqc-violation-message-range-parameters-needed' ) )
440
-					->withDataValueType( $type )
441
-					->withEntityId( new NumericPropertyId( $minimumId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
442
-					->withEntityId( new NumericPropertyId( $maximumId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
443
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
439
+				(new ViolationMessage('wbqc-violation-message-range-parameters-needed'))
440
+					->withDataValueType($type)
441
+					->withEntityId(new NumericPropertyId($minimumId), Role::CONSTRAINT_PARAMETER_PROPERTY)
442
+					->withEntityId(new NumericPropertyId($maximumId), Role::CONSTRAINT_PARAMETER_PROPERTY)
443
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
444 444
 			);
445 445
 		}
446 446
 
447
-		$this->requireSingleParameter( $constraintParameters, $minimumId );
448
-		$this->requireSingleParameter( $constraintParameters, $maximumId );
447
+		$this->requireSingleParameter($constraintParameters, $minimumId);
448
+		$this->requireSingleParameter($constraintParameters, $maximumId);
449 449
 		$parseFunction = $type === 'time' ? 'parseValueOrNoValueOrNowParameter' : 'parseValueOrNoValueParameter';
450
-		$min = $this->$parseFunction( $constraintParameters[$minimumId][0], $minimumId );
451
-		$max = $this->$parseFunction( $constraintParameters[$maximumId][0], $maximumId );
450
+		$min = $this->$parseFunction($constraintParameters[$minimumId][0], $minimumId);
451
+		$max = $this->$parseFunction($constraintParameters[$maximumId][0], $maximumId);
452 452
 
453
-		$yearUnit = $this->config->get( 'WBQualityConstraintsYearUnit' );
454
-		if ( $this->exactlyOneQuantityWithUnit( $min, $max, $yearUnit ) ) {
453
+		$yearUnit = $this->config->get('WBQualityConstraintsYearUnit');
454
+		if ($this->exactlyOneQuantityWithUnit($min, $max, $yearUnit)) {
455 455
 			throw new ConstraintParameterException(
456
-				new ViolationMessage( 'wbqc-violation-message-range-parameters-one-year' )
456
+				new ViolationMessage('wbqc-violation-message-range-parameters-one-year')
457 457
 			);
458 458
 		}
459
-		if ( $min === null && $max === null ||
460
-			$min !== null && $max !== null && $min->equals( $max ) ) {
459
+		if ($min === null && $max === null ||
460
+			$min !== null && $max !== null && $min->equals($max)) {
461 461
 			throw new ConstraintParameterException(
462
-				( new ViolationMessage( 'wbqc-violation-message-range-parameters-same' ) )
463
-					->withEntityId( new NumericPropertyId( $minimumId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
464
-					->withEntityId( new NumericPropertyId( $maximumId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
462
+				(new ViolationMessage('wbqc-violation-message-range-parameters-same'))
463
+					->withEntityId(new NumericPropertyId($minimumId), Role::CONSTRAINT_PARAMETER_PROPERTY)
464
+					->withEntityId(new NumericPropertyId($maximumId), Role::CONSTRAINT_PARAMETER_PROPERTY)
465 465
 			);
466 466
 		}
467 467
 
468
-		return [ $min, $max ];
468
+		return [$min, $max];
469 469
 	}
470 470
 
471 471
 	/**
@@ -475,11 +475,11 @@  discard block
 block discarded – undo
475 475
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
476 476
 	 * @return DataValue[] a pair of two data values, either of which may be null to signify an open range
477 477
 	 */
478
-	public function parseQuantityRangeParameter( array $constraintParameters, string $constraintTypeItemId ): array {
478
+	public function parseQuantityRangeParameter(array $constraintParameters, string $constraintTypeItemId): array {
479 479
 		return $this->parseRangeParameter(
480 480
 			$constraintParameters,
481
-			$this->config->get( 'WBQualityConstraintsMinimumQuantityId' ),
482
-			$this->config->get( 'WBQualityConstraintsMaximumQuantityId' ),
481
+			$this->config->get('WBQualityConstraintsMinimumQuantityId'),
482
+			$this->config->get('WBQualityConstraintsMaximumQuantityId'),
483 483
 			$constraintTypeItemId,
484 484
 			'quantity'
485 485
 		);
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
493 493
 	 * @return DataValue[] a pair of two data values, either of which may be null to signify an open range
494 494
 	 */
495
-	public function parseTimeRangeParameter( array $constraintParameters, string $constraintTypeItemId ): array {
495
+	public function parseTimeRangeParameter(array $constraintParameters, string $constraintTypeItemId): array {
496 496
 		return $this->parseRangeParameter(
497 497
 			$constraintParameters,
498
-			$this->config->get( 'WBQualityConstraintsMinimumDateId' ),
499
-			$this->config->get( 'WBQualityConstraintsMaximumDateId' ),
498
+			$this->config->get('WBQualityConstraintsMinimumDateId'),
499
+			$this->config->get('WBQualityConstraintsMaximumDateId'),
500 500
 			$constraintTypeItemId,
501 501
 			'time'
502 502
 		);
@@ -509,20 +509,20 @@  discard block
 block discarded – undo
509 509
 	 * @throws ConstraintParameterException
510 510
 	 * @return string[]
511 511
 	 */
512
-	public function parseLanguageParameter( array $constraintParameters, string $constraintTypeItemId ): array {
513
-		$this->checkError( $constraintParameters );
514
-		$languagePropertyId = $this->config->get( 'WBQualityConstraintsLanguagePropertyId' );
515
-		if ( !array_key_exists( $languagePropertyId, $constraintParameters ) ) {
512
+	public function parseLanguageParameter(array $constraintParameters, string $constraintTypeItemId): array {
513
+		$this->checkError($constraintParameters);
514
+		$languagePropertyId = $this->config->get('WBQualityConstraintsLanguagePropertyId');
515
+		if (!array_key_exists($languagePropertyId, $constraintParameters)) {
516 516
 			throw new ConstraintParameterException(
517
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
518
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
519
-					->withEntityId( new NumericPropertyId( $languagePropertyId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
517
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
518
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
519
+					->withEntityId(new NumericPropertyId($languagePropertyId), Role::CONSTRAINT_PARAMETER_PROPERTY)
520 520
 			);
521 521
 		}
522 522
 
523 523
 		$languages = [];
524
-		foreach ( $constraintParameters[$languagePropertyId] as $snak ) {
525
-			$languages[] = $this->parseStringParameter( $snak, $languagePropertyId );
524
+		foreach ($constraintParameters[$languagePropertyId] as $snak) {
525
+			$languages[] = $this->parseStringParameter($snak, $languagePropertyId);
526 526
 		}
527 527
 		return $languages;
528 528
 	}
@@ -531,17 +531,17 @@  discard block
 block discarded – undo
531 531
 	 * Parse a single string parameter.
532 532
 	 * @throws ConstraintParameterException
533 533
 	 */
534
-	private function parseStringParameter( array $snakSerialization, string $parameterId ): string {
535
-		$snak = $this->snakDeserializer->deserialize( $snakSerialization );
536
-		$this->requireValueParameter( $snak, $parameterId );
534
+	private function parseStringParameter(array $snakSerialization, string $parameterId): string {
535
+		$snak = $this->snakDeserializer->deserialize($snakSerialization);
536
+		$this->requireValueParameter($snak, $parameterId);
537 537
 		$value = $snak->getDataValue();
538
-		if ( $value instanceof StringValue ) {
538
+		if ($value instanceof StringValue) {
539 539
 			return $value->getValue();
540 540
 		} else {
541 541
 			throw new ConstraintParameterException(
542
-				( new ViolationMessage( 'wbqc-violation-message-parameter-string' ) )
543
-					->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
544
-					->withDataValue( $value, Role::CONSTRAINT_PARAMETER_VALUE )
542
+				(new ViolationMessage('wbqc-violation-message-parameter-string'))
543
+					->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
544
+					->withDataValue($value, Role::CONSTRAINT_PARAMETER_VALUE)
545 545
 			);
546 546
 		}
547 547
 	}
@@ -552,15 +552,15 @@  discard block
 block discarded – undo
552 552
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
553 553
 	 * @return string
554 554
 	 */
555
-	public function parseNamespaceParameter( array $constraintParameters, string $constraintTypeItemId ): string {
556
-		$this->checkError( $constraintParameters );
557
-		$namespaceId = $this->config->get( 'WBQualityConstraintsNamespaceId' );
558
-		if ( !array_key_exists( $namespaceId, $constraintParameters ) ) {
555
+	public function parseNamespaceParameter(array $constraintParameters, string $constraintTypeItemId): string {
556
+		$this->checkError($constraintParameters);
557
+		$namespaceId = $this->config->get('WBQualityConstraintsNamespaceId');
558
+		if (!array_key_exists($namespaceId, $constraintParameters)) {
559 559
 			return '';
560 560
 		}
561 561
 
562
-		$this->requireSingleParameter( $constraintParameters, $namespaceId );
563
-		return $this->parseStringParameter( $constraintParameters[$namespaceId][0], $namespaceId );
562
+		$this->requireSingleParameter($constraintParameters, $namespaceId);
563
+		return $this->parseStringParameter($constraintParameters[$namespaceId][0], $namespaceId);
564 564
 	}
565 565
 
566 566
 	/**
@@ -569,19 +569,19 @@  discard block
 block discarded – undo
569 569
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
570 570
 	 * @return string
571 571
 	 */
572
-	public function parseFormatParameter( array $constraintParameters, string $constraintTypeItemId ): string {
573
-		$this->checkError( $constraintParameters );
574
-		$formatId = $this->config->get( 'WBQualityConstraintsFormatAsARegularExpressionId' );
575
-		if ( !array_key_exists( $formatId, $constraintParameters ) ) {
572
+	public function parseFormatParameter(array $constraintParameters, string $constraintTypeItemId): string {
573
+		$this->checkError($constraintParameters);
574
+		$formatId = $this->config->get('WBQualityConstraintsFormatAsARegularExpressionId');
575
+		if (!array_key_exists($formatId, $constraintParameters)) {
576 576
 			throw new ConstraintParameterException(
577
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
578
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
579
-					->withEntityId( new NumericPropertyId( $formatId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
577
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
578
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
579
+					->withEntityId(new NumericPropertyId($formatId), Role::CONSTRAINT_PARAMETER_PROPERTY)
580 580
 			);
581 581
 		}
582 582
 
583
-		$this->requireSingleParameter( $constraintParameters, $formatId );
584
-		return $this->parseStringParameter( $constraintParameters[$formatId][0], $formatId );
583
+		$this->requireSingleParameter($constraintParameters, $formatId);
584
+		return $this->parseStringParameter($constraintParameters[$formatId][0], $formatId);
585 585
 	}
586 586
 
587 587
 	/**
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
 	 * @throws ConstraintParameterException if the parameter is invalid
590 590
 	 * @return EntityId[]
591 591
 	 */
592
-	public function parseExceptionParameter( array $constraintParameters ): array {
593
-		$this->checkError( $constraintParameters );
594
-		$exceptionId = $this->config->get( 'WBQualityConstraintsExceptionToConstraintId' );
595
-		if ( !array_key_exists( $exceptionId, $constraintParameters ) ) {
592
+	public function parseExceptionParameter(array $constraintParameters): array {
593
+		$this->checkError($constraintParameters);
594
+		$exceptionId = $this->config->get('WBQualityConstraintsExceptionToConstraintId');
595
+		if (!array_key_exists($exceptionId, $constraintParameters)) {
596 596
 			return [];
597 597
 		}
598 598
 
599 599
 		return array_map(
600
-			function ( $snakSerialization ) use ( $exceptionId ) {
601
-				return $this->parseEntityIdParameter( $snakSerialization, $exceptionId );
600
+			function($snakSerialization) use ($exceptionId) {
601
+				return $this->parseEntityIdParameter($snakSerialization, $exceptionId);
602 602
 			},
603 603
 			$constraintParameters[$exceptionId]
604 604
 		);
@@ -609,39 +609,39 @@  discard block
 block discarded – undo
609 609
 	 * @throws ConstraintParameterException if the parameter is invalid
610 610
 	 * @return string|null 'mandatory', 'suggestion' or null
611 611
 	 */
612
-	public function parseConstraintStatusParameter( array $constraintParameters ): ?string {
613
-		$this->checkError( $constraintParameters );
614
-		$constraintStatusId = $this->config->get( 'WBQualityConstraintsConstraintStatusId' );
615
-		if ( !array_key_exists( $constraintStatusId, $constraintParameters ) ) {
612
+	public function parseConstraintStatusParameter(array $constraintParameters): ?string {
613
+		$this->checkError($constraintParameters);
614
+		$constraintStatusId = $this->config->get('WBQualityConstraintsConstraintStatusId');
615
+		if (!array_key_exists($constraintStatusId, $constraintParameters)) {
616 616
 			return null;
617 617
 		}
618 618
 
619
-		$mandatoryId = $this->config->get( 'WBQualityConstraintsMandatoryConstraintId' );
620
-		$supportedStatuses = [ new ItemId( $mandatoryId ) ];
621
-		if ( $this->config->get( 'WBQualityConstraintsEnableSuggestionConstraintStatus' ) ) {
622
-			$suggestionId = $this->config->get( 'WBQualityConstraintsSuggestionConstraintId' );
623
-			$supportedStatuses[] = new ItemId( $suggestionId );
619
+		$mandatoryId = $this->config->get('WBQualityConstraintsMandatoryConstraintId');
620
+		$supportedStatuses = [new ItemId($mandatoryId)];
621
+		if ($this->config->get('WBQualityConstraintsEnableSuggestionConstraintStatus')) {
622
+			$suggestionId = $this->config->get('WBQualityConstraintsSuggestionConstraintId');
623
+			$supportedStatuses[] = new ItemId($suggestionId);
624 624
 		} else {
625 625
 			$suggestionId = null;
626 626
 		}
627 627
 
628
-		$this->requireSingleParameter( $constraintParameters, $constraintStatusId );
629
-		$snak = $this->snakDeserializer->deserialize( $constraintParameters[$constraintStatusId][0] );
630
-		$this->requireValueParameter( $snak, $constraintStatusId );
628
+		$this->requireSingleParameter($constraintParameters, $constraintStatusId);
629
+		$snak = $this->snakDeserializer->deserialize($constraintParameters[$constraintStatusId][0]);
630
+		$this->requireValueParameter($snak, $constraintStatusId);
631 631
 		'@phan-var \Wikibase\DataModel\Snak\PropertyValueSnak $snak';
632 632
 		$dataValue = $snak->getDataValue();
633 633
 		'@phan-var EntityIdValue $dataValue';
634 634
 		$entityId = $dataValue->getEntityId();
635 635
 		$statusId = $entityId->getSerialization();
636 636
 
637
-		if ( $statusId === $mandatoryId ) {
637
+		if ($statusId === $mandatoryId) {
638 638
 			return 'mandatory';
639
-		} elseif ( $statusId === $suggestionId ) {
639
+		} elseif ($statusId === $suggestionId) {
640 640
 			return 'suggestion';
641 641
 		} else {
642 642
 			throw new ConstraintParameterException(
643
-				( new ViolationMessage( 'wbqc-violation-message-parameter-oneof' ) )
644
-					->withEntityId( new NumericPropertyId( $constraintStatusId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
643
+				(new ViolationMessage('wbqc-violation-message-parameter-oneof'))
644
+					->withEntityId(new NumericPropertyId($constraintStatusId), Role::CONSTRAINT_PARAMETER_PROPERTY)
645 645
 					->withEntityIdList(
646 646
 						$supportedStatuses,
647 647
 						Role::CONSTRAINT_PARAMETER_VALUE
@@ -654,12 +654,12 @@  discard block
 block discarded – undo
654 654
 	 * Require that $dataValue is a {@link MonolingualTextValue}.
655 655
 	 * @throws ConstraintParameterException
656 656
 	 */
657
-	private function requireMonolingualTextParameter( DataValue $dataValue, string $parameterId ): void {
658
-		if ( !( $dataValue instanceof MonolingualTextValue ) ) {
657
+	private function requireMonolingualTextParameter(DataValue $dataValue, string $parameterId): void {
658
+		if (!($dataValue instanceof MonolingualTextValue)) {
659 659
 			throw new ConstraintParameterException(
660
-				( new ViolationMessage( 'wbqc-violation-message-parameter-monolingualtext' ) )
661
-					->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
662
-					->withDataValue( $dataValue, Role::CONSTRAINT_PARAMETER_VALUE )
660
+				(new ViolationMessage('wbqc-violation-message-parameter-monolingualtext'))
661
+					->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
662
+					->withDataValue($dataValue, Role::CONSTRAINT_PARAMETER_VALUE)
663 663
 			);
664 664
 		}
665 665
 	}
@@ -669,31 +669,31 @@  discard block
 block discarded – undo
669 669
 	 *
670 670
 	 * @throws ConstraintParameterException if invalid snaks are found or a language has multiple texts
671 671
 	 */
672
-	private function parseMultilingualTextParameter( array $snakSerializations, string $parameterId ): MultilingualTextValue {
672
+	private function parseMultilingualTextParameter(array $snakSerializations, string $parameterId): MultilingualTextValue {
673 673
 		$result = [];
674 674
 
675
-		foreach ( $snakSerializations as $snakSerialization ) {
676
-			$snak = $this->snakDeserializer->deserialize( $snakSerialization );
677
-			$this->requireValueParameter( $snak, $parameterId );
675
+		foreach ($snakSerializations as $snakSerialization) {
676
+			$snak = $this->snakDeserializer->deserialize($snakSerialization);
677
+			$this->requireValueParameter($snak, $parameterId);
678 678
 
679 679
 			$value = $snak->getDataValue();
680
-			$this->requireMonolingualTextParameter( $value, $parameterId );
680
+			$this->requireMonolingualTextParameter($value, $parameterId);
681 681
 			/** @var MonolingualTextValue $value */
682 682
 			'@phan-var MonolingualTextValue $value';
683 683
 
684 684
 			$code = $value->getLanguageCode();
685
-			if ( array_key_exists( $code, $result ) ) {
685
+			if (array_key_exists($code, $result)) {
686 686
 				throw new ConstraintParameterException(
687
-					( new ViolationMessage( 'wbqc-violation-message-parameter-single-per-language' ) )
688
-						->withEntityId( new NumericPropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
689
-						->withLanguage( $code )
687
+					(new ViolationMessage('wbqc-violation-message-parameter-single-per-language'))
688
+						->withEntityId(new NumericPropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
689
+						->withLanguage($code)
690 690
 				);
691 691
 			}
692 692
 
693 693
 			$result[$code] = $value;
694 694
 		}
695 695
 
696
-		return new MultilingualTextValue( $result );
696
+		return new MultilingualTextValue($result);
697 697
 	}
698 698
 
699 699
 	/**
@@ -701,11 +701,11 @@  discard block
 block discarded – undo
701 701
 	 * @throws ConstraintParameterException if the parameter is invalid
702 702
 	 * @return MultilingualTextValue
703 703
 	 */
704
-	public function parseSyntaxClarificationParameter( array $constraintParameters ): MultilingualTextValue {
705
-		$syntaxClarificationId = $this->config->get( 'WBQualityConstraintsSyntaxClarificationId' );
704
+	public function parseSyntaxClarificationParameter(array $constraintParameters): MultilingualTextValue {
705
+		$syntaxClarificationId = $this->config->get('WBQualityConstraintsSyntaxClarificationId');
706 706
 
707
-		if ( !array_key_exists( $syntaxClarificationId, $constraintParameters ) ) {
708
-			return new MultilingualTextValue( [] );
707
+		if (!array_key_exists($syntaxClarificationId, $constraintParameters)) {
708
+			return new MultilingualTextValue([]);
709 709
 		}
710 710
 
711 711
 		$syntaxClarifications = $this->parseMultilingualTextParameter(
@@ -738,14 +738,14 @@  discard block
 block discarded – undo
738 738
 		array $validContextTypes,
739 739
 		array $validEntityTypes
740 740
 	): array {
741
-		$contextTypeParameterId = $this->config->get( 'WBQualityConstraintsConstraintScopeId' );
741
+		$contextTypeParameterId = $this->config->get('WBQualityConstraintsConstraintScopeId');
742 742
 		$contextTypeItemIds = $this->parseItemIdsParameter(
743 743
 			$constraintParameters,
744 744
 			$constraintTypeItemId,
745 745
 			false,
746 746
 			$contextTypeParameterId
747 747
 		);
748
-		$entityTypeParameterId = $this->config->get( 'WBQualityConstraintsConstraintEntityTypesId' );
748
+		$entityTypeParameterId = $this->config->get('WBQualityConstraintsConstraintEntityTypesId');
749 749
 		$entityTypeItemIds = $this->parseItemIdsParameter(
750 750
 			$constraintParameters,
751 751
 			$constraintTypeItemId,
@@ -761,26 +761,26 @@  discard block
 block discarded – undo
761 761
 		$contextTypes = null;
762 762
 		$entityTypes = null;
763 763
 
764
-		if ( $contextTypeParameterId === $entityTypeParameterId ) {
764
+		if ($contextTypeParameterId === $entityTypeParameterId) {
765 765
 			$itemIds = $contextTypeItemIds;
766 766
 			$mapping = $contextTypeMapping + $entityTypeMapping;
767
-			foreach ( $itemIds as $itemId ) {
768
-				$mapped = $this->mapItemId( $itemId, $mapping, $contextTypeParameterId );
769
-				if ( in_array( $mapped, $contextTypeMapping, true ) ) {
767
+			foreach ($itemIds as $itemId) {
768
+				$mapped = $this->mapItemId($itemId, $mapping, $contextTypeParameterId);
769
+				if (in_array($mapped, $contextTypeMapping, true)) {
770 770
 					$contextTypes[] = $mapped;
771 771
 				} else {
772 772
 					$entityTypes[] = $mapped;
773 773
 				}
774 774
 			}
775 775
 		} else {
776
-			foreach ( $contextTypeItemIds as $contextTypeItemId ) {
776
+			foreach ($contextTypeItemIds as $contextTypeItemId) {
777 777
 				$contextTypes[] = $this->mapItemId(
778 778
 					$contextTypeItemId,
779 779
 					$contextTypeMapping,
780 780
 					$contextTypeParameterId
781 781
 				);
782 782
 			}
783
-			foreach ( $entityTypeItemIds as $entityTypeItemId ) {
783
+			foreach ($entityTypeItemIds as $entityTypeItemId) {
784 784
 				$entityTypes[] = $this->mapItemId(
785 785
 					$entityTypeItemId,
786 786
 					$entityTypeMapping,
@@ -789,21 +789,21 @@  discard block
 block discarded – undo
789 789
 			}
790 790
 		}
791 791
 
792
-		$this->checkValidScope( $constraintTypeItemId, $contextTypes, $validContextTypes );
793
-		$this->checkValidScope( $constraintTypeItemId, $entityTypes, $validEntityTypes );
792
+		$this->checkValidScope($constraintTypeItemId, $contextTypes, $validContextTypes);
793
+		$this->checkValidScope($constraintTypeItemId, $entityTypes, $validEntityTypes);
794 794
 
795
-		return [ $contextTypes, $entityTypes ];
795
+		return [$contextTypes, $entityTypes];
796 796
 	}
797 797
 
798
-	private function checkValidScope( string $constraintTypeItemId, ?array $types, array $validTypes ): void {
799
-		$invalidTypes = array_diff( $types ?: [], $validTypes );
800
-		if ( $invalidTypes !== [] ) {
801
-			$invalidType = array_pop( $invalidTypes );
798
+	private function checkValidScope(string $constraintTypeItemId, ?array $types, array $validTypes): void {
799
+		$invalidTypes = array_diff($types ?: [], $validTypes);
800
+		if ($invalidTypes !== []) {
801
+			$invalidType = array_pop($invalidTypes);
802 802
 			throw new ConstraintParameterException(
803
-				( new ViolationMessage( 'wbqc-violation-message-invalid-scope' ) )
804
-					->withConstraintScope( $invalidType, Role::CONSTRAINT_PARAMETER_VALUE )
805
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
806
-					->withConstraintScopeList( $validTypes, Role::CONSTRAINT_PARAMETER_VALUE )
803
+				(new ViolationMessage('wbqc-violation-message-invalid-scope'))
804
+					->withConstraintScope($invalidType, Role::CONSTRAINT_PARAMETER_VALUE)
805
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
806
+					->withConstraintScopeList($validTypes, Role::CONSTRAINT_PARAMETER_VALUE)
807 807
 			);
808 808
 		}
809 809
 	}
@@ -811,8 +811,8 @@  discard block
 block discarded – undo
811 811
 	/**
812 812
 	 * Turn an item ID into a full unit string (using the concept URI).
813 813
 	 */
814
-	private function parseUnitParameter( ItemId $unitId ): string {
815
-		return $this->unitItemConceptBaseUri . $unitId->getSerialization();
814
+	private function parseUnitParameter(ItemId $unitId): string {
815
+		return $this->unitItemConceptBaseUri.$unitId->getSerialization();
816 816
 	}
817 817
 
818 818
 	/**
@@ -820,23 +820,23 @@  discard block
 block discarded – undo
820 820
 	 *
821 821
 	 * @throws ConstraintParameterException
822 822
 	 */
823
-	private function parseUnitItem( ItemIdSnakValue $item ): UnitsParameter {
824
-		switch ( true ) {
823
+	private function parseUnitItem(ItemIdSnakValue $item): UnitsParameter {
824
+		switch (true) {
825 825
 			case $item->isValue():
826
-				$unit = $this->parseUnitParameter( $item->getItemId() );
826
+				$unit = $this->parseUnitParameter($item->getItemId());
827 827
 				return new UnitsParameter(
828
-					[ $item->getItemId() ],
829
-					[ UnboundedQuantityValue::newFromNumber( 1, $unit ) ],
828
+					[$item->getItemId()],
829
+					[UnboundedQuantityValue::newFromNumber(1, $unit)],
830 830
 					false
831 831
 				);
832 832
 			case $item->isSomeValue():
833
-				$qualifierId = $this->config->get( 'WBQualityConstraintsQualifierOfPropertyConstraintId' );
833
+				$qualifierId = $this->config->get('WBQualityConstraintsQualifierOfPropertyConstraintId');
834 834
 				throw new ConstraintParameterException(
835
-					( new ViolationMessage( 'wbqc-violation-message-parameter-value-or-novalue' ) )
836
-						->withEntityId( new NumericPropertyId( $qualifierId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
835
+					(new ViolationMessage('wbqc-violation-message-parameter-value-or-novalue'))
836
+						->withEntityId(new NumericPropertyId($qualifierId), Role::CONSTRAINT_PARAMETER_PROPERTY)
837 837
 				);
838 838
 			case $item->isNoValue():
839
-				return new UnitsParameter( [], [], true );
839
+				return new UnitsParameter([], [], true);
840 840
 		}
841 841
 	}
842 842
 
@@ -846,36 +846,36 @@  discard block
 block discarded – undo
846 846
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
847 847
 	 * @return UnitsParameter
848 848
 	 */
849
-	public function parseUnitsParameter( array $constraintParameters, string $constraintTypeItemId ): UnitsParameter {
850
-		$items = $this->parseItemsParameter( $constraintParameters, $constraintTypeItemId, true );
849
+	public function parseUnitsParameter(array $constraintParameters, string $constraintTypeItemId): UnitsParameter {
850
+		$items = $this->parseItemsParameter($constraintParameters, $constraintTypeItemId, true);
851 851
 		$unitItems = [];
852 852
 		$unitQuantities = [];
853 853
 		$unitlessAllowed = false;
854 854
 
855
-		foreach ( $items as $item ) {
856
-			$unit = $this->parseUnitItem( $item );
857
-			$unitItems = array_merge( $unitItems, $unit->getUnitItemIds() );
858
-			$unitQuantities = array_merge( $unitQuantities, $unit->getUnitQuantities() );
855
+		foreach ($items as $item) {
856
+			$unit = $this->parseUnitItem($item);
857
+			$unitItems = array_merge($unitItems, $unit->getUnitItemIds());
858
+			$unitQuantities = array_merge($unitQuantities, $unit->getUnitQuantities());
859 859
 			$unitlessAllowed = $unitlessAllowed || $unit->getUnitlessAllowed();
860 860
 		}
861 861
 
862
-		if ( $unitQuantities === [] && !$unitlessAllowed ) {
862
+		if ($unitQuantities === [] && !$unitlessAllowed) {
863 863
 			throw new LogicException(
864 864
 				'The "units" parameter is required, and yet we seem to be missing any allowed unit'
865 865
 			);
866 866
 		}
867 867
 
868
-		return new UnitsParameter( $unitItems, $unitQuantities, $unitlessAllowed );
868
+		return new UnitsParameter($unitItems, $unitQuantities, $unitlessAllowed);
869 869
 	}
870 870
 
871 871
 	private function getEntityTypeMapping(): array {
872 872
 		return [
873
-			$this->config->get( 'WBQualityConstraintsWikibaseItemId' ) => 'item',
874
-			$this->config->get( 'WBQualityConstraintsWikibasePropertyId' ) => 'property',
875
-			$this->config->get( 'WBQualityConstraintsWikibaseLexemeId' ) => 'lexeme',
876
-			$this->config->get( 'WBQualityConstraintsWikibaseFormId' ) => 'form',
877
-			$this->config->get( 'WBQualityConstraintsWikibaseSenseId' ) => 'sense',
878
-			$this->config->get( 'WBQualityConstraintsWikibaseMediaInfoId' ) => 'mediainfo',
873
+			$this->config->get('WBQualityConstraintsWikibaseItemId') => 'item',
874
+			$this->config->get('WBQualityConstraintsWikibasePropertyId') => 'property',
875
+			$this->config->get('WBQualityConstraintsWikibaseLexemeId') => 'lexeme',
876
+			$this->config->get('WBQualityConstraintsWikibaseFormId') => 'form',
877
+			$this->config->get('WBQualityConstraintsWikibaseSenseId') => 'sense',
878
+			$this->config->get('WBQualityConstraintsWikibaseMediaInfoId') => 'mediainfo',
879 879
 		];
880 880
 	}
881 881
 
@@ -885,10 +885,10 @@  discard block
 block discarded – undo
885 885
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
886 886
 	 * @return EntityTypesParameter
887 887
 	 */
888
-	public function parseEntityTypesParameter( array $constraintParameters, string $constraintTypeItemId ): EntityTypesParameter {
888
+	public function parseEntityTypesParameter(array $constraintParameters, string $constraintTypeItemId): EntityTypesParameter {
889 889
 		$entityTypes = [];
890 890
 		$entityTypeItemIds = [];
891
-		$parameterId = $this->config->get( 'WBQualityConstraintsQualifierOfPropertyConstraintId' );
891
+		$parameterId = $this->config->get('WBQualityConstraintsQualifierOfPropertyConstraintId');
892 892
 		$itemIds = $this->parseItemIdsParameter(
893 893
 			$constraintParameters,
894 894
 			$constraintTypeItemId,
@@ -897,22 +897,22 @@  discard block
 block discarded – undo
897 897
 		);
898 898
 
899 899
 		$mapping = $this->getEntityTypeMapping();
900
-		foreach ( $itemIds as $itemId ) {
901
-			$entityType = $this->mapItemId( $itemId, $mapping, $parameterId );
900
+		foreach ($itemIds as $itemId) {
901
+			$entityType = $this->mapItemId($itemId, $mapping, $parameterId);
902 902
 			$entityTypes[] = $entityType;
903 903
 			$entityTypeItemIds[] = $itemId;
904 904
 		}
905 905
 
906
-		if ( empty( $entityTypes ) ) {
906
+		if (empty($entityTypes)) {
907 907
 			// @codeCoverageIgnoreStart
908 908
 			throw new LogicException(
909
-				'The "entity types" parameter is required, ' .
909
+				'The "entity types" parameter is required, '.
910 910
 				'and yet we seem to be missing any allowed entity type'
911 911
 			);
912 912
 			// @codeCoverageIgnoreEnd
913 913
 		}
914 914
 
915
-		return new EntityTypesParameter( $entityTypes, $entityTypeItemIds );
915
+		return new EntityTypesParameter($entityTypes, $entityTypeItemIds);
916 916
 	}
917 917
 
918 918
 	/**
@@ -920,18 +920,18 @@  discard block
 block discarded – undo
920 920
 	 * @throws ConstraintParameterException if the parameter is invalid
921 921
 	 * @return PropertyId[]
922 922
 	 */
923
-	public function parseSeparatorsParameter( array $constraintParameters ): array {
924
-		$separatorId = $this->config->get( 'WBQualityConstraintsSeparatorId' );
923
+	public function parseSeparatorsParameter(array $constraintParameters): array {
924
+		$separatorId = $this->config->get('WBQualityConstraintsSeparatorId');
925 925
 
926
-		if ( !array_key_exists( $separatorId, $constraintParameters ) ) {
926
+		if (!array_key_exists($separatorId, $constraintParameters)) {
927 927
 			return [];
928 928
 		}
929 929
 
930 930
 		$parameters = $constraintParameters[$separatorId];
931 931
 		$separators = [];
932 932
 
933
-		foreach ( $parameters as $parameter ) {
934
-			$separators[] = $this->parsePropertyIdParameter( $parameter, $separatorId );
933
+		foreach ($parameters as $parameter) {
934
+			$separators[] = $this->parsePropertyIdParameter($parameter, $separatorId);
935 935
 		}
936 936
 
937 937
 		return $separators;
@@ -939,17 +939,17 @@  discard block
 block discarded – undo
939 939
 
940 940
 	private function getConstraintScopeContextTypeMapping(): array {
941 941
 		return [
942
-			$this->config->get( 'WBQualityConstraintsConstraintCheckedOnMainValueId' ) => Context::TYPE_STATEMENT,
943
-			$this->config->get( 'WBQualityConstraintsConstraintCheckedOnQualifiersId' ) => Context::TYPE_QUALIFIER,
944
-			$this->config->get( 'WBQualityConstraintsConstraintCheckedOnReferencesId' ) => Context::TYPE_REFERENCE,
942
+			$this->config->get('WBQualityConstraintsConstraintCheckedOnMainValueId') => Context::TYPE_STATEMENT,
943
+			$this->config->get('WBQualityConstraintsConstraintCheckedOnQualifiersId') => Context::TYPE_QUALIFIER,
944
+			$this->config->get('WBQualityConstraintsConstraintCheckedOnReferencesId') => Context::TYPE_REFERENCE,
945 945
 		];
946 946
 	}
947 947
 
948 948
 	private function getPropertyScopeContextTypeMapping(): array {
949 949
 		return [
950
-			$this->config->get( 'WBQualityConstraintsAsMainValueId' ) => Context::TYPE_STATEMENT,
951
-			$this->config->get( 'WBQualityConstraintsAsQualifiersId' ) => Context::TYPE_QUALIFIER,
952
-			$this->config->get( 'WBQualityConstraintsAsReferencesId' ) => Context::TYPE_REFERENCE,
950
+			$this->config->get('WBQualityConstraintsAsMainValueId') => Context::TYPE_STATEMENT,
951
+			$this->config->get('WBQualityConstraintsAsQualifiersId') => Context::TYPE_QUALIFIER,
952
+			$this->config->get('WBQualityConstraintsAsReferencesId') => Context::TYPE_REFERENCE,
953 953
 		];
954 954
 	}
955 955
 
@@ -959,9 +959,9 @@  discard block
 block discarded – undo
959 959
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
960 960
 	 * @return string[] list of Context::TYPE_* constants
961 961
 	 */
962
-	public function parsePropertyScopeParameter( array $constraintParameters, string $constraintTypeItemId ): array {
962
+	public function parsePropertyScopeParameter(array $constraintParameters, string $constraintTypeItemId): array {
963 963
 		$contextTypes = [];
964
-		$parameterId = $this->config->get( 'WBQualityConstraintsPropertyScopeId' );
964
+		$parameterId = $this->config->get('WBQualityConstraintsPropertyScopeId');
965 965
 		$itemIds = $this->parseItemIdsParameter(
966 966
 			$constraintParameters,
967 967
 			$constraintTypeItemId,
@@ -970,14 +970,14 @@  discard block
 block discarded – undo
970 970
 		);
971 971
 
972 972
 		$mapping = $this->getPropertyScopeContextTypeMapping();
973
-		foreach ( $itemIds as $itemId ) {
974
-			$contextTypes[] = $this->mapItemId( $itemId, $mapping, $parameterId );
973
+		foreach ($itemIds as $itemId) {
974
+			$contextTypes[] = $this->mapItemId($itemId, $mapping, $parameterId);
975 975
 		}
976 976
 
977
-		if ( empty( $contextTypes ) ) {
977
+		if (empty($contextTypes)) {
978 978
 			// @codeCoverageIgnoreStart
979 979
 			throw new LogicException(
980
-				'The "property scope" parameter is required, ' .
980
+				'The "property scope" parameter is required, '.
981 981
 				'and yet we seem to be missing any allowed scope'
982 982
 			);
983 983
 			// @codeCoverageIgnoreEnd
Please login to merge, or discard this patch.
src/Api/CheckResultsRenderer.php 1 patch
Spacing   +15 added lines, -15 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
 
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 		$this->violationMessageRenderer = $violationMessageRenderer;
38 38
 	}
39 39
 
40
-	public function render( CachedCheckResults $checkResults ): CachedCheckConstraintsResponse {
40
+	public function render(CachedCheckResults $checkResults): CachedCheckConstraintsResponse {
41 41
 		$response = [];
42
-		foreach ( $checkResults->getArray() as $checkResult ) {
43
-			$resultArray = $this->checkResultToArray( $checkResult );
44
-			$checkResult->getContextCursor()->storeCheckResultInArray( $resultArray, $response );
42
+		foreach ($checkResults->getArray() as $checkResult) {
43
+			$resultArray = $this->checkResultToArray($checkResult);
44
+			$checkResult->getContextCursor()->storeCheckResultInArray($resultArray, $response);
45 45
 		}
46 46
 		return new CachedCheckConstraintsResponse(
47 47
 			$response,
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
 		);
50 50
 	}
51 51
 
52
-	public function checkResultToArray( CheckResult $checkResult ): ?array {
53
-		if ( $checkResult instanceof NullResult ) {
52
+	public function checkResultToArray(CheckResult $checkResult): ?array {
53
+		if ($checkResult instanceof NullResult) {
54 54
 			return null;
55 55
 		}
56 56
 
57 57
 		$constraintId = $checkResult->getConstraint()->getConstraintId();
58 58
 		$typeItemId = $checkResult->getConstraint()->getConstraintTypeItemId();
59
-		$constraintPropertyId = new NumericPropertyId( $checkResult->getContextCursor()->getSnakPropertyId() );
59
+		$constraintPropertyId = new NumericPropertyId($checkResult->getContextCursor()->getSnakPropertyId());
60 60
 
61
-		$title = $this->entityTitleLookup->getTitleForId( $constraintPropertyId );
61
+		$title = $this->entityTitleLookup->getTitleForId($constraintPropertyId);
62 62
 		$talkTitle = $title->getTalkPageIfDefined();
63
-		$typeLabel = $this->entityIdLabelFormatter->formatEntityId( new ItemId( $typeItemId ) );
64
-		$link = $title->getFullURL() . '#' . $constraintId;
63
+		$typeLabel = $this->entityIdLabelFormatter->formatEntityId(new ItemId($typeItemId));
64
+		$link = $title->getFullURL().'#'.$constraintId;
65 65
 
66 66
 		$constraint = [
67 67
 			'id' => $constraintId,
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 			'constraint' => $constraint
78 78
 		];
79 79
 		$message = $checkResult->getMessage();
80
-		if ( $message ) {
81
-			$result['message-html'] = $this->violationMessageRenderer->render( $message );
80
+		if ($message) {
81
+			$result['message-html'] = $this->violationMessageRenderer->render($message);
82 82
 		}
83
-		if ( $checkResult->getContextCursor()->getType() === Context::TYPE_STATEMENT ) {
83
+		if ($checkResult->getContextCursor()->getType() === Context::TYPE_STATEMENT) {
84 84
 			$result['claim'] = $checkResult->getContextCursor()->getStatementGuid();
85 85
 		}
86 86
 		$cachingMetadataArray = $checkResult->getMetadata()->getCachingMetadata()->toArray();
87
-		if ( $cachingMetadataArray !== null ) {
87
+		if ($cachingMetadataArray !== null) {
88 88
 			$result['cached'] = $cachingMetadataArray;
89 89
 		}
90 90
 
Please login to merge, or discard this patch.