Completed
Push — master ( bd1084...70b1b3 )
by
unknown
46s queued 12s
created
src/ConstraintCheck/Checker/FormatChecker.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @throws ConstraintParameterException
98 98
 	 * @return CheckResult
99 99
 	 */
100
-	public function checkConstraint( Context $context, Constraint $constraint ) {
100
+	public function checkConstraint(Context $context, Constraint $constraint) {
101 101
 		$parameters = [];
102 102
 		$constraintParameters = $constraint->getConstraintParameters();
103 103
 		$constraintTypeItemId = $constraint->getConstraintTypeItemId();
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 			$constraintParameters,
107 107
 			$constraintTypeItemId
108 108
 		);
109
-		$parameters['pattern'] = [ $format ];
109
+		$parameters['pattern'] = [$format];
110 110
 
111 111
 		$syntaxClarifications = $this->constraintParameterParser->parseSyntaxClarificationParameter(
112 112
 			$constraintParameters
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 
115 115
 		$snak = $context->getSnak();
116 116
 
117
-		if ( !$snak instanceof PropertyValueSnak ) {
117
+		if (!$snak instanceof PropertyValueSnak) {
118 118
 			// nothing to check
119
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
119
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
120 120
 		}
121 121
 
122 122
 		$dataValue = $snak->getDataValue();
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		 * error handling:
126 126
 		 *   type of $dataValue for properties with 'Format' constraint has to be 'string' or 'monolingualtext'
127 127
 		 */
128
-		switch ( $dataValue->getType() ) {
128
+		switch ($dataValue->getType()) {
129 129
 			case 'string':
130 130
 				$text = $dataValue->getValue();
131 131
 				break;
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 				$text = $dataValue->getText();
136 136
 				break;
137 137
 			default:
138
-				$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-types-2' ) )
139
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
140
-					->withDataValueType( 'string' )
141
-					->withDataValueType( 'monolingualtext' );
142
-				return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
138
+				$message = (new ViolationMessage('wbqc-violation-message-value-needed-of-types-2'))
139
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
140
+					->withDataValueType('string')
141
+					->withDataValueType('monolingualtext');
142
+				return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
143 143
 		}
144
-		$status = $this->runRegexCheck( $text, $format );
144
+		$status = $this->runRegexCheck($text, $format);
145 145
 		$message = $this->formatMessage(
146 146
 			$status,
147 147
 			$text,
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			$syntaxClarifications,
151 151
 			$constraintTypeItemId
152 152
 		);
153
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
153
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
154 154
 	}
155 155
 
156 156
 	private function formatMessage(
@@ -162,74 +162,74 @@  discard block
 block discarded – undo
162 162
 		string $constraintTypeItemId
163 163
 	): ?ViolationMessage {
164 164
 		$message = null;
165
-		if ( $status === CheckResult::STATUS_VIOLATION ) {
166
-			$message = ( new ViolationMessage( 'wbqc-violation-message-format-clarification' ) )
167
-				->withEntityId( $propertyId, Role::CONSTRAINT_PROPERTY )
168
-				->withDataValue( new StringValue( $text ), Role::OBJECT )
169
-				->withInlineCode( $format, Role::CONSTRAINT_PARAMETER_VALUE )
170
-				->withMultilingualText( $syntaxClarifications, Role::CONSTRAINT_PARAMETER_VALUE );
171
-		} elseif ( $status === CheckResult::STATUS_TODO ) {
172
-			$message = ( new ViolationMessage( 'wbqc-violation-message-security-reason' ) )
173
-				->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM );
165
+		if ($status === CheckResult::STATUS_VIOLATION) {
166
+			$message = (new ViolationMessage('wbqc-violation-message-format-clarification'))
167
+				->withEntityId($propertyId, Role::CONSTRAINT_PROPERTY)
168
+				->withDataValue(new StringValue($text), Role::OBJECT)
169
+				->withInlineCode($format, Role::CONSTRAINT_PARAMETER_VALUE)
170
+				->withMultilingualText($syntaxClarifications, Role::CONSTRAINT_PARAMETER_VALUE);
171
+		} elseif ($status === CheckResult::STATUS_TODO) {
172
+			$message = (new ViolationMessage('wbqc-violation-message-security-reason'))
173
+				->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM);
174 174
 		}
175 175
 
176 176
 		return $message;
177 177
 	}
178 178
 
179
-	private function runRegexCheck( string $text, string $format ): string {
180
-		if ( !$this->config->get( 'WBQualityConstraintsCheckFormatConstraint' ) ) {
179
+	private function runRegexCheck(string $text, string $format): string {
180
+		if (!$this->config->get('WBQualityConstraintsCheckFormatConstraint')) {
181 181
 			return CheckResult::STATUS_TODO;
182 182
 		}
183 183
 		if (
184
-			$this->config->get( 'WBQualityConstraintsFormatCheckerShellboxRatio' ) > (float)wfRandom()
184
+			$this->config->get('WBQualityConstraintsFormatCheckerShellboxRatio') > (float) wfRandom()
185 185
 		) {
186
-			return $this->runRegexCheckUsingShellbox( $text, $format );
186
+			return $this->runRegexCheckUsingShellbox($text, $format);
187 187
 		}
188 188
 
189
-		return $this->runRegexCheckUsingSparql( $text, $format );
189
+		return $this->runRegexCheckUsingSparql($text, $format);
190 190
 	}
191 191
 
192
-	private function runRegexCheckUsingShellbox( string $text, string $format ): string {
193
-		if ( !$this->shellboxClientFactory->isEnabled( 'constraint-regex-checker' ) ) {
192
+	private function runRegexCheckUsingShellbox(string $text, string $format): string {
193
+		if (!$this->shellboxClientFactory->isEnabled('constraint-regex-checker')) {
194 194
 			return CheckResult::STATUS_TODO;
195 195
 		}
196 196
 		try {
197
-			$pattern = '/^(?:' . str_replace( '/', '\/', $format ) . ')$/u';
198
-			$shellboxResponse = $this->shellboxClientFactory->getClient( [
199
-				'timeout' => $this->config->get( 'WBQualityConstraintsSparqlMaxMillis' ) / 1000,
197
+			$pattern = '/^(?:'.str_replace('/', '\/', $format).')$/u';
198
+			$shellboxResponse = $this->shellboxClientFactory->getClient([
199
+				'timeout' => $this->config->get('WBQualityConstraintsSparqlMaxMillis') / 1000,
200 200
 				'service' => 'constraint-regex-checker',
201
-			] )->call(
201
+			])->call(
202 202
 				'constraint-regex-checker',
203 203
 				'preg_match',
204
-				[ $pattern, $text ]
204
+				[$pattern, $text]
205 205
 			);
206
-		} catch ( ShellboxError $exception ) {
206
+		} catch (ShellboxError $exception) {
207 207
 			throw new ConstraintParameterException(
208
-				( new ViolationMessage( 'wbqc-violation-message-parameter-regex' ) )
209
-					->withInlineCode( $pattern, Role::CONSTRAINT_PARAMETER_VALUE )
208
+				(new ViolationMessage('wbqc-violation-message-parameter-regex'))
209
+					->withInlineCode($pattern, Role::CONSTRAINT_PARAMETER_VALUE)
210 210
 			);
211 211
 		}
212 212
 
213
-		if ( $shellboxResponse ) {
213
+		if ($shellboxResponse) {
214 214
 			return CheckResult::STATUS_COMPLIANCE;
215 215
 		} else {
216 216
 			return CheckResult::STATUS_VIOLATION;
217 217
 		}
218 218
 	}
219 219
 
220
-	private function runRegexCheckUsingSparql( string $text, string $format ): string {
221
-		if ( $this->sparqlHelper instanceof DummySparqlHelper ) {
220
+	private function runRegexCheckUsingSparql(string $text, string $format): string {
221
+		if ($this->sparqlHelper instanceof DummySparqlHelper) {
222 222
 			return CheckResult::STATUS_TODO;
223 223
 		}
224 224
 
225
-		if ( $this->sparqlHelper->matchesRegularExpression( $text, $format ) ) {
225
+		if ($this->sparqlHelper->matchesRegularExpression($text, $format)) {
226 226
 			return CheckResult::STATUS_COMPLIANCE;
227 227
 		} else {
228 228
 			return CheckResult::STATUS_VIOLATION;
229 229
 		}
230 230
 	}
231 231
 
232
-	public function checkConstraintParameters( Constraint $constraint ) {
232
+	public function checkConstraintParameters(Constraint $constraint) {
233 233
 		$constraintParameters = $constraint->getConstraintParameters();
234 234
 		$constraintTypeItemId = $constraint->getConstraintTypeItemId();
235 235
 		$exceptions = [];
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
 				$constraintParameters,
239 239
 				$constraintTypeItemId
240 240
 			);
241
-		} catch ( ConstraintParameterException $e ) {
241
+		} catch (ConstraintParameterException $e) {
242 242
 			$exceptions[] = $e;
243 243
 		}
244 244
 		try {
245 245
 			$this->constraintParameterParser->parseSyntaxClarificationParameter(
246 246
 				$constraintParameters
247 247
 			);
248
-		} catch ( ConstraintParameterException $e ) {
248
+		} catch (ConstraintParameterException $e) {
249 249
 			$exceptions[] = $e;
250 250
 		}
251 251
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/Lexeme/LanguageChecker.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
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 = [];
@@ -100,50 +100,50 @@  discard block
 block discarded – undo
100 100
 		);
101 101
 		$parameters['languages'] = $languages;
102 102
 
103
-		$message = ( new ViolationMessage( 'wbqc-violation-message-language' ) )
104
-			->withEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE )
105
-			->withItemIdSnakValueList( $languages, Role::OBJECT );
103
+		$message = (new ViolationMessage('wbqc-violation-message-language'))
104
+			->withEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE)
105
+			->withItemIdSnakValueList($languages, Role::OBJECT);
106 106
 		$status = CheckResult::STATUS_VIOLATION;
107 107
 
108
-		$lexeme = $this->getLexeme( $context );
109
-		if ( !$lexeme ) {
108
+		$lexeme = $this->getLexeme($context);
109
+		if (!$lexeme) {
110 110
 			// Lexeme doesn't exist, let's not bother
111
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE );
111
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE);
112 112
 		}
113 113
 
114 114
 		/** @var Lexeme $lexeme */
115 115
 		'@phan-var Lexeme $lexeme';
116 116
 
117
-		foreach ( $languages as $language ) {
118
-			if ( $language->isNoValue() || $language->isSomeValue() ) {
117
+		foreach ($languages as $language) {
118
+			if ($language->isNoValue() || $language->isSomeValue()) {
119 119
 				continue;
120 120
 			}
121
-			if ( $lexeme->getLanguage()->equals( $language->getItemId() ) ) {
121
+			if ($lexeme->getLanguage()->equals($language->getItemId())) {
122 122
 				$message = null;
123 123
 				$status = CheckResult::STATUS_COMPLIANCE;
124 124
 				break;
125 125
 			}
126 126
 		}
127 127
 
128
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
128
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
129 129
 	}
130 130
 
131
-	private function getLexeme( Context $context ): ?EntityDocument {
131
+	private function getLexeme(Context $context): ?EntityDocument {
132 132
 		$entityType = $context->getEntity()->getType();
133 133
 
134
-		if ( $entityType === Lexeme::ENTITY_TYPE ) {
134
+		if ($entityType === Lexeme::ENTITY_TYPE) {
135 135
 			return $context->getEntity();
136 136
 		}
137 137
 
138
-		if ( in_array( $entityType, [ Form::ENTITY_TYPE, Sense::ENTITY_TYPE ] ) ) {
138
+		if (in_array($entityType, [Form::ENTITY_TYPE, Sense::ENTITY_TYPE])) {
139 139
 			/** @var LexemeSubEntityId $id */
140 140
 			$id = $context->getEntity()->getId();
141 141
 			'@phan-var LexemeSubEntityId $id';
142
-			return $this->entityLookup->getEntity( $id->getLexemeId() );
142
+			return $this->entityLookup->getEntity($id->getLexemeId());
143 143
 		}
144 144
 	}
145 145
 
146
-	public function checkConstraintParameters( Constraint $constraint ): array {
146
+	public function checkConstraintParameters(Constraint $constraint): array {
147 147
 		$constraintParameters = $constraint->getConstraintParameters();
148 148
 		$constraintTypeItemId = $constraint->getConstraintTypeItemId();
149 149
 		$exceptions = [];
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 				$constraintTypeItemId,
154 154
 				true
155 155
 			);
156
-		} catch ( ConstraintParameterException $e ) {
156
+		} catch (ConstraintParameterException $e) {
157 157
 			$exceptions[] = $e;
158 158
 		}
159 159
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/PropertyScopeChecker.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		return self::ALL_ENTITY_TYPES_SUPPORTED;
55 55
 	}
56 56
 
57
-	public function checkConstraint( Context $context, Constraint $constraint ) {
57
+	public function checkConstraint(Context $context, Constraint $constraint) {
58 58
 		$constraintParameters = $constraint->getConstraintParameters();
59 59
 		$constraintTypeItemId = $constraint->getConstraintTypeItemId();
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			$constraintTypeItemId
64 64
 		);
65 65
 
66
-		if ( in_array( $context->getType(), $allowedContextTypes ) ) {
66
+		if (in_array($context->getType(), $allowedContextTypes)) {
67 67
 			return new CheckResult(
68 68
 				$context->getCursor(),
69 69
 				$constraint,
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
 				$constraint,
77 77
 				[],
78 78
 				CheckResult::STATUS_VIOLATION,
79
-				( new ViolationMessage( 'wbqc-violation-message-property-scope' ) )
80
-					->withEntityId( $context->getSnak()->getPropertyId() )
81
-					->withPropertyScope( $context->getType() )
82
-					->withPropertyScopeList( $allowedContextTypes )
79
+				(new ViolationMessage('wbqc-violation-message-property-scope'))
80
+					->withEntityId($context->getSnak()->getPropertyId())
81
+					->withPropertyScope($context->getType())
82
+					->withPropertyScopeList($allowedContextTypes)
83 83
 			);
84 84
 		}
85 85
 	}
86 86
 
87
-	public function checkConstraintParameters( Constraint $constraint ) {
87
+	public function checkConstraintParameters(Constraint $constraint) {
88 88
 		$constraintParameters = $constraint->getConstraintParameters();
89 89
 		$constraintTypeItemId = $constraint->getConstraintTypeItemId();
90 90
 		$exceptions = [];
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 				$constraintParameters,
94 94
 				$constraintTypeItemId
95 95
 			);
96
-		} catch ( ConstraintParameterException $e ) {
96
+		} catch (ConstraintParameterException $e) {
97 97
 			$exceptions[] = $e;
98 98
 		}
99 99
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/IntegerChecker.php 1 patch
Spacing   +21 added lines, -22 removed lines patch added patch discarded remove patch
@@ -46,23 +46,22 @@  discard block
 block discarded – undo
46 46
 		return self::ALL_ENTITY_TYPES_SUPPORTED;
47 47
 	}
48 48
 
49
-	public function checkConstraint( Context $context, Constraint $constraint ) {
49
+	public function checkConstraint(Context $context, Constraint $constraint) {
50 50
 		$snak = $context->getSnak();
51 51
 
52
-		if ( !$snak instanceof PropertyValueSnak ) {
52
+		if (!$snak instanceof PropertyValueSnak) {
53 53
 			// nothing to check
54
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
54
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
55 55
 		}
56 56
 
57
-		$violationMessage = $this->checkSnak( $snak );
57
+		$violationMessage = $this->checkSnak($snak);
58 58
 
59 59
 		return new CheckResult(
60 60
 			$context,
61 61
 			$constraint,
62 62
 			[],
63 63
 			$violationMessage === null ?
64
-				CheckResult::STATUS_COMPLIANCE :
65
-				CheckResult::STATUS_VIOLATION,
64
+				CheckResult::STATUS_COMPLIANCE : CheckResult::STATUS_VIOLATION,
66 65
 			$violationMessage
67 66
 		);
68 67
 	}
@@ -71,23 +70,23 @@  discard block
 block discarded – undo
71 70
 	 * @param PropertyValueSnak $snak
72 71
 	 * @return ViolationMessage|null
73 72
 	 */
74
-	public function checkSnak( PropertyValueSnak $snak ) {
73
+	public function checkSnak(PropertyValueSnak $snak) {
75 74
 		$dataValue = $snak->getDataValue();
76 75
 
77
-		if ( $dataValue instanceof DecimalValue ) {
78
-			if ( !$this->isInteger( $dataValue ) ) {
79
-				return $this->getViolationMessage( 'wbqc-violation-message-integer', $snak );
76
+		if ($dataValue instanceof DecimalValue) {
77
+			if (!$this->isInteger($dataValue)) {
78
+				return $this->getViolationMessage('wbqc-violation-message-integer', $snak);
80 79
 			}
81
-		} elseif ( $dataValue instanceof UnboundedQuantityValue ) {
82
-			if ( !$this->isInteger( $dataValue->getAmount() ) ) {
83
-				return $this->getViolationMessage( 'wbqc-violation-message-integer', $snak );
80
+		} elseif ($dataValue instanceof UnboundedQuantityValue) {
81
+			if (!$this->isInteger($dataValue->getAmount())) {
82
+				return $this->getViolationMessage('wbqc-violation-message-integer', $snak);
84 83
 			} elseif (
85 84
 				$dataValue instanceof QuantityValue && (
86
-					!$this->isInteger( $dataValue->getLowerBound() ) ||
87
-					!$this->isInteger( $dataValue->getUpperBound() )
85
+					!$this->isInteger($dataValue->getLowerBound()) ||
86
+					!$this->isInteger($dataValue->getUpperBound())
88 87
 				)
89 88
 			) {
90
-				return $this->getViolationMessage( 'wbqc-violation-message-integer-bounds', $snak );
89
+				return $this->getViolationMessage('wbqc-violation-message-integer-bounds', $snak);
91 90
 			}
92 91
 		}
93 92
 
@@ -98,7 +97,7 @@  discard block
 block discarded – undo
98 97
 	 * @param DecimalValue $decimalValue
99 98
 	 * @return bool
100 99
 	 */
101
-	private function isInteger( DecimalValue $decimalValue ) {
100
+	private function isInteger(DecimalValue $decimalValue) {
102 101
 		return $decimalValue->getTrimmed()->getFractionalPart() === '';
103 102
 	}
104 103
 
@@ -107,13 +106,13 @@  discard block
 block discarded – undo
107 106
 	 * @param PropertyValueSnak $snak
108 107
 	 * @return ViolationMessage
109 108
 	 */
110
-	private function getViolationMessage( $messageKey, PropertyValueSnak $snak ) {
111
-		return ( new ViolationMessage( $messageKey ) )
112
-			->withEntityId( $snak->getPropertyId(), Role::CONSTRAINT_PROPERTY )
113
-			->withDataValue( $snak->getDataValue() );
109
+	private function getViolationMessage($messageKey, PropertyValueSnak $snak) {
110
+		return (new ViolationMessage($messageKey))
111
+			->withEntityId($snak->getPropertyId(), Role::CONSTRAINT_PROPERTY)
112
+			->withDataValue($snak->getDataValue());
114 113
 	}
115 114
 
116
-	public function checkConstraintParameters( Constraint $constraint ) {
115
+	public function checkConstraintParameters(Constraint $constraint) {
117 116
 		// no parameters
118 117
 		return [];
119 118
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ReferenceChecker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,16 +41,16 @@
 block discarded – undo
41 41
 		return self::ALL_ENTITY_TYPES_SUPPORTED;
42 42
 	}
43 43
 
44
-	public function checkConstraint( Context $context, Constraint $constraint ) {
45
-		if ( $context->getType() === Context::TYPE_REFERENCE ) {
46
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
44
+	public function checkConstraint(Context $context, Constraint $constraint) {
45
+		if ($context->getType() === Context::TYPE_REFERENCE) {
46
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
47 47
 		} else {
48
-			$message = new ViolationMessage( 'wbqc-violation-message-reference' );
49
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
48
+			$message = new ViolationMessage('wbqc-violation-message-reference');
49
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
50 50
 		}
51 51
 	}
52 52
 
53
-	public function checkConstraintParameters( Constraint $constraint ) {
53
+	public function checkConstraintParameters(Constraint $constraint) {
54 54
 		// no parameters
55 55
 		return [];
56 56
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/NoBoundsChecker.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
 		return self::ALL_ENTITY_TYPES_SUPPORTED;
45 45
 	}
46 46
 
47
-	public function checkConstraint( Context $context, Constraint $constraint ) {
47
+	public function checkConstraint(Context $context, Constraint $constraint) {
48 48
 		$snak = $context->getSnak();
49 49
 
50
-		if ( !$snak instanceof PropertyValueSnak ) {
50
+		if (!$snak instanceof PropertyValueSnak) {
51 51
 			// nothing to check
52
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
52
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
53 53
 		}
54 54
 
55
-		if ( $snak->getDataValue() instanceof QuantityValue ) {
56
-			$message = ( new ViolationMessage( 'wbqc-violation-message-noBounds' ) )
57
-				->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY );
55
+		if ($snak->getDataValue() instanceof QuantityValue) {
56
+			$message = (new ViolationMessage('wbqc-violation-message-noBounds'))
57
+				->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY);
58 58
 			return new CheckResult(
59 59
 				$context,
60 60
 				$constraint,
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 			);
65 65
 		}
66 66
 
67
-		return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
67
+		return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
68 68
 	}
69 69
 
70
-	public function checkConstraintParameters( Constraint $constraint ) {
70
+	public function checkConstraintParameters(Constraint $constraint) {
71 71
 		// no parameters
72 72
 		return [];
73 73
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/CitationNeededChecker.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @codeCoverageIgnore This method is purely declarative.
31 31
 	 */
32 32
 	public function getDefaultContextTypes() {
33
-		return [ Context::TYPE_STATEMENT ];
33
+		return [Context::TYPE_STATEMENT];
34 34
 	}
35 35
 
36 36
 	/** @codeCoverageIgnore This method is purely declarative. */
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 		return self::ALL_ENTITY_TYPES_SUPPORTED;
39 39
 	}
40 40
 
41
-	public function checkConstraint( Context $context, Constraint $constraint ) {
41
+	public function checkConstraint(Context $context, Constraint $constraint) {
42 42
 		$referenceList = $context->getSnakStatement()->getReferences();
43 43
 
44
-		if ( $referenceList->isEmpty() ) {
45
-			$message = ( new ViolationMessage( 'wbqc-violation-message-citationNeeded' ) )
46
-				->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY );
44
+		if ($referenceList->isEmpty()) {
45
+			$message = (new ViolationMessage('wbqc-violation-message-citationNeeded'))
46
+				->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY);
47 47
 			return new CheckResult(
48 48
 				$context,
49 49
 				$constraint,
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 			);
54 54
 		}
55 55
 
56
-		return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
56
+		return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
57 57
 	}
58 58
 
59
-	public function checkConstraintParameters( Constraint $constraint ) {
59
+	public function checkConstraintParameters(Constraint $constraint) {
60 60
 		// no parameters
61 61
 		return [];
62 62
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ValueOnlyChecker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,16 +41,16 @@
 block discarded – undo
41 41
 		return self::ALL_ENTITY_TYPES_SUPPORTED;
42 42
 	}
43 43
 
44
-	public function checkConstraint( Context $context, Constraint $constraint ) {
45
-		if ( $context->getType() === Context::TYPE_STATEMENT ) {
46
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
44
+	public function checkConstraint(Context $context, Constraint $constraint) {
45
+		if ($context->getType() === Context::TYPE_STATEMENT) {
46
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
47 47
 		} else {
48
-			$message = new ViolationMessage( 'wbqc-violation-message-valueOnly' );
49
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
48
+			$message = new ViolationMessage('wbqc-violation-message-valueOnly');
49
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
50 50
 		}
51 51
 	}
52 52
 
53
-	public function checkConstraintParameters( Constraint $constraint ) {
53
+	public function checkConstraintParameters(Constraint $constraint) {
54 54
 		// no parameters
55 55
 		return [];
56 56
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/EntityTypeChecker.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 		return self::ALL_ENTITY_TYPES_SUPPORTED;
57 57
 	}
58 58
 
59
-	public function checkConstraint( Context $context, Constraint $constraint ) {
60
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
61
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
59
+	public function checkConstraint(Context $context, Constraint $constraint) {
60
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
61
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
62 62
 		}
63 63
 
64 64
 		$constraintParameters = $constraint->getConstraintParameters();
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 			'item' => $entityTypes->getEntityTypes(),
71 71
 		];
72 72
 
73
-		if ( !in_array( $context->getEntity()->getType(), $entityTypes->getEntityTypes() ) ) {
74
-			$message = ( new ViolationMessage( 'wbqc-violation-message-entityType' ) )
75
-				->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
76
-				->withEntityIdList( $entityTypes->getEntityTypeItemIds(), Role::CONSTRAINT_PARAMETER_VALUE );
73
+		if (!in_array($context->getEntity()->getType(), $entityTypes->getEntityTypes())) {
74
+			$message = (new ViolationMessage('wbqc-violation-message-entityType'))
75
+				->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY)
76
+				->withEntityIdList($entityTypes->getEntityTypeItemIds(), Role::CONSTRAINT_PARAMETER_VALUE);
77 77
 
78 78
 			return new CheckResult(
79 79
 				$context,
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 			);
85 85
 		}
86 86
 
87
-		return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
87
+		return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
88 88
 	}
89 89
 
90
-	public function checkConstraintParameters( Constraint $constraint ) {
90
+	public function checkConstraintParameters(Constraint $constraint) {
91 91
 		$constraintParameters = $constraint->getConstraintParameters();
92 92
 		$exceptions = [];
93 93
 		try {
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 				$constraintParameters,
96 96
 				$constraint->getConstraintTypeItemId()
97 97
 			);
98
-		} catch ( ConstraintParameterException $e ) {
98
+		} catch (ConstraintParameterException $e) {
99 99
 			$exceptions[] = $e;
100 100
 		}
101 101
 		return $exceptions;
Please login to merge, or discard this patch.