@@ -83,54 +83,53 @@ discard block |
||
83 | 83 | ) { |
84 | 84 | $response = []; |
85 | 85 | $metadatas = []; |
86 | - $statusesFlipped = array_flip( $statuses ); |
|
87 | - foreach ( $entityIds as $entityId ) { |
|
86 | + $statusesFlipped = array_flip($statuses); |
|
87 | + foreach ($entityIds as $entityId) { |
|
88 | 88 | $results = $this->delegatingConstraintChecker->checkAgainstConstraintsOnEntityId( |
89 | 89 | $entityId, |
90 | 90 | $constraintIds, |
91 | - [ $this, 'defaultResults' ] |
|
91 | + [$this, 'defaultResults'] |
|
92 | 92 | ); |
93 | - $results = array_filter( $results, $this->statusSelected( $statusesFlipped ) ); |
|
94 | - foreach ( $results as $result ) { |
|
93 | + $results = array_filter($results, $this->statusSelected($statusesFlipped)); |
|
94 | + foreach ($results as $result) { |
|
95 | 95 | $metadatas[] = $result->getMetadata(); |
96 | - $resultArray = $this->checkResultToArray( $result ); |
|
97 | - $result->getContext()->storeCheckResultInArray( $resultArray, $response ); |
|
96 | + $resultArray = $this->checkResultToArray($result); |
|
97 | + $result->getContext()->storeCheckResultInArray($resultArray, $response); |
|
98 | 98 | } |
99 | 99 | } |
100 | - foreach ( $claimIds as $claimId ) { |
|
100 | + foreach ($claimIds as $claimId) { |
|
101 | 101 | $results = $this->delegatingConstraintChecker->checkAgainstConstraintsOnClaimId( |
102 | 102 | $claimId, |
103 | 103 | $constraintIds, |
104 | - [ $this, 'defaultResults' ] |
|
104 | + [$this, 'defaultResults'] |
|
105 | 105 | ); |
106 | - $results = array_filter( $results, $this->statusSelected( $statusesFlipped ) ); |
|
107 | - foreach ( $results as $result ) { |
|
106 | + $results = array_filter($results, $this->statusSelected($statusesFlipped)); |
|
107 | + foreach ($results as $result) { |
|
108 | 108 | $metadatas[] = $result->getMetadata(); |
109 | - $resultArray = $this->checkResultToArray( $result ); |
|
110 | - $result->getContext()->storeCheckResultInArray( $resultArray, $response ); |
|
109 | + $resultArray = $this->checkResultToArray($result); |
|
110 | + $result->getContext()->storeCheckResultInArray($resultArray, $response); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | return new CachedCheckConstraintsResponse( |
114 | 114 | $response, |
115 | - Metadata::merge( $metadatas ) |
|
115 | + Metadata::merge($metadatas) |
|
116 | 116 | ); |
117 | 117 | } |
118 | 118 | |
119 | - public function defaultResults( Context $context ) { |
|
119 | + public function defaultResults(Context $context) { |
|
120 | 120 | return $context->getType() === Context::TYPE_STATEMENT ? |
121 | - [ new NullResult( $context ) ] : |
|
122 | - []; |
|
121 | + [new NullResult($context)] : []; |
|
123 | 122 | } |
124 | 123 | |
125 | - public function statusSelected( array $statusesFlipped ) { |
|
126 | - return function( CheckResult $result ) use ( $statusesFlipped ) { |
|
127 | - return array_key_exists( $result->getStatus(), $statusesFlipped ) || |
|
124 | + public function statusSelected(array $statusesFlipped) { |
|
125 | + return function(CheckResult $result) use ($statusesFlipped) { |
|
126 | + return array_key_exists($result->getStatus(), $statusesFlipped) || |
|
128 | 127 | $result instanceof NullResult; |
129 | 128 | }; |
130 | 129 | } |
131 | 130 | |
132 | - public function checkResultToArray( CheckResult $checkResult ) { |
|
133 | - if ( $checkResult instanceof NullResult ) { |
|
131 | + public function checkResultToArray(CheckResult $checkResult) { |
|
132 | + if ($checkResult instanceof NullResult) { |
|
134 | 133 | return null; |
135 | 134 | } |
136 | 135 | |
@@ -138,10 +137,10 @@ discard block |
||
138 | 137 | $typeItemId = $checkResult->getConstraint()->getConstraintTypeItemId(); |
139 | 138 | $constraintPropertyId = $checkResult->getContext()->getSnak()->getPropertyId(); |
140 | 139 | |
141 | - $title = $this->entityTitleLookup->getTitleForId( $constraintPropertyId ); |
|
142 | - $typeLabel = $this->entityIdLabelFormatter->formatEntityId( new ItemId( $typeItemId ) ); |
|
140 | + $title = $this->entityTitleLookup->getTitleForId($constraintPropertyId); |
|
141 | + $typeLabel = $this->entityIdLabelFormatter->formatEntityId(new ItemId($typeItemId)); |
|
143 | 142 | // TODO link to the statement when possible (T169224) |
144 | - $link = $title->getFullURL() . '#' . $this->config->get( 'WBQualityConstraintsPropertyConstraintId' ); |
|
143 | + $link = $title->getFullURL().'#'.$this->config->get('WBQualityConstraintsPropertyConstraintId'); |
|
145 | 144 | |
146 | 145 | $constraint = [ |
147 | 146 | 'id' => $constraintId, |
@@ -150,11 +149,11 @@ discard block |
||
150 | 149 | 'link' => $link, |
151 | 150 | 'discussLink' => $title->getTalkPage()->getFullURL(), |
152 | 151 | ]; |
153 | - if ( $this->config->get( 'WBQualityConstraintsIncludeDetailInApi' ) ) { |
|
152 | + if ($this->config->get('WBQualityConstraintsIncludeDetailInApi')) { |
|
154 | 153 | $parameters = $checkResult->getParameters(); |
155 | 154 | $constraint += [ |
156 | 155 | 'detail' => $parameters, |
157 | - 'detailHTML' => $this->constraintParameterRenderer->formatParameters( $parameters ), |
|
156 | + 'detailHTML' => $this->constraintParameterRenderer->formatParameters($parameters), |
|
158 | 157 | ]; |
159 | 158 | } |
160 | 159 | |
@@ -164,14 +163,14 @@ discard block |
||
164 | 163 | 'constraint' => $constraint |
165 | 164 | ]; |
166 | 165 | $message = $checkResult->getMessage(); |
167 | - if ( $message ) { |
|
168 | - $result['message-html'] = $this->violationMessageRenderer->render( $message ); |
|
166 | + if ($message) { |
|
167 | + $result['message-html'] = $this->violationMessageRenderer->render($message); |
|
169 | 168 | } |
170 | - if ( $checkResult->getContext()->getType() === Context::TYPE_STATEMENT ) { |
|
169 | + if ($checkResult->getContext()->getType() === Context::TYPE_STATEMENT) { |
|
171 | 170 | $result['claim'] = $checkResult->getContext()->getSnakStatement()->getGuid(); |
172 | 171 | } |
173 | 172 | $cachingMetadataArray = $checkResult->getMetadata()->getCachingMetadata()->toArray(); |
174 | - if ( $cachingMetadataArray !== null ) { |
|
173 | + if ($cachingMetadataArray !== null) { |
|
175 | 174 | $result['cached'] = $cachingMetadataArray; |
176 | 175 | } |
177 | 176 |
@@ -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(); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | new ViolationMessageRenderer(), |
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( |
@@ -24,12 +24,12 @@ |
||
24 | 24 | $language = null, |
25 | 25 | $format = Message::FORMAT_ESCAPED |
26 | 26 | ) { |
27 | - if ( is_string( $violationMessage ) ) { |
|
27 | + if (is_string($violationMessage)) { |
|
28 | 28 | // TODO remove this once all checkers produce ViolationMessage objects |
29 | 29 | return $violationMessage; |
30 | 30 | } |
31 | - $message = new Message( $violationMessage->getMessageKey(), [], $language ); |
|
32 | - return $message->toString( $format ); |
|
31 | + $message = new Message($violationMessage->getMessageKey(), [], $language); |
|
32 | + return $message->toString($format); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | } |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $this->dataFactory = $dataFactory; |
47 | 47 | $this->logger = $logger; |
48 | 48 | $this->constraintCheckDurationLimits = [ |
49 | - 'info' => $config->get( 'WBQualityConstraintsCheckDurationInfoSeconds' ), |
|
50 | - 'warning' => $config->get( 'WBQualityConstraintsCheckDurationWarningSeconds' ), |
|
49 | + 'info' => $config->get('WBQualityConstraintsCheckDurationInfoSeconds'), |
|
50 | + 'warning' => $config->get('WBQualityConstraintsCheckDurationWarningSeconds'), |
|
51 | 51 | ]; |
52 | 52 | } |
53 | 53 | |
@@ -73,46 +73,46 @@ discard block |
||
73 | 73 | $durationSeconds, |
74 | 74 | $method |
75 | 75 | ) { |
76 | - $constraintCheckerClassShortName = substr( strrchr( $constraintCheckerClass, '\\' ), 1 ); |
|
76 | + $constraintCheckerClassShortName = substr(strrchr($constraintCheckerClass, '\\'), 1); |
|
77 | 77 | $constraintTypeItemId = $constraint->getConstraintTypeItemId(); |
78 | 78 | |
79 | 79 | $this->dataFactory->timing( |
80 | - 'wikibase.quality.constraints.check.timing.' . |
|
81 | - $constraintTypeItemId . '-' . |
|
80 | + 'wikibase.quality.constraints.check.timing.'. |
|
81 | + $constraintTypeItemId.'-'. |
|
82 | 82 | $constraintCheckerClassShortName, |
83 | 83 | $durationSeconds * 1000 |
84 | 84 | ); |
85 | 85 | |
86 | 86 | // find the longest limit (and associated log level) that the duration exceeds |
87 | - foreach ( $this->constraintCheckDurationLimits as $level => $limit ) { |
|
87 | + foreach ($this->constraintCheckDurationLimits as $level => $limit) { |
|
88 | 88 | if ( |
89 | 89 | // duration exceeds this limit |
90 | - isset( $limit ) && $durationSeconds > $limit && |
|
90 | + isset($limit) && $durationSeconds > $limit && |
|
91 | 91 | // this limit is longer than previous longest limit |
92 | - ( !isset( $limitSeconds ) || $limit > $limitSeconds ) |
|
92 | + (!isset($limitSeconds) || $limit > $limitSeconds) |
|
93 | 93 | ) { |
94 | 94 | $limitSeconds = $limit; |
95 | 95 | $logLevel = $level; |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - if ( !isset( $limitSeconds ) ) { |
|
99 | + if (!isset($limitSeconds)) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | - if ( $context->getType() !== Context::TYPE_STATEMENT ) { |
|
102 | + if ($context->getType() !== Context::TYPE_STATEMENT) { |
|
103 | 103 | // TODO log less details but still log something |
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
107 | 107 | $resultMessage = $result->getMessage(); |
108 | - if ( $resultMessage instanceof ViolationMessage ) { |
|
108 | + if ($resultMessage instanceof ViolationMessage) { |
|
109 | 109 | $resultMessage = $resultMessage->getMessageKey(); |
110 | 110 | } |
111 | 111 | |
112 | 112 | $this->logger->log( |
113 | 113 | $logLevel, |
114 | - 'Constraint check with {constraintCheckerClassShortName} ' . |
|
115 | - 'took longer than {limitSeconds} second(s) ' . |
|
114 | + 'Constraint check with {constraintCheckerClassShortName} '. |
|
115 | + 'took longer than {limitSeconds} second(s) '. |
|
116 | 116 | '(duration: {durationSeconds} seconds).', |
117 | 117 | [ |
118 | 118 | 'method' => $method, |
@@ -70,43 +70,43 @@ discard block |
||
70 | 70 | * @throws ConstraintParameterException |
71 | 71 | * @return CheckResult |
72 | 72 | */ |
73 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
74 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
75 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
73 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
74 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
75 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $parameters = []; |
79 | 79 | $constraintParameters = $constraint->getConstraintParameters(); |
80 | 80 | |
81 | - $properties = $this->constraintParameterParser->parsePropertiesParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
81 | + $properties = $this->constraintParameterParser->parsePropertiesParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
82 | 82 | $parameters['property'] = $properties; |
83 | 83 | |
84 | 84 | $message = null; |
85 | 85 | $status = CheckResult::STATUS_COMPLIANCE; |
86 | 86 | |
87 | 87 | /** @var Snak $qualifier */ |
88 | - foreach ( $context->getSnakStatement()->getQualifiers() as $qualifier ) { |
|
88 | + foreach ($context->getSnakStatement()->getQualifiers() as $qualifier) { |
|
89 | 89 | $allowedQualifier = false; |
90 | - foreach ( $properties as $property ) { |
|
91 | - if ( $qualifier->getPropertyId()->equals( $property ) ) { |
|
90 | + foreach ($properties as $property) { |
|
91 | + if ($qualifier->getPropertyId()->equals($property)) { |
|
92 | 92 | $allowedQualifier = true; |
93 | 93 | break; |
94 | 94 | } |
95 | 95 | } |
96 | - if ( !$allowedQualifier ) { |
|
97 | - if ( empty( $properties ) || $properties === [ '' ] ) { |
|
98 | - $message = wfMessage( 'wbqc-violation-message-no-qualifiers' ); |
|
96 | + if (!$allowedQualifier) { |
|
97 | + if (empty($properties) || $properties === ['']) { |
|
98 | + $message = wfMessage('wbqc-violation-message-no-qualifiers'); |
|
99 | 99 | $message->rawParams( |
100 | - $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ) |
|
100 | + $this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY) |
|
101 | 101 | ); |
102 | 102 | } else { |
103 | - $message = wfMessage( "wbqc-violation-message-qualifiers" ); |
|
103 | + $message = wfMessage("wbqc-violation-message-qualifiers"); |
|
104 | 104 | $message->rawParams( |
105 | - $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ), |
|
106 | - $this->constraintParameterRenderer->formatEntityId( $qualifier->getPropertyId(), Role::QUALIFIER_PREDICATE ) |
|
105 | + $this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY), |
|
106 | + $this->constraintParameterRenderer->formatEntityId($qualifier->getPropertyId(), Role::QUALIFIER_PREDICATE) |
|
107 | 107 | ); |
108 | - $message->numParams( count( $properties ) ); |
|
109 | - $message->rawParams( $this->constraintParameterRenderer->formatPropertyIdList( $properties, Role::QUALIFIER_PREDICATE ) ); |
|
108 | + $message->numParams(count($properties)); |
|
109 | + $message->rawParams($this->constraintParameterRenderer->formatPropertyIdList($properties, Role::QUALIFIER_PREDICATE)); |
|
110 | 110 | } |
111 | 111 | $message = $message->escaped(); |
112 | 112 | $status = CheckResult::STATUS_VIOLATION; |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
117 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
118 | 118 | } |
119 | 119 | |
120 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
120 | + public function checkConstraintParameters(Constraint $constraint) { |
|
121 | 121 | $constraintParameters = $constraint->getConstraintParameters(); |
122 | 122 | $exceptions = []; |
123 | 123 | try { |
124 | - $this->constraintParameterParser->parsePropertiesParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
125 | - } catch ( ConstraintParameterException $e ) { |
|
124 | + $this->constraintParameterParser->parsePropertiesParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
125 | + } catch (ConstraintParameterException $e) { |
|
126 | 126 | $exceptions[] = $e; |
127 | 127 | } |
128 | 128 | return $exceptions; |
@@ -70,43 +70,43 @@ |
||
70 | 70 | * @throws ConstraintParameterException |
71 | 71 | * @return CheckResult |
72 | 72 | */ |
73 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
74 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
75 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
73 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
74 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
75 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $parameters = []; |
79 | 79 | $constraintParameters = $constraint->getConstraintParameters(); |
80 | 80 | |
81 | - $propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
82 | - $parameters['property'] = [ $propertyId ]; |
|
81 | + $propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
82 | + $parameters['property'] = [$propertyId]; |
|
83 | 83 | |
84 | - $message = wfMessage( "wbqc-violation-message-mandatory-qualifier" ) |
|
84 | + $message = wfMessage("wbqc-violation-message-mandatory-qualifier") |
|
85 | 85 | ->rawParams( |
86 | - $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ), |
|
87 | - $this->constraintParameterRenderer->formatEntityId( $propertyId, Role::QUALIFIER_PREDICATE ) |
|
86 | + $this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY), |
|
87 | + $this->constraintParameterRenderer->formatEntityId($propertyId, Role::QUALIFIER_PREDICATE) |
|
88 | 88 | ) |
89 | 89 | ->escaped(); |
90 | 90 | $status = CheckResult::STATUS_VIOLATION; |
91 | 91 | |
92 | 92 | /** @var Snak $qualifier */ |
93 | - foreach ( $context->getSnakStatement()->getQualifiers() as $qualifier ) { |
|
94 | - if ( $propertyId->equals( $qualifier->getPropertyId() ) ) { |
|
93 | + foreach ($context->getSnakStatement()->getQualifiers() as $qualifier) { |
|
94 | + if ($propertyId->equals($qualifier->getPropertyId())) { |
|
95 | 95 | $message = null; |
96 | 96 | $status = CheckResult::STATUS_COMPLIANCE; |
97 | 97 | break; |
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
101 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
102 | 102 | } |
103 | 103 | |
104 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
104 | + public function checkConstraintParameters(Constraint $constraint) { |
|
105 | 105 | $constraintParameters = $constraint->getConstraintParameters(); |
106 | 106 | $exceptions = []; |
107 | 107 | try { |
108 | - $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
109 | - } catch ( ConstraintParameterException $e ) { |
|
108 | + $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
109 | + } catch (ConstraintParameterException $e) { |
|
110 | 110 | $exceptions[] = $e; |
111 | 111 | } |
112 | 112 | return $exceptions; |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | * @throws ConstraintParameterException |
85 | 85 | * @return CheckResult |
86 | 86 | */ |
87 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
88 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
89 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
87 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
88 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
89 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $parameters = []; |
@@ -94,42 +94,42 @@ discard block |
||
94 | 94 | |
95 | 95 | $snak = $context->getSnak(); |
96 | 96 | |
97 | - if ( !$snak instanceof PropertyValueSnak ) { |
|
97 | + if (!$snak instanceof PropertyValueSnak) { |
|
98 | 98 | // nothing to check |
99 | - return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE ); |
|
99 | + return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $dataValue = $snak->getDataValue(); |
103 | 103 | |
104 | - list( $min, $max ) = $this->constraintParameterParser->parseRangeParameter( |
|
104 | + list($min, $max) = $this->constraintParameterParser->parseRangeParameter( |
|
105 | 105 | $constraintParameters, |
106 | 106 | $constraint->getConstraintTypeItemId(), |
107 | 107 | $dataValue->getType() |
108 | 108 | ); |
109 | 109 | $parameterKey = $dataValue->getType() === 'quantity' ? 'quantity' : 'date'; |
110 | - if ( $min !== null ) { |
|
111 | - $parameters['minimum_' . $parameterKey] = [ $min ]; |
|
110 | + if ($min !== null) { |
|
111 | + $parameters['minimum_'.$parameterKey] = [$min]; |
|
112 | 112 | } |
113 | - if ( $max !== null ) { |
|
114 | - $parameters['maximum_' . $parameterKey] = [ $max ]; |
|
113 | + if ($max !== null) { |
|
114 | + $parameters['maximum_'.$parameterKey] = [$max]; |
|
115 | 115 | } |
116 | 116 | |
117 | - if ( $this->rangeCheckerHelper->getComparison( $min, $dataValue ) > 0 || |
|
118 | - $this->rangeCheckerHelper->getComparison( $dataValue, $max ) > 0 |
|
117 | + if ($this->rangeCheckerHelper->getComparison($min, $dataValue) > 0 || |
|
118 | + $this->rangeCheckerHelper->getComparison($dataValue, $max) > 0 |
|
119 | 119 | ) { |
120 | 120 | // at least one of $min, $max is set at this point, otherwise there could be no violation |
121 | 121 | $type = $dataValue->getType(); |
122 | - $openness = $min !== null ? ( $max !== null ? 'closed' : 'rightopen' ) : 'leftopen'; |
|
123 | - $message = wfMessage( "wbqc-violation-message-range-$type-$openness" ); |
|
122 | + $openness = $min !== null ? ($max !== null ? 'closed' : 'rightopen') : 'leftopen'; |
|
123 | + $message = wfMessage("wbqc-violation-message-range-$type-$openness"); |
|
124 | 124 | $message->rawParams( |
125 | - $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE ), |
|
126 | - $this->constraintParameterRenderer->formatDataValue( $dataValue, Role::OBJECT ) |
|
125 | + $this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE), |
|
126 | + $this->constraintParameterRenderer->formatDataValue($dataValue, Role::OBJECT) |
|
127 | 127 | ); |
128 | - if ( $min !== null ) { |
|
129 | - $message->rawParams( $this->constraintParameterRenderer->formatDataValue( $min, Role::OBJECT ) ); |
|
128 | + if ($min !== null) { |
|
129 | + $message->rawParams($this->constraintParameterRenderer->formatDataValue($min, Role::OBJECT)); |
|
130 | 130 | } |
131 | - if ( $max !== null ) { |
|
132 | - $message->rawParams( $this->constraintParameterRenderer->formatDataValue( $max, Role::OBJECT ) ); |
|
131 | + if ($max !== null) { |
|
132 | + $message->rawParams($this->constraintParameterRenderer->formatDataValue($max, Role::OBJECT)); |
|
133 | 133 | } |
134 | 134 | $message = $message->escaped(); |
135 | 135 | $status = CheckResult::STATUS_VIOLATION; |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | $status = CheckResult::STATUS_COMPLIANCE; |
139 | 139 | } |
140 | 140 | |
141 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
141 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
142 | 142 | } |
143 | 143 | |
144 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
144 | + public function checkConstraintParameters(Constraint $constraint) { |
|
145 | 145 | $constraintParameters = $constraint->getConstraintParameters(); |
146 | 146 | $exceptions = []; |
147 | 147 | try { |
148 | 148 | // we don’t have a data value here, so get the type from the property instead |
149 | 149 | // (the distinction between data type and data value type is irrelevant for 'quantity' and 'time') |
150 | - $type = $this->propertyDataTypeLookup->getDataTypeIdForProperty( $constraint->getPropertyId() ); |
|
150 | + $type = $this->propertyDataTypeLookup->getDataTypeIdForProperty($constraint->getPropertyId()); |
|
151 | 151 | $this->constraintParameterParser->parseRangeParameter( |
152 | 152 | $constraintParameters, |
153 | 153 | $constraint->getConstraintTypeItemId(), |
154 | 154 | $type |
155 | 155 | ); |
156 | - } catch ( ConstraintParameterException $e ) { |
|
156 | + } catch (ConstraintParameterException $e) { |
|
157 | 157 | $exceptions[] = $e; |
158 | 158 | } |
159 | 159 | return $exceptions; |
@@ -83,34 +83,34 @@ discard block |
||
83 | 83 | * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs |
84 | 84 | * @return CheckResult |
85 | 85 | */ |
86 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
87 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
88 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
86 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
87 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
88 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
89 | 89 | } |
90 | - if ( $context->getType() === Context::TYPE_REFERENCE ) { |
|
91 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE ); |
|
90 | + if ($context->getType() === Context::TYPE_REFERENCE) { |
|
91 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | $parameters = []; |
95 | 95 | $constraintParameters = $constraint->getConstraintParameters(); |
96 | 96 | |
97 | - $classes = $this->constraintParameterParser->parseClassParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
97 | + $classes = $this->constraintParameterParser->parseClassParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
98 | 98 | $parameters['class'] = array_map( |
99 | - function( $id ) { |
|
100 | - return new ItemId( $id ); |
|
99 | + function($id) { |
|
100 | + return new ItemId($id); |
|
101 | 101 | }, |
102 | 102 | $classes |
103 | 103 | ); |
104 | 104 | |
105 | - $relation = $this->constraintParameterParser->parseRelationParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
105 | + $relation = $this->constraintParameterParser->parseRelationParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
106 | 106 | $relationIds = []; |
107 | - if ( $relation === 'instance' || $relation === 'instanceOrSubclass' ) { |
|
108 | - $relationIds[] = $this->config->get( 'WBQualityConstraintsInstanceOfId' ); |
|
107 | + if ($relation === 'instance' || $relation === 'instanceOrSubclass') { |
|
108 | + $relationIds[] = $this->config->get('WBQualityConstraintsInstanceOfId'); |
|
109 | 109 | } |
110 | - if ( $relation === 'subclass' || $relation === 'instanceOrSubclass' ) { |
|
111 | - $relationIds[] = $this->config->get( 'WBQualityConstraintsSubclassOfId' ); |
|
110 | + if ($relation === 'subclass' || $relation === 'instanceOrSubclass') { |
|
111 | + $relationIds[] = $this->config->get('WBQualityConstraintsSubclassOfId'); |
|
112 | 112 | } |
113 | - $parameters['relation'] = [ $relation ]; |
|
113 | + $parameters['relation'] = [$relation]; |
|
114 | 114 | |
115 | 115 | $result = $this->typeCheckerHelper->hasClassInRelation( |
116 | 116 | $context->getEntity()->getStatements(), |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $classes |
119 | 119 | ); |
120 | 120 | |
121 | - if ( $result->getBool() ) { |
|
121 | + if ($result->getBool()) { |
|
122 | 122 | $message = null; |
123 | 123 | $status = CheckResult::STATUS_COMPLIANCE; |
124 | 124 | } else { |
@@ -132,21 +132,21 @@ discard block |
||
132 | 132 | $status = CheckResult::STATUS_VIOLATION; |
133 | 133 | } |
134 | 134 | |
135 | - return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) ) |
|
136 | - ->withMetadata( $result->getMetadata() ); |
|
135 | + return (new CheckResult($context, $constraint, $parameters, $status, $message)) |
|
136 | + ->withMetadata($result->getMetadata()); |
|
137 | 137 | } |
138 | 138 | |
139 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
139 | + public function checkConstraintParameters(Constraint $constraint) { |
|
140 | 140 | $constraintParameters = $constraint->getConstraintParameters(); |
141 | 141 | $exceptions = []; |
142 | 142 | try { |
143 | - $this->constraintParameterParser->parseClassParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
144 | - } catch ( ConstraintParameterException $e ) { |
|
143 | + $this->constraintParameterParser->parseClassParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
144 | + } catch (ConstraintParameterException $e) { |
|
145 | 145 | $exceptions[] = $e; |
146 | 146 | } |
147 | 147 | try { |
148 | - $this->constraintParameterParser->parseRelationParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
149 | - } catch ( ConstraintParameterException $e ) { |
|
148 | + $this->constraintParameterParser->parseRelationParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
149 | + } catch (ConstraintParameterException $e) { |
|
150 | 150 | $exceptions[] = $e; |
151 | 151 | } |
152 | 152 | return $exceptions; |
@@ -72,22 +72,22 @@ discard block |
||
72 | 72 | * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs |
73 | 73 | * @return CheckResult |
74 | 74 | */ |
75 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
76 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
77 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
75 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
76 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
77 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $parameters = []; |
81 | 81 | |
82 | - if ( $this->sparqlHelper !== null ) { |
|
83 | - if ( $context->getType() === 'statement' ) { |
|
82 | + if ($this->sparqlHelper !== null) { |
|
83 | + if ($context->getType() === 'statement') { |
|
84 | 84 | $result = $this->sparqlHelper->findEntitiesWithSameStatement( |
85 | 85 | $context->getSnakStatement(), |
86 | 86 | true // ignore deprecated statements |
87 | 87 | ); |
88 | 88 | } else { |
89 | - if ( $context->getSnak()->getType() !== 'value' ) { |
|
90 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
89 | + if ($context->getSnak()->getType() !== 'value') { |
|
90 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
91 | 91 | } |
92 | 92 | $result = $this->sparqlHelper->findEntitiesWithSameQualifierOrReference( |
93 | 93 | $context->getEntity()->getId(), |
@@ -100,29 +100,29 @@ discard block |
||
100 | 100 | $otherEntities = $result->getArray(); |
101 | 101 | $metadata = $result->getMetadata(); |
102 | 102 | |
103 | - if ( $otherEntities === [] ) { |
|
103 | + if ($otherEntities === []) { |
|
104 | 104 | $status = CheckResult::STATUS_COMPLIANCE; |
105 | 105 | $message = null; |
106 | 106 | } else { |
107 | 107 | $status = CheckResult::STATUS_VIOLATION; |
108 | - $message = wfMessage( 'wbqc-violation-message-unique-value' ) |
|
109 | - ->numParams( count( $otherEntities ) ) |
|
110 | - ->rawParams( $this->constraintParameterRenderer->formatEntityIdList( $otherEntities, Role::SUBJECT ) ) |
|
108 | + $message = wfMessage('wbqc-violation-message-unique-value') |
|
109 | + ->numParams(count($otherEntities)) |
|
110 | + ->rawParams($this->constraintParameterRenderer->formatEntityIdList($otherEntities, Role::SUBJECT)) |
|
111 | 111 | ->escaped(); |
112 | 112 | } |
113 | 113 | } else { |
114 | 114 | $status = CheckResult::STATUS_TODO; |
115 | - $message = wfMessage( "wbqc-violation-message-not-yet-implemented" ) |
|
116 | - ->rawParams( $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ) ) |
|
115 | + $message = wfMessage("wbqc-violation-message-not-yet-implemented") |
|
116 | + ->rawParams($this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM)) |
|
117 | 117 | ->escaped(); |
118 | 118 | $metadata = Metadata::blank(); |
119 | 119 | } |
120 | 120 | |
121 | - return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) ) |
|
122 | - ->withMetadata( $metadata ); |
|
121 | + return (new CheckResult($context, $constraint, $parameters, $status, $message)) |
|
122 | + ->withMetadata($metadata); |
|
123 | 123 | } |
124 | 124 | |
125 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
125 | + public function checkConstraintParameters(Constraint $constraint) { |
|
126 | 126 | // no parameters |
127 | 127 | return []; |
128 | 128 | } |