@@ -89,23 +89,23 @@ discard block |
||
89 | 89 | * @return bool |
90 | 90 | * @throws OverflowException if $entitiesChecked exceeds the configured limit |
91 | 91 | */ |
92 | - private function isSubclassOf( EntityId $comparativeClass, array $classesToCheck, &$entitiesChecked = 0 ) { |
|
93 | - $maxEntities = $this->config->get( 'WBQualityConstraintsTypeCheckMaxEntities' ); |
|
92 | + private function isSubclassOf(EntityId $comparativeClass, array $classesToCheck, &$entitiesChecked = 0) { |
|
93 | + $maxEntities = $this->config->get('WBQualityConstraintsTypeCheckMaxEntities'); |
|
94 | 94 | if ( ++$entitiesChecked > $maxEntities ) { |
95 | - throw new OverflowException( 'Too many entities to check' ); |
|
95 | + throw new OverflowException('Too many entities to check'); |
|
96 | 96 | } |
97 | 97 | |
98 | - $item = $this->entityLookup->getEntity( $comparativeClass ); |
|
99 | - if ( !( $item instanceof StatementListProvider ) ) { |
|
98 | + $item = $this->entityLookup->getEntity($comparativeClass); |
|
99 | + if (!($item instanceof StatementListProvider)) { |
|
100 | 100 | return false; // lookup failed, probably because item doesn't exist |
101 | 101 | } |
102 | 102 | |
103 | - $subclassId = $this->config->get( 'WBQualityConstraintsSubclassOfId' ); |
|
103 | + $subclassId = $this->config->get('WBQualityConstraintsSubclassOfId'); |
|
104 | 104 | /** @var Statement $statement */ |
105 | - foreach ( $item->getStatements()->getByPropertyId( new PropertyId( $subclassId ) ) as $statement ) { |
|
105 | + foreach ($item->getStatements()->getByPropertyId(new PropertyId($subclassId)) as $statement) { |
|
106 | 106 | $mainSnak = $statement->getMainSnak(); |
107 | 107 | |
108 | - if ( !( $this->hasCorrectType( $mainSnak ) ) ) { |
|
108 | + if (!($this->hasCorrectType($mainSnak))) { |
|
109 | 109 | continue; |
110 | 110 | } |
111 | 111 | /** @var PropertyValueSnak $mainSnak */ |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | $dataValue = $mainSnak->getDataValue(); |
115 | 115 | $comparativeClass = $dataValue->getEntityId(); |
116 | 116 | |
117 | - if ( in_array( $comparativeClass->getSerialization(), $classesToCheck ) ) { |
|
117 | + if (in_array($comparativeClass->getSerialization(), $classesToCheck)) { |
|
118 | 118 | return true; |
119 | 119 | } |
120 | 120 | |
121 | - if ( $this->isSubclassOf( $comparativeClass, $classesToCheck, $entitiesChecked ) ) { |
|
121 | + if ($this->isSubclassOf($comparativeClass, $classesToCheck, $entitiesChecked)) { |
|
122 | 122 | return true; |
123 | 123 | } |
124 | 124 | } |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | * @return CachedBool |
140 | 140 | * @throws SparqlHelperException if SPARQL is used and the query times out or some other error occurs |
141 | 141 | */ |
142 | - public function isSubclassOfWithSparqlFallback( EntityId $comparativeClass, array $classesToCheck ) { |
|
142 | + public function isSubclassOfWithSparqlFallback(EntityId $comparativeClass, array $classesToCheck) { |
|
143 | 143 | try { |
144 | 144 | return new CachedBool( |
145 | - $this->isSubclassOf( $comparativeClass, $classesToCheck ), |
|
145 | + $this->isSubclassOf($comparativeClass, $classesToCheck), |
|
146 | 146 | Metadata::blank() |
147 | 147 | ); |
148 | - } catch ( OverflowException $e ) { |
|
149 | - if ( $this->sparqlHelper !== null ) { |
|
148 | + } catch (OverflowException $e) { |
|
149 | + if ($this->sparqlHelper !== null) { |
|
150 | 150 | $this->dataFactory->increment( |
151 | 151 | 'wikibase.quality.constraints.sparql.typeFallback' |
152 | 152 | ); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | /* withInstance = */ false |
157 | 157 | ); |
158 | 158 | } else { |
159 | - return new CachedBool( false, Metadata::blank() ); |
|
159 | + return new CachedBool(false, Metadata::blank()); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | * @return CachedBool |
175 | 175 | * @throws SparqlHelperException if SPARQL is used and the query times out or some other error occurs |
176 | 176 | */ |
177 | - public function hasClassInRelation( StatementList $statements, array $relationIds, array $classesToCheck ) { |
|
177 | + public function hasClassInRelation(StatementList $statements, array $relationIds, array $classesToCheck) { |
|
178 | 178 | $metadatas = []; |
179 | 179 | |
180 | - foreach ( $this->getStatementsByPropertyIds( $statements, $relationIds ) as $statement ) { |
|
180 | + foreach ($this->getStatementsByPropertyIds($statements, $relationIds) as $statement) { |
|
181 | 181 | $mainSnak = $statement->getMainSnak(); |
182 | 182 | |
183 | - if ( !$this->hasCorrectType( $mainSnak ) ) { |
|
183 | + if (!$this->hasCorrectType($mainSnak)) { |
|
184 | 184 | continue; |
185 | 185 | } |
186 | 186 | /** @var PropertyValueSnak $mainSnak */ |
@@ -189,28 +189,28 @@ discard block |
||
189 | 189 | $dataValue = $mainSnak->getDataValue(); |
190 | 190 | $comparativeClass = $dataValue->getEntityId(); |
191 | 191 | |
192 | - if ( in_array( $comparativeClass->getSerialization(), $classesToCheck ) ) { |
|
192 | + if (in_array($comparativeClass->getSerialization(), $classesToCheck)) { |
|
193 | 193 | // discard $metadatas, we know this is fresh |
194 | - return new CachedBool( true, Metadata::blank() ); |
|
194 | + return new CachedBool(true, Metadata::blank()); |
|
195 | 195 | } |
196 | 196 | |
197 | - $result = $this->isSubclassOfWithSparqlFallback( $comparativeClass, $classesToCheck ); |
|
197 | + $result = $this->isSubclassOfWithSparqlFallback($comparativeClass, $classesToCheck); |
|
198 | 198 | $metadatas[] = $result->getMetadata(); |
199 | - if ( $result->getBool() ) { |
|
199 | + if ($result->getBool()) { |
|
200 | 200 | return new CachedBool( |
201 | 201 | true, |
202 | - Metadata::merge( $metadatas ) |
|
202 | + Metadata::merge($metadatas) |
|
203 | 203 | ); |
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | 207 | return new CachedBool( |
208 | 208 | false, |
209 | - Metadata::merge( $metadatas ) |
|
209 | + Metadata::merge($metadatas) |
|
210 | 210 | ); |
211 | 211 | } |
212 | 212 | |
213 | - private function hasCorrectType( Snak $mainSnak ) { |
|
213 | + private function hasCorrectType(Snak $mainSnak) { |
|
214 | 214 | return $mainSnak instanceof PropertyValueSnak |
215 | 215 | && $mainSnak->getDataValue()->getType() === 'wikibase-entityid'; |
216 | 216 | } |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | ) { |
228 | 228 | $statementArrays = []; |
229 | 229 | |
230 | - foreach ( $propertyIdSerializations as $propertyIdSerialization ) { |
|
231 | - $propertyId = new PropertyId( $propertyIdSerialization ); |
|
232 | - $statementArrays[] = $statements->getByPropertyId( $propertyId )->toArray(); |
|
230 | + foreach ($propertyIdSerializations as $propertyIdSerialization) { |
|
231 | + $propertyId = new PropertyId($propertyIdSerialization); |
|
232 | + $statementArrays[] = $statements->getByPropertyId($propertyId)->toArray(); |
|
233 | 233 | } |
234 | 234 | |
235 | - return call_user_func_array( 'array_merge', $statementArrays ); |
|
235 | + return call_user_func_array('array_merge', $statementArrays); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return ViolationMessage |
246 | 246 | */ |
247 | - public function getViolationMessage( PropertyId $propertyId, EntityId $entityId, array $classes, $checker, $relation ) { |
|
247 | + public function getViolationMessage(PropertyId $propertyId, EntityId $entityId, array $classes, $checker, $relation) { |
|
248 | 248 | $classes = array_map( |
249 | - function( $itemIdSerialization ) { |
|
250 | - return new ItemId( $itemIdSerialization ); |
|
249 | + function($itemIdSerialization) { |
|
250 | + return new ItemId($itemIdSerialization); |
|
251 | 251 | }, |
252 | 252 | $classes |
253 | 253 | ); |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | // wbqc-violation-message-valueType-instance |
260 | 260 | // wbqc-violation-message-valueType-subclass |
261 | 261 | // wbqc-violation-message-valueType-instanceOrSubclass |
262 | - return ( new ViolationMessage( 'wbqc-violation-message-' . $checker . '-' . $relation ) ) |
|
263 | - ->withEntityId( $propertyId, Role::CONSTRAINT_PROPERTY ) |
|
264 | - ->withEntityId( $entityId, Role::SUBJECT ) |
|
265 | - ->withEntityIdList( $classes, Role::OBJECT ); |
|
262 | + return (new ViolationMessage('wbqc-violation-message-'.$checker.'-'.$relation)) |
|
263 | + ->withEntityId($propertyId, Role::CONSTRAINT_PROPERTY) |
|
264 | + ->withEntityId($entityId, Role::SUBJECT) |
|
265 | + ->withEntityIdList($classes, Role::OBJECT); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | } |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return self |
79 | 79 | */ |
80 | - public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) { |
|
80 | + public static function newFromGlobalState(ApiMain $main, $name, $prefix = '') { |
|
81 | 81 | $repo = WikibaseRepo::getDefaultInstance(); |
82 | 82 | |
83 | 83 | $language = $repo->getUserLanguage(); |
84 | 84 | $formatterOptions = new FormatterOptions(); |
85 | - $formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() ); |
|
85 | + $formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode()); |
|
86 | 86 | $valueFormatterFactory = $repo->getValueFormatterFactory(); |
87 | - $valueFormatter = $valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions ); |
|
87 | + $valueFormatter = $valueFormatterFactory->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions); |
|
88 | 88 | |
89 | 89 | $languageFallbackLabelDescriptionLookupFactory = $repo->getLanguageFallbackLabelDescriptionLookupFactory(); |
90 | - $labelDescriptionLookup = $languageFallbackLabelDescriptionLookupFactory->newLabelDescriptionLookup( $language ); |
|
90 | + $labelDescriptionLookup = $languageFallbackLabelDescriptionLookupFactory->newLabelDescriptionLookup($language); |
|
91 | 91 | $entityIdHtmlLinkFormatterFactory = $repo->getEntityIdHtmlLinkFormatterFactory(); |
92 | - $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( $labelDescriptionLookup ); |
|
92 | + $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter($labelDescriptionLookup); |
|
93 | 93 | $entityIdLabelFormatterFactory = new EntityIdLabelFormatterFactory(); |
94 | - $entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter( $labelDescriptionLookup ); |
|
94 | + $entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter($labelDescriptionLookup); |
|
95 | 95 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
96 | 96 | $titleParser = MediaWikiServices::getInstance()->getTitleParser(); |
97 | 97 | $unitConverter = $repo->getUnitConverter(); |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | $repo->getEntityTitleLookup(), |
125 | 125 | $entityIdLabelFormatter, |
126 | 126 | $constraintParameterRenderer, |
127 | - new ViolationMessageRenderer( $entityIdHtmlLinkFormatter, $valueFormatter, $config ), |
|
127 | + new ViolationMessageRenderer($entityIdHtmlLinkFormatter, $valueFormatter, $config), |
|
128 | 128 | $config |
129 | 129 | ); |
130 | - if ( $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) { |
|
130 | + if ($config->get('WBQualityConstraintsCacheCheckConstraintsResults')) { |
|
131 | 131 | $wikiPageEntityMetaDataAccessor = new WikiPageEntityMetaDataLookup( |
132 | 132 | $repo->getEntityNamespaceLookup() |
133 | 133 | ); |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | ResultsCache::getDefaultInstance(), |
139 | 139 | $wikiPageEntityMetaDataAccessor, |
140 | 140 | $entityIdParser, |
141 | - $config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ), |
|
141 | + $config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'), |
|
142 | 142 | [ |
143 | - $config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ), |
|
144 | - $config->get( 'WBQualityConstraintsTypeConstraintId' ), |
|
145 | - $config->get( 'WBQualityConstraintsValueTypeConstraintId' ), |
|
146 | - $config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ), |
|
143 | + $config->get('WBQualityConstraintsCommonsLinkConstraintId'), |
|
144 | + $config->get('WBQualityConstraintsTypeConstraintId'), |
|
145 | + $config->get('WBQualityConstraintsValueTypeConstraintId'), |
|
146 | + $config->get('WBQualityConstraintsDistinctValuesConstraintId'), |
|
147 | 147 | ], |
148 | 148 | $dataFactory |
149 | 149 | ); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $prefix, |
156 | 156 | $repo->getEntityIdParser(), |
157 | 157 | $repo->getStatementGuidValidator(), |
158 | - $repo->getApiHelperFactory( RequestContext::getMain() ), |
|
158 | + $repo->getApiHelperFactory(RequestContext::getMain()), |
|
159 | 159 | $resultsBuilder, |
160 | 160 | $dataFactory |
161 | 161 | ); |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | ResultsBuilder $resultsBuilder, |
182 | 182 | IBufferingStatsdDataFactory $dataFactory |
183 | 183 | ) { |
184 | - parent::__construct( $main, $name, $prefix ); |
|
184 | + parent::__construct($main, $name, $prefix); |
|
185 | 185 | $this->entityIdParser = $entityIdParser; |
186 | 186 | $this->statementGuidValidator = $statementGuidValidator; |
187 | - $this->resultBuilder = $apiHelperFactory->getResultBuilder( $this ); |
|
188 | - $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); |
|
187 | + $this->resultBuilder = $apiHelperFactory->getResultBuilder($this); |
|
188 | + $this->errorReporter = $apiHelperFactory->getErrorReporter($this); |
|
189 | 189 | $this->resultsBuilder = $resultsBuilder; |
190 | 190 | $this->dataFactory = $dataFactory; |
191 | 191 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | |
201 | 201 | $params = $this->extractRequestParams(); |
202 | 202 | |
203 | - $this->validateParameters( $params ); |
|
204 | - $entityIds = $this->parseEntityIds( $params ); |
|
205 | - $claimIds = $this->parseClaimIds( $params ); |
|
203 | + $this->validateParameters($params); |
|
204 | + $entityIds = $this->parseEntityIds($params); |
|
205 | + $claimIds = $this->parseClaimIds($params); |
|
206 | 206 | $constraintIDs = $params[self::PARAM_CONSTRAINT_ID]; |
207 | 207 | $statuses = $params[self::PARAM_STATUS]; |
208 | 208 | |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | )->getArray() |
218 | 218 | ); |
219 | 219 | // ensure that result contains the given entity IDs even if they have no statements |
220 | - foreach ( $entityIds as $entityId ) { |
|
220 | + foreach ($entityIds as $entityId) { |
|
221 | 221 | $this->getResult()->addArrayType( |
222 | - [ $this->getModuleName(), $entityId->getSerialization() ], |
|
222 | + [$this->getModuleName(), $entityId->getSerialization()], |
|
223 | 223 | 'assoc' |
224 | 224 | ); |
225 | 225 | } |
226 | - $this->resultBuilder->markSuccess( 1 ); |
|
226 | + $this->resultBuilder->markSuccess(1); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -231,24 +231,24 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return EntityId[] |
233 | 233 | */ |
234 | - private function parseEntityIds( array $params ) { |
|
234 | + private function parseEntityIds(array $params) { |
|
235 | 235 | $ids = $params[self::PARAM_ID]; |
236 | 236 | |
237 | - if ( $ids === null ) { |
|
237 | + if ($ids === null) { |
|
238 | 238 | return []; |
239 | - } elseif ( $ids === [] ) { |
|
239 | + } elseif ($ids === []) { |
|
240 | 240 | $this->errorReporter->dieError( |
241 | - 'If ' . self::PARAM_ID . ' is specified, it must be nonempty.', 'no-data' ); |
|
241 | + 'If '.self::PARAM_ID.' is specified, it must be nonempty.', 'no-data' ); |
|
242 | 242 | } |
243 | 243 | |
244 | - return array_map( function ( $id ) { |
|
244 | + return array_map(function($id) { |
|
245 | 245 | try { |
246 | - return $this->entityIdParser->parse( $id ); |
|
247 | - } catch ( EntityIdParsingException $e ) { |
|
246 | + return $this->entityIdParser->parse($id); |
|
247 | + } catch (EntityIdParsingException $e) { |
|
248 | 248 | $this->errorReporter->dieError( |
249 | - "Invalid id: $id", 'invalid-entity-id', 0, [ self::PARAM_ID => $id ] ); |
|
249 | + "Invalid id: $id", 'invalid-entity-id', 0, [self::PARAM_ID => $id] ); |
|
250 | 250 | } |
251 | - }, $ids ); |
|
251 | + }, $ids); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -256,35 +256,35 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return string[] |
258 | 258 | */ |
259 | - private function parseClaimIds( array $params ) { |
|
259 | + private function parseClaimIds(array $params) { |
|
260 | 260 | $ids = $params[self::PARAM_CLAIM_ID]; |
261 | 261 | |
262 | - if ( $ids === null ) { |
|
262 | + if ($ids === null) { |
|
263 | 263 | return []; |
264 | - } elseif ( $ids === [] ) { |
|
264 | + } elseif ($ids === []) { |
|
265 | 265 | $this->errorReporter->dieError( |
266 | - 'If ' . self::PARAM_CLAIM_ID . ' is specified, it must be nonempty.', 'no-data' ); |
|
266 | + 'If '.self::PARAM_CLAIM_ID.' is specified, it must be nonempty.', 'no-data' ); |
|
267 | 267 | } |
268 | 268 | |
269 | - foreach ( $ids as $id ) { |
|
270 | - if ( !$this->statementGuidValidator->validate( $id ) ) { |
|
269 | + foreach ($ids as $id) { |
|
270 | + if (!$this->statementGuidValidator->validate($id)) { |
|
271 | 271 | $this->errorReporter->dieError( |
272 | - "Invalid claim id: $id", 'invalid-guid', 0, [ self::PARAM_CLAIM_ID => $id ] ); |
|
272 | + "Invalid claim id: $id", 'invalid-guid', 0, [self::PARAM_CLAIM_ID => $id] ); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
276 | 276 | return $ids; |
277 | 277 | } |
278 | 278 | |
279 | - private function validateParameters( array $params ) { |
|
280 | - if ( $params[self::PARAM_CONSTRAINT_ID] !== null |
|
281 | - && empty( $params[self::PARAM_CONSTRAINT_ID] ) |
|
279 | + private function validateParameters(array $params) { |
|
280 | + if ($params[self::PARAM_CONSTRAINT_ID] !== null |
|
281 | + && empty($params[self::PARAM_CONSTRAINT_ID]) |
|
282 | 282 | ) { |
283 | 283 | $paramConstraintId = self::PARAM_CONSTRAINT_ID; |
284 | 284 | $this->errorReporter->dieError( |
285 | 285 | "If $paramConstraintId is specified, it must be nonempty.", 'no-data' ); |
286 | 286 | } |
287 | - if ( $params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null ) { |
|
287 | + if ($params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null) { |
|
288 | 288 | $paramId = self::PARAM_ID; |
289 | 289 | $paramClaimId = self::PARAM_CLAIM_ID; |
290 | 290 | $this->errorReporter->dieError( |
@@ -332,7 +332,6 @@ |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
335 | - * @param string[] $text Context::TYPE_* constants |
|
336 | 335 | * @param string|null $role one of the Role::* constants |
337 | 336 | * @return array[] list of parameters as accepted by Message::params() |
338 | 337 | */ |
@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | * (temporarily, pre-rendered strings are allowed and returned without changes) |
67 | 67 | * @return string |
68 | 68 | */ |
69 | - public function render( $violationMessage ) { |
|
70 | - if ( is_string( $violationMessage ) ) { |
|
69 | + public function render($violationMessage) { |
|
70 | + if (is_string($violationMessage)) { |
|
71 | 71 | // TODO remove this once all checkers produce ViolationMessage objects |
72 | 72 | return $violationMessage; |
73 | 73 | } |
74 | 74 | |
75 | 75 | $messageKey = $violationMessage->getMessageKey(); |
76 | - $paramsLists = [ [] ]; |
|
77 | - foreach ( $violationMessage->getArguments() as $argument ) { |
|
78 | - $params = $this->renderArgument( $argument ); |
|
76 | + $paramsLists = [[]]; |
|
77 | + foreach ($violationMessage->getArguments() as $argument) { |
|
78 | + $params = $this->renderArgument($argument); |
|
79 | 79 | $paramsLists[] = $params; |
80 | 80 | } |
81 | - $allParams = call_user_func_array( 'array_merge', $paramsLists ); |
|
82 | - return ( new Message( $messageKey ) ) |
|
83 | - ->params( $allParams ) |
|
81 | + $allParams = call_user_func_array('array_merge', $paramsLists); |
|
82 | + return (new Message($messageKey)) |
|
83 | + ->params($allParams) |
|
84 | 84 | ->escaped(); |
85 | 85 | } |
86 | 86 | |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | * @param string|null $role one of the Role::* constants |
90 | 90 | * @return string HTML |
91 | 91 | */ |
92 | - private function addRole( $value, $role ) { |
|
93 | - if ( $role === null ) { |
|
92 | + private function addRole($value, $role) { |
|
93 | + if ($role === null) { |
|
94 | 94 | return $value; |
95 | 95 | } |
96 | 96 | |
97 | - return '<span class="wbqc-role wbqc-role-' . htmlspecialchars( $role ) . '">' . |
|
98 | - $value . |
|
97 | + return '<span class="wbqc-role wbqc-role-'.htmlspecialchars($role).'">'. |
|
98 | + $value. |
|
99 | 99 | '</span>'; |
100 | 100 | } |
101 | 101 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param array $argument |
104 | 104 | * @return array[] params (for Message::params) |
105 | 105 | */ |
106 | - private function renderArgument( array $argument ) { |
|
106 | + private function renderArgument(array $argument) { |
|
107 | 107 | $methods = [ |
108 | 108 | ViolationMessage::TYPE_ENTITY_ID => 'renderEntityId', |
109 | 109 | ViolationMessage::TYPE_ENTITY_ID_LIST => 'renderEntityIdList', |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | $value = $argument['value']; |
122 | 122 | $role = $argument['role']; |
123 | 123 | |
124 | - if ( array_key_exists( $type, $methods ) ) { |
|
124 | + if (array_key_exists($type, $methods)) { |
|
125 | 125 | $method = $methods[$type]; |
126 | - $params = $this->$method( $value, $role ); |
|
126 | + $params = $this->$method($value, $role); |
|
127 | 127 | } else { |
128 | 128 | throw new InvalidArgumentException( |
129 | - 'Unknown ViolationMessage argument type ' . $type . '!' |
|
129 | + 'Unknown ViolationMessage argument type '.$type.'!' |
|
130 | 130 | ); |
131 | 131 | } |
132 | 132 | |
@@ -140,46 +140,46 @@ discard block |
||
140 | 140 | * and return a single-element array with a raw message param (i. e. [ Message::rawParam( … ) ]) |
141 | 141 | * @return array[] list of parameters as accepted by Message::params() |
142 | 142 | */ |
143 | - private function renderList( array $list, $role, callable $render ) { |
|
144 | - if ( $list === [] ) { |
|
143 | + private function renderList(array $list, $role, callable $render) { |
|
144 | + if ($list === []) { |
|
145 | 145 | return [ |
146 | - Message::numParam( 0 ), |
|
147 | - Message::rawParam( '<ul></ul>' ), |
|
146 | + Message::numParam(0), |
|
147 | + Message::rawParam('<ul></ul>'), |
|
148 | 148 | ]; |
149 | 149 | } |
150 | 150 | |
151 | - if ( count( $list ) > $this->maxListLength ) { |
|
152 | - $list = array_slice( $list, 0, $this->maxListLength ); |
|
151 | + if (count($list) > $this->maxListLength) { |
|
152 | + $list = array_slice($list, 0, $this->maxListLength); |
|
153 | 153 | $truncated = true; |
154 | 154 | } |
155 | 155 | |
156 | 156 | $renderedParamsLists = array_map( |
157 | 157 | $render, |
158 | 158 | $list, |
159 | - array_fill( 0, count( $list ), $role ) |
|
159 | + array_fill(0, count($list), $role) |
|
160 | 160 | ); |
161 | 161 | $renderedParams = array_map( |
162 | - function ( $params ) { |
|
162 | + function($params) { |
|
163 | 163 | return $params[0]; |
164 | 164 | }, |
165 | 165 | $renderedParamsLists |
166 | 166 | ); |
167 | 167 | $renderedElements = array_map( |
168 | - function ( $param ) { |
|
168 | + function($param) { |
|
169 | 169 | return $param['raw']; |
170 | 170 | }, |
171 | 171 | $renderedParams |
172 | 172 | ); |
173 | - if ( isset( $truncated ) ) { |
|
174 | - $renderedElements[] = wfMessage( 'ellipsis' )->escaped(); |
|
173 | + if (isset($truncated)) { |
|
174 | + $renderedElements[] = wfMessage('ellipsis')->escaped(); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return array_merge( |
178 | 178 | [ |
179 | - Message::numParam( count( $list ) ), |
|
179 | + Message::numParam(count($list)), |
|
180 | 180 | Message::rawParam( |
181 | - '<ul><li>' . |
|
182 | - implode( '</li><li>', $renderedElements ) . |
|
181 | + '<ul><li>'. |
|
182 | + implode('</li><li>', $renderedElements). |
|
183 | 183 | '</li></ul>' |
184 | 184 | ), |
185 | 185 | ], |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | * @param string|null $role one of the Role::* constants |
193 | 193 | * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ]) |
194 | 194 | */ |
195 | - private function renderEntityId( EntityId $entityId, $role ) { |
|
196 | - return [ Message::rawParam( $this->addRole( |
|
197 | - $this->entityIdFormatter->formatEntityId( $entityId ), |
|
195 | + private function renderEntityId(EntityId $entityId, $role) { |
|
196 | + return [Message::rawParam($this->addRole( |
|
197 | + $this->entityIdFormatter->formatEntityId($entityId), |
|
198 | 198 | $role |
199 | - ) ) ]; |
|
199 | + ))]; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | * @param string|null $role one of the Role::* constants |
205 | 205 | * @return array[] list of parameters as accepted by Message::params() |
206 | 206 | */ |
207 | - private function renderEntityIdList( array $entityIdList, $role ) { |
|
208 | - return $this->renderList( $entityIdList, $role, [ $this, 'renderEntityId' ] ); |
|
207 | + private function renderEntityIdList(array $entityIdList, $role) { |
|
208 | + return $this->renderList($entityIdList, $role, [$this, 'renderEntityId']); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -213,24 +213,24 @@ discard block |
||
213 | 213 | * @param string|null $role one of the Role::* constants |
214 | 214 | * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ]) |
215 | 215 | */ |
216 | - private function renderItemIdSnakValue( ItemIdSnakValue $value, $role ) { |
|
217 | - switch ( true ) { |
|
216 | + private function renderItemIdSnakValue(ItemIdSnakValue $value, $role) { |
|
217 | + switch (true) { |
|
218 | 218 | case $value->isValue(): |
219 | - return $this->renderEntityId( $value->getItemId(), $role ); |
|
219 | + return $this->renderEntityId($value->getItemId(), $role); |
|
220 | 220 | case $value->isSomeValue(): |
221 | - return [ Message::rawParam( $this->addRole( |
|
222 | - '<span class="wikibase-snakview-variation-somevaluesnak">' . |
|
223 | - wfMessage( 'wikibase-snakview-snaktypeselector-somevalue' )->escaped() . |
|
221 | + return [Message::rawParam($this->addRole( |
|
222 | + '<span class="wikibase-snakview-variation-somevaluesnak">'. |
|
223 | + wfMessage('wikibase-snakview-snaktypeselector-somevalue')->escaped(). |
|
224 | 224 | '</span>', |
225 | 225 | $role |
226 | - ) ) ]; |
|
226 | + ))]; |
|
227 | 227 | case $value->isNoValue(): |
228 | - return [ Message::rawParam( $this->addRole( |
|
229 | - '<span class="wikibase-snakview-variation-novaluesnak">' . |
|
230 | - wfMessage( 'wikibase-snakview-snaktypeselector-novalue' )->escaped() . |
|
228 | + return [Message::rawParam($this->addRole( |
|
229 | + '<span class="wikibase-snakview-variation-novaluesnak">'. |
|
230 | + wfMessage('wikibase-snakview-snaktypeselector-novalue')->escaped(). |
|
231 | 231 | '</span>', |
232 | 232 | $role |
233 | - ) ) ]; |
|
233 | + ))]; |
|
234 | 234 | default: |
235 | 235 | // @codeCoverageIgnoreStart |
236 | 236 | throw new LogicException( |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | * @param string|null $role one of the Role::* constants |
246 | 246 | * @return array[] list of parameters as accepted by Message::params() |
247 | 247 | */ |
248 | - private function renderItemIdSnakValueList( array $valueList, $role ) { |
|
249 | - return $this->renderList( $valueList, $role, [ $this, 'renderItemIdSnakValue' ] ); |
|
248 | + private function renderItemIdSnakValueList(array $valueList, $role) { |
|
249 | + return $this->renderList($valueList, $role, [$this, 'renderItemIdSnakValue']); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | * @param string|null $role one of the Role::* constants |
255 | 255 | * @return array[] list of parameters as accepted by Message::params() |
256 | 256 | */ |
257 | - private function renderDataValue( DataValue $dataValue, $role ) { |
|
258 | - return [ Message::rawParam( $this->addRole( |
|
259 | - $this->dataValueFormatter->format( $dataValue ), |
|
257 | + private function renderDataValue(DataValue $dataValue, $role) { |
|
258 | + return [Message::rawParam($this->addRole( |
|
259 | + $this->dataValueFormatter->format($dataValue), |
|
260 | 260 | $role |
261 | - ) ) ]; |
|
261 | + ))]; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -266,22 +266,22 @@ discard block |
||
266 | 266 | * @param string|null $role one of the Role::* constants |
267 | 267 | * @return array[] list of parameters as accepted by Message::params() |
268 | 268 | */ |
269 | - private function renderDataValueType( $dataValueType, $role ) { |
|
269 | + private function renderDataValueType($dataValueType, $role) { |
|
270 | 270 | $messageKeys = [ |
271 | 271 | 'string' => 'datatypes-type-string', |
272 | 272 | 'monolingualtext' => 'datatypes-monolingualtext', |
273 | 273 | 'wikibase-entityid' => 'wbqc-dataValueType-wikibase-entityid', |
274 | 274 | ]; |
275 | 275 | |
276 | - if ( array_key_exists( $dataValueType, $messageKeys ) ) { |
|
277 | - return [ Message::rawParam( $this->addRole( |
|
278 | - wfMessage( $messageKeys[$dataValueType] )->escaped(), |
|
276 | + if (array_key_exists($dataValueType, $messageKeys)) { |
|
277 | + return [Message::rawParam($this->addRole( |
|
278 | + wfMessage($messageKeys[$dataValueType])->escaped(), |
|
279 | 279 | $role |
280 | - ) ) ]; |
|
280 | + ))]; |
|
281 | 281 | } else { |
282 | 282 | // @codeCoverageIgnoreStart |
283 | 283 | throw new LogicException( |
284 | - 'Unknown data value type ' . $dataValueType |
|
284 | + 'Unknown data value type '.$dataValueType |
|
285 | 285 | ); |
286 | 286 | // @codeCoverageIgnoreEnd |
287 | 287 | } |
@@ -292,11 +292,11 @@ discard block |
||
292 | 292 | * @param string|null $role one of the Role::* constants |
293 | 293 | * @return array[] list of parameters as accepted by Message::params() |
294 | 294 | */ |
295 | - private function renderInlineCode( $code, $role ) { |
|
296 | - return [ Message::rawParam( $this->addRole( |
|
297 | - '<code>' . htmlspecialchars( $code ) . '</code>', |
|
295 | + private function renderInlineCode($code, $role) { |
|
296 | + return [Message::rawParam($this->addRole( |
|
297 | + '<code>'.htmlspecialchars($code).'</code>', |
|
298 | 298 | $role |
299 | - ) ) ]; |
|
299 | + ))]; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | * @param string|null $role one of the Role::* constants |
305 | 305 | * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ]) |
306 | 306 | */ |
307 | - private function renderConstraintScope( $scope, $role ) { |
|
308 | - switch ( $scope ) { |
|
307 | + private function renderConstraintScope($scope, $role) { |
|
308 | + switch ($scope) { |
|
309 | 309 | case Context::TYPE_STATEMENT: |
310 | 310 | $itemId = $this->config->get( |
311 | 311 | 'WBQualityConstraintsConstraintCheckedOnMainValueId' |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | // callers should never let this happen, but if it does happen, |
326 | 326 | // showing “unknown value” seems reasonable |
327 | 327 | // @codeCoverageIgnoreStart |
328 | - return $this->renderItemIdSnakValue( ItemIdSnakValue::someValue(), $role ); |
|
328 | + return $this->renderItemIdSnakValue(ItemIdSnakValue::someValue(), $role); |
|
329 | 329 | // @codeCoverageIgnoreEnd |
330 | 330 | } |
331 | - return $this->renderEntityId( new ItemId( $itemId ), $role ); |
|
331 | + return $this->renderEntityId(new ItemId($itemId), $role); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | * @param string|null $role one of the Role::* constants |
337 | 337 | * @return array[] list of parameters as accepted by Message::params() |
338 | 338 | */ |
339 | - private function renderConstraintScopeList( array $scopeList, $role ) { |
|
340 | - return $this->renderList( $scopeList, $role, [ $this, 'renderConstraintScope' ] ); |
|
339 | + private function renderConstraintScopeList(array $scopeList, $role) { |
|
340 | + return $this->renderList($scopeList, $role, [$this, 'renderConstraintScope']); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | * @param string|null $role one of the Role::* constants |
346 | 346 | * @return array[] list of parameters as accepted by Message::params() |
347 | 347 | */ |
348 | - private function renderLanguage( $languageCode, $role ) { |
|
348 | + private function renderLanguage($languageCode, $role) { |
|
349 | 349 | return [ |
350 | - Message::plaintextParam( Language::fetchLanguageName( $languageCode ) ), |
|
351 | - Message::plaintextParam( $languageCode ), |
|
350 | + Message::plaintextParam(Language::fetchLanguageName($languageCode)), |
|
351 | + Message::plaintextParam($languageCode), |
|
352 | 352 | ]; |
353 | 353 | } |
354 | 354 |
@@ -13,26 +13,26 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class ViolationMessageSerializer implements Serializer { |
15 | 15 | |
16 | - private function abbreviateViolationMessageKey( $fullMessageKey ) { |
|
17 | - return substr( $fullMessageKey, strlen( ViolationMessage::MESSAGE_KEY_PREFIX ) ); |
|
16 | + private function abbreviateViolationMessageKey($fullMessageKey) { |
|
17 | + return substr($fullMessageKey, strlen(ViolationMessage::MESSAGE_KEY_PREFIX)); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @param ViolationMessage $object |
22 | 22 | * @return array |
23 | 23 | */ |
24 | - public function serialize( $object ) { |
|
24 | + public function serialize($object) { |
|
25 | 25 | /** @var ViolationMessage $object */ |
26 | - Assert::parameterType( ViolationMessage::class, $object, '$object' ); |
|
26 | + Assert::parameterType(ViolationMessage::class, $object, '$object'); |
|
27 | 27 | |
28 | 28 | $arguments = $object->getArguments(); |
29 | 29 | $serializedArguments = []; |
30 | - foreach ( $arguments as $argument ) { |
|
31 | - $serializedArguments[] = $this->serializeArgument( $argument ); |
|
30 | + foreach ($arguments as $argument) { |
|
31 | + $serializedArguments[] = $this->serializeArgument($argument); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | return [ |
35 | - 'k' => $this->abbreviateViolationMessageKey( $object->getMessageKey() ), |
|
35 | + 'k' => $this->abbreviateViolationMessageKey($object->getMessageKey()), |
|
36 | 36 | 'a' => $serializedArguments, |
37 | 37 | ]; |
38 | 38 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return array [ 't' => ViolationMessage::TYPE_*, 'v' => serialized value, |
43 | 43 | * 'r' => $role, (optional) 'a' => $alternativeMessageKey ] |
44 | 44 | */ |
45 | - private function serializeArgument( array $argument ) { |
|
45 | + private function serializeArgument(array $argument) { |
|
46 | 46 | $methods = [ |
47 | 47 | ]; |
48 | 48 | |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | $value = $argument['value']; |
51 | 51 | $role = $argument['role']; |
52 | 52 | |
53 | - if ( array_key_exists( $type, $methods ) ) { |
|
53 | + if (array_key_exists($type, $methods)) { |
|
54 | 54 | $method = $methods[$type]; |
55 | - $serializedValue = $this->$method( $value ); |
|
55 | + $serializedValue = $this->$method($value); |
|
56 | 56 | } else { |
57 | 57 | throw new InvalidArgumentException( |
58 | - 'Unknown ViolationMessage argument type ' . $type . '!' |
|
58 | + 'Unknown ViolationMessage argument type '.$type.'!' |
|
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'r' => $role, |
66 | 66 | ]; |
67 | 67 | |
68 | - if ( array_key_exists( 'alternativeMessageKey', $argument ) ) { |
|
68 | + if (array_key_exists('alternativeMessageKey', $argument)) { |
|
69 | 69 | $serialized['a'] = $this->abbreviateViolationMessageKey( |
70 | 70 | $argument['alternativeMessageKey'] |
71 | 71 | ); |
@@ -13,23 +13,23 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class ViolationMessageDeserializer implements Deserializer { |
15 | 15 | |
16 | - public function unabbreviateViolationMessageKey( $messageKeySuffix ) { |
|
17 | - return ViolationMessage::MESSAGE_KEY_PREFIX . $messageKeySuffix; |
|
16 | + public function unabbreviateViolationMessageKey($messageKeySuffix) { |
|
17 | + return ViolationMessage::MESSAGE_KEY_PREFIX.$messageKeySuffix; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @param array $serialization |
22 | 22 | * @return ViolationMessage |
23 | 23 | */ |
24 | - public function deserialize( $serialization ) { |
|
25 | - Assert::parameterType( 'array', $serialization, '$serialization' ); |
|
24 | + public function deserialize($serialization) { |
|
25 | + Assert::parameterType('array', $serialization, '$serialization'); |
|
26 | 26 | |
27 | 27 | $message = new ViolationMessage( |
28 | - $this->unabbreviateViolationMessageKey( $serialization['k'] ) |
|
28 | + $this->unabbreviateViolationMessageKey($serialization['k']) |
|
29 | 29 | ); |
30 | 30 | |
31 | - foreach ( $serialization['a'] as $serializedArgument ) { |
|
32 | - $message = $this->deserializeArgument( $message, $serializedArgument ); |
|
31 | + foreach ($serialization['a'] as $serializedArgument) { |
|
32 | + $message = $this->deserializeArgument($message, $serializedArgument); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return $message; |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | * 'r' => $role, (optional) 'a' => $alternativeMessageKey ] |
42 | 42 | * @return ViolationMessage $message with the deserialized argument appended |
43 | 43 | */ |
44 | - private function deserializeArgument( ViolationMessage $message, array $serializedArgument ) { |
|
44 | + private function deserializeArgument(ViolationMessage $message, array $serializedArgument) { |
|
45 | 45 | $methods = [ |
46 | 46 | ]; |
47 | 47 | |
48 | 48 | $type = $serializedArgument['t']; |
49 | 49 | $serializedValue = $serializedArgument['v']; |
50 | 50 | $role = $serializedArgument['r']; |
51 | - if ( array_key_exists( 'a', $serializedArgument ) ) { |
|
51 | + if (array_key_exists('a', $serializedArgument)) { |
|
52 | 52 | $alternativeMessageKey = $this->unabbreviateViolationMessageKey( |
53 | 53 | $serializedArgument['a'] |
54 | 54 | ); |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | $alternativeMessageKey = null; |
57 | 57 | } |
58 | 58 | |
59 | - if ( array_key_exists( $type, $methods ) ) { |
|
59 | + if (array_key_exists($type, $methods)) { |
|
60 | 60 | $method = $methods[$type]; |
61 | - $value = $this->$method( $serializedValue ); |
|
61 | + $value = $this->$method($serializedValue); |
|
62 | 62 | } else { |
63 | 63 | throw new InvalidArgumentException( |
64 | - 'Unknown ViolationMessage argument type ' . $type . '!' |
|
64 | + 'Unknown ViolationMessage argument type '.$type.'!' |
|
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
68 | - return $message->withArgument( $type, $role, $value, $alternativeMessageKey ); |
|
68 | + return $message->withArgument($type, $role, $value, $alternativeMessageKey); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | } |
@@ -103,17 +103,17 @@ discard block |
||
103 | 103 | public function __construct( |
104 | 104 | $messageKey |
105 | 105 | ) { |
106 | - if ( strpos( $messageKey, self::MESSAGE_KEY_PREFIX ) !== 0 ) { |
|
106 | + if (strpos($messageKey, self::MESSAGE_KEY_PREFIX) !== 0) { |
|
107 | 107 | throw new InvalidArgumentException( |
108 | - 'ViolationMessage key ⧼' . |
|
109 | - $messageKey . |
|
110 | - '⧽ should start with "' . |
|
111 | - self::MESSAGE_KEY_PREFIX . |
|
108 | + 'ViolationMessage key ⧼'. |
|
109 | + $messageKey. |
|
110 | + '⧽ should start with "'. |
|
111 | + self::MESSAGE_KEY_PREFIX. |
|
112 | 112 | '".' |
113 | 113 | ); |
114 | 114 | } |
115 | 115 | |
116 | - $this->messageKeySuffix = substr( $messageKey, strlen( self::MESSAGE_KEY_PREFIX ) ); |
|
116 | + $this->messageKeySuffix = substr($messageKey, strlen(self::MESSAGE_KEY_PREFIX)); |
|
117 | 117 | $this->arguments = []; |
118 | 118 | } |
119 | 119 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @return string |
123 | 123 | */ |
124 | 124 | public function getMessageKey() { |
125 | - return self::MESSAGE_KEY_PREFIX . $this->messageKeySuffix; |
|
125 | + return self::MESSAGE_KEY_PREFIX.$this->messageKeySuffix; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | * @param mixed $value the value, which should match the $type |
143 | 143 | * @return ViolationMessage |
144 | 144 | */ |
145 | - public function withArgument( $type, $role, $value ) { |
|
145 | + public function withArgument($type, $role, $value) { |
|
146 | 146 | $ret = clone $this; |
147 | - $ret->arguments[] = [ 'type' => $type, 'role' => $role, 'value' => $value ]; |
|
147 | + $ret->arguments[] = ['type' => $type, 'role' => $role, 'value' => $value]; |
|
148 | 148 | return $ret; |
149 | 149 | } |
150 | 150 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | * @param string|null $role one of the Role::* constants |
157 | 157 | * @return ViolationMessage |
158 | 158 | */ |
159 | - public function withEntityId( EntityId $entityId, $role = null ) { |
|
160 | - return $this->withArgument( self::TYPE_ENTITY_ID, $role, $entityId ); |
|
159 | + public function withEntityId(EntityId $entityId, $role = null) { |
|
160 | + return $this->withArgument(self::TYPE_ENTITY_ID, $role, $entityId); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @param string|null $role one of the Role::* constants |
175 | 175 | * @return ViolationMessage |
176 | 176 | */ |
177 | - public function withEntityIdList( array $entityIdList, $role = null ) { |
|
178 | - return $this->withArgument( self::TYPE_ENTITY_ID_LIST, $role, $entityIdList ); |
|
177 | + public function withEntityIdList(array $entityIdList, $role = null) { |
|
178 | + return $this->withArgument(self::TYPE_ENTITY_ID_LIST, $role, $entityIdList); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param string|null $role one of the Role::* constants |
187 | 187 | * @return ViolationMessage |
188 | 188 | */ |
189 | - public function withItemIdSnakValue( ItemIdSnakValue $value, $role = null ) { |
|
190 | - return $this->withArgument( self::TYPE_ITEM_ID_SNAK_VALUE, $role, $value ); |
|
189 | + public function withItemIdSnakValue(ItemIdSnakValue $value, $role = null) { |
|
190 | + return $this->withArgument(self::TYPE_ITEM_ID_SNAK_VALUE, $role, $value); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | * @param string|null $role one of the Role::* constants |
205 | 205 | * @return ViolationMessage |
206 | 206 | */ |
207 | - public function withItemIdSnakValueList( array $valueList, $role = null ) { |
|
208 | - return $this->withArgument( self::TYPE_ITEM_ID_SNAK_VALUE_LIST, $role, $valueList ); |
|
207 | + public function withItemIdSnakValueList(array $valueList, $role = null) { |
|
208 | + return $this->withArgument(self::TYPE_ITEM_ID_SNAK_VALUE_LIST, $role, $valueList); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | * @param string|null $role one of the Role::* constants |
217 | 217 | * @return ViolationMessage |
218 | 218 | */ |
219 | - public function withDataValue( DataValue $dataValue, $role = null ) { |
|
220 | - return $this->withArgument( self::TYPE_DATA_VALUE, $role, $dataValue ); |
|
219 | + public function withDataValue(DataValue $dataValue, $role = null) { |
|
220 | + return $this->withArgument(self::TYPE_DATA_VALUE, $role, $dataValue); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * @param string|null $role one of the Role::* constants |
233 | 233 | * @return ViolationMessage |
234 | 234 | */ |
235 | - public function withDataValueType( $dataValueType, $role = null ) { |
|
236 | - return $this->withArgument( self::TYPE_DATA_VALUE_TYPE, $role, $dataValueType ); |
|
235 | + public function withDataValueType($dataValueType, $role = null) { |
|
236 | + return $this->withArgument(self::TYPE_DATA_VALUE_TYPE, $role, $dataValueType); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | * @param string|null $role one of the Role::* constants |
245 | 245 | * @return ViolationMessage |
246 | 246 | */ |
247 | - public function withInlineCode( $code, $role = null ) { |
|
248 | - return $this->withArgument( self::TYPE_INLINE_CODE, $role, $code ); |
|
247 | + public function withInlineCode($code, $role = null) { |
|
248 | + return $this->withArgument(self::TYPE_INLINE_CODE, $role, $code); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | * @param string|null $role one of the Role::* constants |
257 | 257 | * @return ViolationMessage |
258 | 258 | */ |
259 | - public function withConstraintScope( $scope, $role = null ) { |
|
260 | - return $this->withArgument( self::TYPE_CONSTRAINT_SCOPE, $role, $scope ); |
|
259 | + public function withConstraintScope($scope, $role = null) { |
|
260 | + return $this->withArgument(self::TYPE_CONSTRAINT_SCOPE, $role, $scope); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | * @param string|null $role one of the Role::* constants |
269 | 269 | * @return ViolationMessage |
270 | 270 | */ |
271 | - public function withConstraintScopeList( array $scopeList, $role = null ) { |
|
272 | - return $this->withArgument( self::TYPE_CONSTRAINT_SCOPE_LIST, $role, $scopeList ); |
|
271 | + public function withConstraintScopeList(array $scopeList, $role = null) { |
|
272 | + return $this->withArgument(self::TYPE_CONSTRAINT_SCOPE_LIST, $role, $scopeList); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | * @param string $languageCode |
285 | 285 | * @return ViolationMessage |
286 | 286 | */ |
287 | - public function withLanguage( $languageCode ) { |
|
288 | - return $this->withArgument( self::TYPE_LANGUAGE, null, $languageCode ); |
|
287 | + public function withLanguage($languageCode) { |
|
288 | + return $this->withArgument(self::TYPE_LANGUAGE, null, $languageCode); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | } |