@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return CheckResult |
68 | 68 | */ |
69 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
70 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
71 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
69 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
70 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
71 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $parameters = []; |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | |
81 | 81 | $propertyId = $context->getSnak()->getPropertyId(); |
82 | 82 | $bestRankCount = $this->valueCountCheckerHelper->getPropertyCount( |
83 | - $context->getSnakGroup( Context::GROUP_BEST_RANK, $separators ), |
|
83 | + $context->getSnakGroup(Context::GROUP_BEST_RANK, $separators), |
|
84 | 84 | $propertyId |
85 | 85 | ); |
86 | 86 | |
87 | - if ( $bestRankCount > 1 ) { |
|
87 | + if ($bestRankCount > 1) { |
|
88 | 88 | $nonDeprecatedCount = $this->valueCountCheckerHelper->getPropertyCount( |
89 | - $context->getSnakGroup( Context::GROUP_NON_DEPRECATED ), |
|
89 | + $context->getSnakGroup(Context::GROUP_NON_DEPRECATED), |
|
90 | 90 | $propertyId |
91 | 91 | ); |
92 | 92 | $message = $this->getViolationMessage( |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | $status = CheckResult::STATUS_COMPLIANCE; |
102 | 102 | } |
103 | 103 | |
104 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
104 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
105 | 105 | } |
106 | 106 | |
107 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
107 | + public function checkConstraintParameters(Constraint $constraint) { |
|
108 | 108 | $constraintParameters = $constraint->getConstraintParameters(); |
109 | 109 | $exceptions = []; |
110 | 110 | try { |
111 | - $this->constraintParameterParser->parseSeparatorsParameter( $constraintParameters ); |
|
112 | - } catch ( ConstraintParameterException $e ) { |
|
111 | + $this->constraintParameterParser->parseSeparatorsParameter($constraintParameters); |
|
112 | + } catch (ConstraintParameterException $e) { |
|
113 | 113 | $exceptions[] = $e; |
114 | 114 | } |
115 | 115 | return $exceptions; |
@@ -128,23 +128,23 @@ discard block |
||
128 | 128 | $separators, |
129 | 129 | $propertyId |
130 | 130 | ) { |
131 | - if ( $bestRankCount === $nonDeprecatedCount ) { |
|
132 | - if ( $separators === [] ) { |
|
131 | + if ($bestRankCount === $nonDeprecatedCount) { |
|
132 | + if ($separators === []) { |
|
133 | 133 | $messageKey = 'wbqc-violation-message-single-best-value-no-preferred'; |
134 | 134 | } else { |
135 | 135 | $messageKey = 'wbqc-violation-message-single-best-value-no-preferred-separators'; |
136 | 136 | } |
137 | 137 | } else { |
138 | - if ( $separators === [] ) { |
|
138 | + if ($separators === []) { |
|
139 | 139 | $messageKey = 'wbqc-violation-message-single-best-value-multi-preferred'; |
140 | 140 | } else { |
141 | 141 | $messageKey = 'wbqc-violation-message-single-best-value-multi-preferred-separators'; |
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - return ( new ViolationMessage( $messageKey ) ) |
|
146 | - ->withEntityId( $propertyId ) |
|
147 | - ->withEntityIdList( $separators ); |
|
145 | + return (new ViolationMessage($messageKey)) |
|
146 | + ->withEntityId($propertyId) |
|
147 | + ->withEntityIdList($separators); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | } |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @throws ConstraintParameterException |
68 | 68 | * @return CheckResult |
69 | 69 | */ |
70 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
71 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
72 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
70 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
71 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
72 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $parameters = []; |
@@ -81,19 +81,19 @@ discard block |
||
81 | 81 | |
82 | 82 | $propertyId = $context->getSnak()->getPropertyId(); |
83 | 83 | $propertyCount = $this->valueCountCheckerHelper->getPropertyCount( |
84 | - $context->getSnakGroup( Context::GROUP_NON_DEPRECATED, $separators ), |
|
84 | + $context->getSnakGroup(Context::GROUP_NON_DEPRECATED, $separators), |
|
85 | 85 | $propertyId |
86 | 86 | ); |
87 | 87 | |
88 | - if ( $propertyCount > 1 ) { |
|
89 | - $message = $this->getViolationMessage( $separators, $propertyId ); |
|
88 | + if ($propertyCount > 1) { |
|
89 | + $message = $this->getViolationMessage($separators, $propertyId); |
|
90 | 90 | $status = CheckResult::STATUS_VIOLATION; |
91 | 91 | } else { |
92 | 92 | $message = null; |
93 | 93 | $status = CheckResult::STATUS_COMPLIANCE; |
94 | 94 | } |
95 | 95 | |
96 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
96 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -101,22 +101,21 @@ discard block |
||
101 | 101 | * @param PropertyId $propertyId |
102 | 102 | * @return ViolationMessage |
103 | 103 | */ |
104 | - private function getViolationMessage( array $separators, PropertyId $propertyId ) { |
|
104 | + private function getViolationMessage(array $separators, PropertyId $propertyId) { |
|
105 | 105 | $messageKey = $separators === [] ? |
106 | - 'wbqc-violation-message-single-value' : |
|
107 | - 'wbqc-violation-message-single-value-separators'; |
|
106 | + 'wbqc-violation-message-single-value' : 'wbqc-violation-message-single-value-separators'; |
|
108 | 107 | |
109 | - return ( new ViolationMessage( $messageKey ) ) |
|
110 | - ->withEntityId( $propertyId ) |
|
111 | - ->withEntityIdList( $separators ); |
|
108 | + return (new ViolationMessage($messageKey)) |
|
109 | + ->withEntityId($propertyId) |
|
110 | + ->withEntityIdList($separators); |
|
112 | 111 | } |
113 | 112 | |
114 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
113 | + public function checkConstraintParameters(Constraint $constraint) { |
|
115 | 114 | $constraintParameters = $constraint->getConstraintParameters(); |
116 | 115 | $exceptions = []; |
117 | 116 | try { |
118 | - $this->constraintParameterParser->parseSeparatorsParameter( $constraintParameters ); |
|
119 | - } catch ( ConstraintParameterException $e ) { |
|
117 | + $this->constraintParameterParser->parseSeparatorsParameter($constraintParameters); |
|
118 | + } catch (ConstraintParameterException $e) { |
|
120 | 119 | $exceptions[] = $e; |
121 | 120 | } |
122 | 121 | return $exceptions; |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return CheckResult |
67 | 67 | */ |
68 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
69 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
70 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
68 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
69 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
70 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $parameters = []; |
@@ -79,33 +79,32 @@ discard block |
||
79 | 79 | |
80 | 80 | $propertyId = $context->getSnak()->getPropertyId(); |
81 | 81 | $propertyCount = $this->valueCountCheckerHelper->getPropertyCount( |
82 | - $context->getSnakGroup( Context::GROUP_NON_DEPRECATED, $separators ), |
|
82 | + $context->getSnakGroup(Context::GROUP_NON_DEPRECATED, $separators), |
|
83 | 83 | $propertyId |
84 | 84 | ); |
85 | 85 | |
86 | - if ( $propertyCount <= 1 ) { |
|
87 | - $message = ( new ViolationMessage( |
|
86 | + if ($propertyCount <= 1) { |
|
87 | + $message = (new ViolationMessage( |
|
88 | 88 | $separators === [] ? |
89 | - 'wbqc-violation-message-multi-value' : |
|
90 | - 'wbqc-violation-message-multi-value-separators' |
|
91 | - ) ) |
|
92 | - ->withEntityId( $propertyId ) |
|
93 | - ->withEntityIdList( $separators ); |
|
89 | + 'wbqc-violation-message-multi-value' : 'wbqc-violation-message-multi-value-separators' |
|
90 | + )) |
|
91 | + ->withEntityId($propertyId) |
|
92 | + ->withEntityIdList($separators); |
|
94 | 93 | $status = CheckResult::STATUS_VIOLATION; |
95 | 94 | } else { |
96 | 95 | $message = null; |
97 | 96 | $status = CheckResult::STATUS_COMPLIANCE; |
98 | 97 | } |
99 | 98 | |
100 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
99 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
101 | 100 | } |
102 | 101 | |
103 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
102 | + public function checkConstraintParameters(Constraint $constraint) { |
|
104 | 103 | $constraintParameters = $constraint->getConstraintParameters(); |
105 | 104 | $exceptions = []; |
106 | 105 | try { |
107 | - $this->constraintParameterParser->parseSeparatorsParameter( $constraintParameters ); |
|
108 | - } catch ( ConstraintParameterException $e ) { |
|
106 | + $this->constraintParameterParser->parseSeparatorsParameter($constraintParameters); |
|
107 | + } catch (ConstraintParameterException $e) { |
|
109 | 108 | $exceptions[] = $e; |
110 | 109 | } |
111 | 110 | return $exceptions; |
@@ -88,39 +88,39 @@ discard block |
||
88 | 88 | * @throws ConstraintParameterException |
89 | 89 | * @return CheckResult |
90 | 90 | */ |
91 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
92 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
93 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
91 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
92 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
93 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $parameters = []; |
97 | 97 | $constraintParameters = $constraint->getConstraintParameters(); |
98 | 98 | |
99 | - $propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
100 | - $parameters['property'] = [ $propertyId ]; |
|
99 | + $propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
100 | + $parameters['property'] = [$propertyId]; |
|
101 | 101 | |
102 | - $items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false ); |
|
102 | + $items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false); |
|
103 | 103 | $parameters['items'] = $items; |
104 | 104 | |
105 | 105 | /** @var StatementList $statementList */ |
106 | 106 | $statementList = $context->getEntity() |
107 | 107 | ->getStatements() |
108 | - ->getByRank( [ Statement::RANK_PREFERRED, Statement::RANK_NORMAL ] ); |
|
108 | + ->getByRank([Statement::RANK_PREFERRED, Statement::RANK_NORMAL]); |
|
109 | 109 | |
110 | 110 | /* |
111 | 111 | * 'Conflicts with' can be defined with |
112 | 112 | * a) a property only |
113 | 113 | * b) a property and a number of items (each combination of property and item forming an individual claim) |
114 | 114 | */ |
115 | - if ( $items === [] ) { |
|
115 | + if ($items === []) { |
|
116 | 116 | $offendingStatement = $this->connectionCheckerHelper->findStatementWithProperty( |
117 | 117 | $statementList, |
118 | 118 | $propertyId |
119 | 119 | ); |
120 | - if ( $offendingStatement !== null ) { |
|
121 | - $message = ( new ViolationMessage( 'wbqc-violation-message-conflicts-with-property' ) ) |
|
122 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ) |
|
123 | - ->withEntityId( $propertyId, Role::PREDICATE ); |
|
120 | + if ($offendingStatement !== null) { |
|
121 | + $message = (new ViolationMessage('wbqc-violation-message-conflicts-with-property')) |
|
122 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY) |
|
123 | + ->withEntityId($propertyId, Role::PREDICATE); |
|
124 | 124 | $status = CheckResult::STATUS_VIOLATION; |
125 | 125 | } else { |
126 | 126 | $message = null; |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | $propertyId, |
133 | 133 | $items |
134 | 134 | ); |
135 | - if ( $offendingStatement !== null ) { |
|
136 | - $offendingValue = ItemIdSnakValue::fromSnak( $offendingStatement->getMainSnak() ); |
|
137 | - $message = ( new ViolationMessage( 'wbqc-violation-message-conflicts-with-claim' ) ) |
|
138 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ) |
|
139 | - ->withEntityId( $propertyId, Role::PREDICATE ) |
|
140 | - ->withItemIdSnakValue( $offendingValue, Role::OBJECT ); |
|
135 | + if ($offendingStatement !== null) { |
|
136 | + $offendingValue = ItemIdSnakValue::fromSnak($offendingStatement->getMainSnak()); |
|
137 | + $message = (new ViolationMessage('wbqc-violation-message-conflicts-with-claim')) |
|
138 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY) |
|
139 | + ->withEntityId($propertyId, Role::PREDICATE) |
|
140 | + ->withItemIdSnakValue($offendingValue, Role::OBJECT); |
|
141 | 141 | $status = CheckResult::STATUS_VIOLATION; |
142 | 142 | } else { |
143 | 143 | $message = null; |
@@ -145,20 +145,20 @@ discard block |
||
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
148 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
149 | 149 | } |
150 | 150 | |
151 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
151 | + public function checkConstraintParameters(Constraint $constraint) { |
|
152 | 152 | $constraintParameters = $constraint->getConstraintParameters(); |
153 | 153 | $exceptions = []; |
154 | 154 | try { |
155 | - $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
156 | - } catch ( ConstraintParameterException $e ) { |
|
155 | + $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
156 | + } catch (ConstraintParameterException $e) { |
|
157 | 157 | $exceptions[] = $e; |
158 | 158 | } |
159 | 159 | try { |
160 | - $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false ); |
|
161 | - } catch ( ConstraintParameterException $e ) { |
|
160 | + $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false); |
|
161 | + } catch (ConstraintParameterException $e) { |
|
162 | 162 | $exceptions[] = $e; |
163 | 163 | } |
164 | 164 | return $exceptions; |
@@ -91,28 +91,28 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return self |
93 | 93 | */ |
94 | - public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) { |
|
94 | + public static function newFromGlobalState(ApiMain $main, $name, $prefix = '') { |
|
95 | 95 | $repo = WikibaseRepo::getDefaultInstance(); |
96 | 96 | |
97 | 97 | $language = $repo->getUserLanguage(); |
98 | 98 | $formatterOptions = new FormatterOptions(); |
99 | - $formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() ); |
|
99 | + $formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode()); |
|
100 | 100 | $valueFormatterFactory = $repo->getValueFormatterFactory(); |
101 | - $valueFormatter = $valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions ); |
|
101 | + $valueFormatter = $valueFormatterFactory->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions); |
|
102 | 102 | |
103 | 103 | $languageFallbackLabelDescriptionLookupFactory = $repo->getLanguageFallbackLabelDescriptionLookupFactory(); |
104 | - $labelDescriptionLookup = $languageFallbackLabelDescriptionLookupFactory->newLabelDescriptionLookup( $language ); |
|
104 | + $labelDescriptionLookup = $languageFallbackLabelDescriptionLookupFactory->newLabelDescriptionLookup($language); |
|
105 | 105 | $entityIdHtmlLinkFormatterFactory = $repo->getEntityIdHtmlLinkFormatterFactory(); |
106 | - $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( $labelDescriptionLookup ); |
|
106 | + $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter($labelDescriptionLookup); |
|
107 | 107 | $entityIdLabelFormatterFactory = new EntityIdLabelFormatterFactory(); |
108 | - $entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter( $labelDescriptionLookup ); |
|
108 | + $entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter($labelDescriptionLookup); |
|
109 | 109 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
110 | 110 | $titleParser = MediaWikiServices::getInstance()->getTitleParser(); |
111 | 111 | $unitConverter = $repo->getUnitConverter(); |
112 | 112 | $dataFactory = MediaWikiServices::getInstance()->getStatsdDataFactory(); |
113 | 113 | $loggingHelper = new LoggingHelper( |
114 | 114 | $dataFactory, |
115 | - LoggerFactory::getInstance( 'WikibaseQualityConstraints' ), |
|
115 | + LoggerFactory::getInstance('WikibaseQualityConstraints'), |
|
116 | 116 | $config |
117 | 117 | ); |
118 | 118 | $constraintReportFactory = new ConstraintReportFactory( |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $resultsSource = new CheckingResultsSource( |
152 | 152 | $constraintReportFactory->getConstraintChecker() |
153 | 153 | ); |
154 | - if ( $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) { |
|
154 | + if ($config->get('WBQualityConstraintsCacheCheckConstraintsResults')) { |
|
155 | 155 | $wikiPageEntityMetaDataAccessor = new WikiPageEntityMetaDataLookup( |
156 | 156 | $repo->getEntityNamespaceLookup() |
157 | 157 | ); |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | $checkResultDeserializer, |
181 | 181 | $wikiPageEntityMetaDataAccessor, |
182 | 182 | $entityIdParser, |
183 | - $config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ), |
|
183 | + $config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'), |
|
184 | 184 | [ |
185 | - $config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ), |
|
186 | - $config->get( 'WBQualityConstraintsTypeConstraintId' ), |
|
187 | - $config->get( 'WBQualityConstraintsValueTypeConstraintId' ), |
|
188 | - $config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ), |
|
185 | + $config->get('WBQualityConstraintsCommonsLinkConstraintId'), |
|
186 | + $config->get('WBQualityConstraintsTypeConstraintId'), |
|
187 | + $config->get('WBQualityConstraintsValueTypeConstraintId'), |
|
188 | + $config->get('WBQualityConstraintsDistinctValuesConstraintId'), |
|
189 | 189 | ], |
190 | - $config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ), |
|
190 | + $config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'), |
|
191 | 191 | $loggingHelper |
192 | 192 | ); |
193 | 193 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $prefix, |
199 | 199 | $repo->getEntityIdParser(), |
200 | 200 | $repo->getStatementGuidValidator(), |
201 | - $repo->getApiHelperFactory( RequestContext::getMain() ), |
|
201 | + $repo->getApiHelperFactory(RequestContext::getMain()), |
|
202 | 202 | $resultsSource, |
203 | 203 | $checkResultsRenderer, |
204 | 204 | $dataFactory |
@@ -227,11 +227,11 @@ discard block |
||
227 | 227 | CheckResultsRenderer $checkResultsRenderer, |
228 | 228 | IBufferingStatsdDataFactory $dataFactory |
229 | 229 | ) { |
230 | - parent::__construct( $main, $name, $prefix ); |
|
230 | + parent::__construct($main, $name, $prefix); |
|
231 | 231 | $this->entityIdParser = $entityIdParser; |
232 | 232 | $this->statementGuidValidator = $statementGuidValidator; |
233 | - $this->resultBuilder = $apiHelperFactory->getResultBuilder( $this ); |
|
234 | - $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); |
|
233 | + $this->resultBuilder = $apiHelperFactory->getResultBuilder($this); |
|
234 | + $this->errorReporter = $apiHelperFactory->getErrorReporter($this); |
|
235 | 235 | $this->resultsSource = $resultsSource; |
236 | 236 | $this->checkResultsRenderer = $checkResultsRenderer; |
237 | 237 | $this->dataFactory = $dataFactory; |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | |
248 | 248 | $params = $this->extractRequestParams(); |
249 | 249 | |
250 | - $this->validateParameters( $params ); |
|
251 | - $entityIds = $this->parseEntityIds( $params ); |
|
252 | - $claimIds = $this->parseClaimIds( $params ); |
|
250 | + $this->validateParameters($params); |
|
251 | + $entityIds = $this->parseEntityIds($params); |
|
252 | + $claimIds = $this->parseClaimIds($params); |
|
253 | 253 | $constraintIDs = $params[self::PARAM_CONSTRAINT_ID]; |
254 | 254 | $statuses = $params[self::PARAM_STATUS]; |
255 | 255 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | ) |
266 | 266 | )->getArray() |
267 | 267 | ); |
268 | - $this->resultBuilder->markSuccess( 1 ); |
|
268 | + $this->resultBuilder->markSuccess(1); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -273,24 +273,24 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return EntityId[] |
275 | 275 | */ |
276 | - private function parseEntityIds( array $params ) { |
|
276 | + private function parseEntityIds(array $params) { |
|
277 | 277 | $ids = $params[self::PARAM_ID]; |
278 | 278 | |
279 | - if ( $ids === null ) { |
|
279 | + if ($ids === null) { |
|
280 | 280 | return []; |
281 | - } elseif ( $ids === [] ) { |
|
281 | + } elseif ($ids === []) { |
|
282 | 282 | $this->errorReporter->dieError( |
283 | - 'If ' . self::PARAM_ID . ' is specified, it must be nonempty.', 'no-data' ); |
|
283 | + 'If '.self::PARAM_ID.' is specified, it must be nonempty.', 'no-data' ); |
|
284 | 284 | } |
285 | 285 | |
286 | - return array_map( function ( $id ) { |
|
286 | + return array_map(function($id) { |
|
287 | 287 | try { |
288 | - return $this->entityIdParser->parse( $id ); |
|
289 | - } catch ( EntityIdParsingException $e ) { |
|
288 | + return $this->entityIdParser->parse($id); |
|
289 | + } catch (EntityIdParsingException $e) { |
|
290 | 290 | $this->errorReporter->dieError( |
291 | - "Invalid id: $id", 'invalid-entity-id', 0, [ self::PARAM_ID => $id ] ); |
|
291 | + "Invalid id: $id", 'invalid-entity-id', 0, [self::PARAM_ID => $id] ); |
|
292 | 292 | } |
293 | - }, $ids ); |
|
293 | + }, $ids); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -298,35 +298,35 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @return string[] |
300 | 300 | */ |
301 | - private function parseClaimIds( array $params ) { |
|
301 | + private function parseClaimIds(array $params) { |
|
302 | 302 | $ids = $params[self::PARAM_CLAIM_ID]; |
303 | 303 | |
304 | - if ( $ids === null ) { |
|
304 | + if ($ids === null) { |
|
305 | 305 | return []; |
306 | - } elseif ( $ids === [] ) { |
|
306 | + } elseif ($ids === []) { |
|
307 | 307 | $this->errorReporter->dieError( |
308 | - 'If ' . self::PARAM_CLAIM_ID . ' is specified, it must be nonempty.', 'no-data' ); |
|
308 | + 'If '.self::PARAM_CLAIM_ID.' is specified, it must be nonempty.', 'no-data' ); |
|
309 | 309 | } |
310 | 310 | |
311 | - foreach ( $ids as $id ) { |
|
312 | - if ( !$this->statementGuidValidator->validate( $id ) ) { |
|
311 | + foreach ($ids as $id) { |
|
312 | + if (!$this->statementGuidValidator->validate($id)) { |
|
313 | 313 | $this->errorReporter->dieError( |
314 | - "Invalid claim id: $id", 'invalid-guid', 0, [ self::PARAM_CLAIM_ID => $id ] ); |
|
314 | + "Invalid claim id: $id", 'invalid-guid', 0, [self::PARAM_CLAIM_ID => $id] ); |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | |
318 | 318 | return $ids; |
319 | 319 | } |
320 | 320 | |
321 | - private function validateParameters( array $params ) { |
|
322 | - if ( $params[self::PARAM_CONSTRAINT_ID] !== null |
|
323 | - && empty( $params[self::PARAM_CONSTRAINT_ID] ) |
|
321 | + private function validateParameters(array $params) { |
|
322 | + if ($params[self::PARAM_CONSTRAINT_ID] !== null |
|
323 | + && empty($params[self::PARAM_CONSTRAINT_ID]) |
|
324 | 324 | ) { |
325 | 325 | $paramConstraintId = self::PARAM_CONSTRAINT_ID; |
326 | 326 | $this->errorReporter->dieError( |
327 | 327 | "If $paramConstraintId is specified, it must be nonempty.", 'no-data' ); |
328 | 328 | } |
329 | - if ( $params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null ) { |
|
329 | + if ($params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null) { |
|
330 | 330 | $paramId = self::PARAM_ID; |
331 | 331 | $paramClaimId = self::PARAM_CLAIM_ID; |
332 | 332 | $this->errorReporter->dieError( |
@@ -366,11 +366,11 @@ discard block |
||
366 | 366 | ], |
367 | 367 | ApiBase::PARAM_ISMULTI => true, |
368 | 368 | ApiBase::PARAM_ALL => true, |
369 | - ApiBase::PARAM_DFLT => implode( '|', [ |
|
369 | + ApiBase::PARAM_DFLT => implode('|', [ |
|
370 | 370 | CheckResult::STATUS_VIOLATION, |
371 | 371 | CheckResult::STATUS_WARNING, |
372 | 372 | CheckResult::STATUS_BAD_PARAMETERS, |
373 | - ] ), |
|
373 | + ]), |
|
374 | 374 | ApiBase::PARAM_HELP_MSG_PER_VALUE => [], |
375 | 375 | ], |
376 | 376 | ]; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | public static function getDefaultInstance() { |
149 | 149 | static $instance = null; |
150 | 150 | |
151 | - if ( $instance === null ) { |
|
151 | + if ($instance === null) { |
|
152 | 152 | $wikibaseRepo = WikibaseRepo::getDefaultInstance(); |
153 | 153 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
154 | 154 | $titleParser = MediaWikiServices::getInstance()->getTitleParser(); |
@@ -211,21 +211,21 @@ discard block |
||
211 | 211 | * @return DelegatingConstraintChecker |
212 | 212 | */ |
213 | 213 | public function getConstraintChecker() { |
214 | - if ( $this->delegatingConstraintChecker === null ) { |
|
214 | + if ($this->delegatingConstraintChecker === null) { |
|
215 | 215 | $this->delegatingConstraintChecker = new DelegatingConstraintChecker( |
216 | 216 | $this->lookup, |
217 | 217 | $this->getConstraintCheckerMap(), |
218 | - new CachingConstraintLookup( $this->getConstraintRepository() ), |
|
218 | + new CachingConstraintLookup($this->getConstraintRepository()), |
|
219 | 219 | $this->constraintParameterParser, |
220 | 220 | $this->statementGuidParser, |
221 | 221 | new LoggingHelper( |
222 | 222 | $this->dataFactory, |
223 | - LoggerFactory::getInstance( 'WikibaseQualityConstraints' ), |
|
223 | + LoggerFactory::getInstance('WikibaseQualityConstraints'), |
|
224 | 224 | $this->config |
225 | 225 | ), |
226 | - $this->config->get( 'WBQualityConstraintsCheckQualifiers' ), |
|
227 | - $this->config->get( 'WBQualityConstraintsCheckReferences' ), |
|
228 | - $this->config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' ) |
|
226 | + $this->config->get('WBQualityConstraintsCheckQualifiers'), |
|
227 | + $this->config->get('WBQualityConstraintsCheckReferences'), |
|
228 | + $this->config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers') |
|
229 | 229 | ); |
230 | 230 | } |
231 | 231 | |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | * @return ConstraintChecker[] |
237 | 237 | */ |
238 | 238 | private function getConstraintCheckerMap() { |
239 | - if ( $this->constraintCheckerMap === null ) { |
|
239 | + if ($this->constraintCheckerMap === null) { |
|
240 | 240 | $connectionCheckerHelper = new ConnectionCheckerHelper(); |
241 | - $rangeCheckerHelper = new RangeCheckerHelper( $this->config, $this->unitConverter ); |
|
242 | - if ( $this->config->get( 'WBQualityConstraintsSparqlEndpoint' ) !== '' ) { |
|
241 | + $rangeCheckerHelper = new RangeCheckerHelper($this->config, $this->unitConverter); |
|
242 | + if ($this->config->get('WBQualityConstraintsSparqlEndpoint') !== '') { |
|
243 | 243 | $sparqlHelper = new SparqlHelper( |
244 | 244 | $this->config, |
245 | 245 | $this->rdfVocabulary, |
@@ -261,116 +261,116 @@ discard block |
||
261 | 261 | ); |
262 | 262 | |
263 | 263 | $this->constraintCheckerMap = [ |
264 | - $this->config->get( 'WBQualityConstraintsConflictsWithConstraintId' ) |
|
264 | + $this->config->get('WBQualityConstraintsConflictsWithConstraintId') |
|
265 | 265 | => new ConflictsWithChecker( |
266 | 266 | $this->lookup, |
267 | 267 | $this->constraintParameterParser, |
268 | 268 | $connectionCheckerHelper |
269 | 269 | ), |
270 | - $this->config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' ) |
|
270 | + $this->config->get('WBQualityConstraintsItemRequiresClaimConstraintId') |
|
271 | 271 | => new ItemChecker( |
272 | 272 | $this->lookup, |
273 | 273 | $this->constraintParameterParser, |
274 | 274 | $connectionCheckerHelper |
275 | 275 | ), |
276 | - $this->config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' ) |
|
276 | + $this->config->get('WBQualityConstraintsValueRequiresClaimConstraintId') |
|
277 | 277 | => new TargetRequiredClaimChecker( |
278 | 278 | $this->lookup, |
279 | 279 | $this->constraintParameterParser, |
280 | 280 | $connectionCheckerHelper |
281 | 281 | ), |
282 | - $this->config->get( 'WBQualityConstraintsSymmetricConstraintId' ) |
|
282 | + $this->config->get('WBQualityConstraintsSymmetricConstraintId') |
|
283 | 283 | => new SymmetricChecker( |
284 | 284 | $this->lookup, |
285 | 285 | $connectionCheckerHelper |
286 | 286 | ), |
287 | - $this->config->get( 'WBQualityConstraintsInverseConstraintId' ) |
|
287 | + $this->config->get('WBQualityConstraintsInverseConstraintId') |
|
288 | 288 | => new InverseChecker( |
289 | 289 | $this->lookup, |
290 | 290 | $this->constraintParameterParser, |
291 | 291 | $connectionCheckerHelper |
292 | 292 | ), |
293 | - $this->config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' ) |
|
293 | + $this->config->get('WBQualityConstraintsUsedAsQualifierConstraintId') |
|
294 | 294 | => new QualifierChecker(), |
295 | - $this->config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' ) |
|
295 | + $this->config->get('WBQualityConstraintsAllowedQualifiersConstraintId') |
|
296 | 296 | => new QualifiersChecker( |
297 | 297 | $this->constraintParameterParser |
298 | 298 | ), |
299 | - $this->config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' ) |
|
299 | + $this->config->get('WBQualityConstraintsMandatoryQualifierConstraintId') |
|
300 | 300 | => new MandatoryQualifiersChecker( |
301 | 301 | $this->constraintParameterParser |
302 | 302 | ), |
303 | - $this->config->get( 'WBQualityConstraintsRangeConstraintId' ) |
|
303 | + $this->config->get('WBQualityConstraintsRangeConstraintId') |
|
304 | 304 | => new RangeChecker( |
305 | 305 | $this->propertyDataTypeLookup, |
306 | 306 | $this->constraintParameterParser, |
307 | 307 | $rangeCheckerHelper |
308 | 308 | ), |
309 | - $this->config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' ) |
|
309 | + $this->config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId') |
|
310 | 310 | => new DiffWithinRangeChecker( |
311 | 311 | $this->constraintParameterParser, |
312 | 312 | $rangeCheckerHelper, |
313 | 313 | $this->config |
314 | 314 | ), |
315 | - $this->config->get( 'WBQualityConstraintsTypeConstraintId' ) |
|
315 | + $this->config->get('WBQualityConstraintsTypeConstraintId') |
|
316 | 316 | => new TypeChecker( |
317 | 317 | $this->lookup, |
318 | 318 | $this->constraintParameterParser, |
319 | 319 | $typeCheckerHelper, |
320 | 320 | $this->config |
321 | 321 | ), |
322 | - $this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ) |
|
322 | + $this->config->get('WBQualityConstraintsValueTypeConstraintId') |
|
323 | 323 | => new ValueTypeChecker( |
324 | 324 | $this->lookup, |
325 | 325 | $this->constraintParameterParser, |
326 | 326 | $typeCheckerHelper, |
327 | 327 | $this->config |
328 | 328 | ), |
329 | - $this->config->get( 'WBQualityConstraintsSingleValueConstraintId' ) |
|
330 | - => new SingleValueChecker( $this->constraintParameterParser ), |
|
331 | - $this->config->get( 'WBQualityConstraintsMultiValueConstraintId' ) |
|
332 | - => new MultiValueChecker( $this->constraintParameterParser ), |
|
333 | - $this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ) |
|
329 | + $this->config->get('WBQualityConstraintsSingleValueConstraintId') |
|
330 | + => new SingleValueChecker($this->constraintParameterParser), |
|
331 | + $this->config->get('WBQualityConstraintsMultiValueConstraintId') |
|
332 | + => new MultiValueChecker($this->constraintParameterParser), |
|
333 | + $this->config->get('WBQualityConstraintsDistinctValuesConstraintId') |
|
334 | 334 | => new UniqueValueChecker( |
335 | 335 | $sparqlHelper |
336 | 336 | ), |
337 | - $this->config->get( 'WBQualityConstraintsFormatConstraintId' ) |
|
337 | + $this->config->get('WBQualityConstraintsFormatConstraintId') |
|
338 | 338 | => new FormatChecker( |
339 | 339 | $this->constraintParameterParser, |
340 | 340 | $this->config, |
341 | 341 | $sparqlHelper |
342 | 342 | ), |
343 | - $this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ) |
|
343 | + $this->config->get('WBQualityConstraintsCommonsLinkConstraintId') |
|
344 | 344 | => new CommonsLinkChecker( |
345 | 345 | $this->constraintParameterParser, |
346 | 346 | $this->titleParser |
347 | 347 | ), |
348 | - $this->config->get( 'WBQualityConstraintsOneOfConstraintId' ) |
|
348 | + $this->config->get('WBQualityConstraintsOneOfConstraintId') |
|
349 | 349 | => new OneOfChecker( |
350 | 350 | $this->constraintParameterParser |
351 | 351 | ), |
352 | - $this->config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' ) |
|
352 | + $this->config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId') |
|
353 | 353 | => new ValueOnlyChecker(), |
354 | - $this->config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' ) |
|
354 | + $this->config->get('WBQualityConstraintsUsedAsReferenceConstraintId') |
|
355 | 355 | => new ReferenceChecker(), |
356 | - $this->config->get( 'WBQualityConstraintsNoBoundsConstraintId' ) |
|
356 | + $this->config->get('WBQualityConstraintsNoBoundsConstraintId') |
|
357 | 357 | => new NoBoundsChecker(), |
358 | - $this->config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' ) |
|
358 | + $this->config->get('WBQualityConstraintsAllowedUnitsConstraintId') |
|
359 | 359 | => new AllowedUnitsChecker( |
360 | 360 | $this->constraintParameterParser, |
361 | 361 | $this->unitConverter |
362 | 362 | ), |
363 | - $this->config->get( 'WBQualityConstraintsSingleBestValueConstraintId' ) |
|
364 | - => new SingleBestValueChecker( $this->constraintParameterParser ), |
|
365 | - $this->config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' ) |
|
363 | + $this->config->get('WBQualityConstraintsSingleBestValueConstraintId') |
|
364 | + => new SingleBestValueChecker($this->constraintParameterParser), |
|
365 | + $this->config->get('WBQualityConstraintsAllowedEntityTypesConstraintId') |
|
366 | 366 | => new EntityTypeChecker( |
367 | 367 | $this->constraintParameterParser |
368 | 368 | ), |
369 | - $this->config->get( 'WBQualityConstraintsNoneOfConstraintId' ) |
|
369 | + $this->config->get('WBQualityConstraintsNoneOfConstraintId') |
|
370 | 370 | => new NoneOfChecker( |
371 | 371 | $this->constraintParameterParser |
372 | 372 | ), |
373 | - $this->config->get( 'WBQualityConstraintsIntegerConstraintId' ) |
|
373 | + $this->config->get('WBQualityConstraintsIntegerConstraintId') |
|
374 | 374 | => new IntegerChecker(), |
375 | 375 | ]; |
376 | 376 | } |
@@ -382,26 +382,26 @@ discard block |
||
382 | 382 | * @return array[] |
383 | 383 | */ |
384 | 384 | public function getConstraintParameterMap() { |
385 | - if ( $this->constraintParameterMap === null ) { |
|
385 | + if ($this->constraintParameterMap === null) { |
|
386 | 386 | $this->constraintParameterMap = [ |
387 | - 'Commons link' => [ 'namespace' ], |
|
388 | - 'Conflicts with' => [ 'property', 'item' ], |
|
389 | - 'Diff within range' => [ 'property', 'minimum_quantity', 'maximum_quantity' ], |
|
390 | - 'Format' => [ 'pattern' ], |
|
391 | - 'Inverse' => [ 'property' ], |
|
392 | - 'Item' => [ 'property', 'item' ], |
|
393 | - 'Mandatory qualifiers' => [ 'property' ], |
|
387 | + 'Commons link' => ['namespace'], |
|
388 | + 'Conflicts with' => ['property', 'item'], |
|
389 | + 'Diff within range' => ['property', 'minimum_quantity', 'maximum_quantity'], |
|
390 | + 'Format' => ['pattern'], |
|
391 | + 'Inverse' => ['property'], |
|
392 | + 'Item' => ['property', 'item'], |
|
393 | + 'Mandatory qualifiers' => ['property'], |
|
394 | 394 | 'Multi value' => [], |
395 | - 'One of' => [ 'item' ], |
|
395 | + 'One of' => ['item'], |
|
396 | 396 | 'Qualifier' => [], |
397 | - 'Qualifiers' => [ 'property' ], |
|
398 | - 'Range' => [ 'minimum_quantity', 'maximum_quantity', 'minimum_date', 'maximum_date' ], |
|
397 | + 'Qualifiers' => ['property'], |
|
398 | + 'Range' => ['minimum_quantity', 'maximum_quantity', 'minimum_date', 'maximum_date'], |
|
399 | 399 | 'Single value' => [], |
400 | 400 | 'Symmetric' => [], |
401 | - 'Target required claim' => [ 'property', 'item' ], |
|
402 | - 'Type' => [ 'class', 'relation' ], |
|
401 | + 'Target required claim' => ['property', 'item'], |
|
402 | + 'Type' => ['class', 'relation'], |
|
403 | 403 | 'Unique value' => [], |
404 | - 'Value type' => [ 'class', 'relation' ] |
|
404 | + 'Value type' => ['class', 'relation'] |
|
405 | 405 | ]; |
406 | 406 | } |
407 | 407 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return ConstraintRepository |
413 | 413 | */ |
414 | 414 | public function getConstraintRepository() { |
415 | - if ( $this->constraintRepository === null ) { |
|
415 | + if ($this->constraintRepository === null) { |
|
416 | 416 | $this->constraintRepository = new ConstraintRepository(); |
417 | 417 | } |
418 | 418 |
@@ -40,31 +40,31 @@ discard block |
||
40 | 40 | ]; |
41 | 41 | } |
42 | 42 | |
43 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
44 | - if ( $context->getSnak()->getType() !== 'value' ) { |
|
45 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
43 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
44 | + if ($context->getSnak()->getType() !== 'value') { |
|
45 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** @var PropertyValueSnak $snak */ |
49 | 49 | $snak = $context->getSnak(); |
50 | 50 | |
51 | - if ( $snak->getDataValue() instanceof DecimalValue ) { |
|
52 | - return $this->checkDecimalValue( $snak->getDataValue(), $context, $constraint ); |
|
53 | - } elseif ( $snak->getDataValue() instanceof UnboundedQuantityValue ) { |
|
54 | - return $this->checkDecimalValue( $snak->getDataValue()->getAmount(), $context, $constraint ); |
|
51 | + if ($snak->getDataValue() instanceof DecimalValue) { |
|
52 | + return $this->checkDecimalValue($snak->getDataValue(), $context, $constraint); |
|
53 | + } elseif ($snak->getDataValue() instanceof UnboundedQuantityValue) { |
|
54 | + return $this->checkDecimalValue($snak->getDataValue()->getAmount(), $context, $constraint); |
|
55 | 55 | } |
56 | 56 | |
57 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
57 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
58 | 58 | } |
59 | 59 | |
60 | - private function checkDecimalValue( DecimalValue $decimalValue, Context $context, Constraint $constraint ) { |
|
61 | - if ( $decimalValue->getTrimmed()->getFractionalPart() === '' ) { |
|
62 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
60 | + private function checkDecimalValue(DecimalValue $decimalValue, Context $context, Constraint $constraint) { |
|
61 | + if ($decimalValue->getTrimmed()->getFractionalPart() === '') { |
|
62 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
63 | 63 | } |
64 | 64 | |
65 | - $message = ( new ViolationMessage( 'wbqc-violation-message-integer' ) ) |
|
66 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ) |
|
67 | - ->withDataValue( $decimalValue ); |
|
65 | + $message = (new ViolationMessage('wbqc-violation-message-integer')) |
|
66 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY) |
|
67 | + ->withDataValue($decimalValue); |
|
68 | 68 | return new CheckResult( |
69 | 69 | $context, |
70 | 70 | $constraint, |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ); |
75 | 75 | } |
76 | 76 | |
77 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
77 | + public function checkConstraintParameters(Constraint $constraint) { |
|
78 | 78 | // no parameters |
79 | 79 | return []; |
80 | 80 | } |