Completed
Push — master ( 4c5602...13c0ce )
by
unknown
06:07 queued 55s
created
src/ConstraintCheck/Checker/ReferenceChecker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 		];
36 36
 	}
37 37
 
38
-	public function checkConstraint( Context $context, Constraint $constraint ) {
39
-		if ( $context->getType() === Context::TYPE_REFERENCE ) {
40
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
38
+	public function checkConstraint(Context $context, Constraint $constraint) {
39
+		if ($context->getType() === Context::TYPE_REFERENCE) {
40
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
41 41
 		} else {
42
-			$message = wfMessage( 'wbqc-violation-message-reference' )->escaped();
43
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
42
+			$message = wfMessage('wbqc-violation-message-reference')->escaped();
43
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
44 44
 		}
45 45
 	}
46 46
 
47
-	public function checkConstraintParameters( Constraint $constraint ) {
47
+	public function checkConstraintParameters(Constraint $constraint) {
48 48
 		// no parameters
49 49
 		return [];
50 50
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/CommonsLinkChecker.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -77,22 +77,22 @@  discard block
 block discarded – undo
77 77
 	 * @return array first element is the namespace number (default namespace for TitleParser),
78 78
 	 * second element is a string to prepend to the title before giving it to the TitleParser
79 79
 	 */
80
-	private function getCommonsNamespace( $namespace ) {
80
+	private function getCommonsNamespace($namespace) {
81 81
 		// for namespace numbers see mediawiki-config repo, wmf-config/InitialiseSettings.php,
82 82
 		// 'wgExtraNamespaces' key, 'commonswiki' subkey
83
-		switch ( $namespace ) {
83
+		switch ($namespace) {
84 84
 			case '':
85
-				return [ NS_MAIN, '' ];
85
+				return [NS_MAIN, ''];
86 86
 			case 'Creator':
87
-				return [ 100, '' ];
87
+				return [100, ''];
88 88
 			case 'TimedText':
89
-				return [ 102, '' ];
89
+				return [102, ''];
90 90
 			case 'Sequence':
91
-				return [ 104, '' ];
91
+				return [104, ''];
92 92
 			case 'Institution':
93
-				return [ 106, '' ];
93
+				return [106, ''];
94 94
 			default:
95
-				return [ NS_MAIN, $namespace . ':' ];
95
+				return [NS_MAIN, $namespace.':'];
96 96
 		}
97 97
 	}
98 98
 
@@ -105,17 +105,17 @@  discard block
 block discarded – undo
105 105
 	 * @throws ConstraintParameterException
106 106
 	 * @return CheckResult
107 107
 	 */
108
-	public function checkConstraint( Context $context, Constraint $constraint ) {
108
+	public function checkConstraint(Context $context, Constraint $constraint) {
109 109
 		$parameters = [];
110 110
 		$constraintParameters = $constraint->getConstraintParameters();
111
-		$namespace = $this->constraintParameterParser->parseNamespaceParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
112
-		$parameters['namespace'] = [ $namespace ];
111
+		$namespace = $this->constraintParameterParser->parseNamespaceParameter($constraintParameters, $constraint->getConstraintTypeItemId());
112
+		$parameters['namespace'] = [$namespace];
113 113
 
114 114
 		$snak = $context->getSnak();
115 115
 
116
-		if ( !$snak instanceof PropertyValueSnak ) {
116
+		if (!$snak instanceof PropertyValueSnak) {
117 117
 			// nothing to check
118
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
118
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
119 119
 		}
120 120
 
121 121
 		$dataValue = $snak->getDataValue();
@@ -125,49 +125,49 @@  discard block
 block discarded – undo
125 125
 		 *   type of $dataValue for properties with 'Commons link' constraint has to be 'string'
126 126
 		 *   parameter $namespace can be null, works for commons galleries
127 127
 		 */
128
-		if ( $dataValue->getType() !== 'string' ) {
129
-			$message = wfMessage( "wbqc-violation-message-value-needed-of-type" )
128
+		if ($dataValue->getType() !== 'string') {
129
+			$message = wfMessage("wbqc-violation-message-value-needed-of-type")
130 130
 					 ->rawParams(
131
-						 $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ),
132
-						 wfMessage( 'datatypes-type-string' )->escaped()
131
+						 $this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM),
132
+						 wfMessage('datatypes-type-string')->escaped()
133 133
 					 )
134 134
 					 ->escaped();
135
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
135
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
136 136
 		}
137 137
 
138 138
 		$commonsLink = $dataValue->getValue();
139 139
 
140 140
 		try {
141
-			if ( !$this->commonsLinkIsWellFormed( $commonsLink ) ) {
142
-				throw new MalformedTitleException( 'wbqc-violation-message-commons-link-not-well-formed', $commonsLink ); // caught below
141
+			if (!$this->commonsLinkIsWellFormed($commonsLink)) {
142
+				throw new MalformedTitleException('wbqc-violation-message-commons-link-not-well-formed', $commonsLink); // caught below
143 143
 			}
144
-			list( $defaultNamespace, $prefix ) = $this->getCommonsNamespace( $namespace );
145
-			$title = $this->titleParser->parseTitle( $prefix . $commonsLink, $defaultNamespace );
146
-			if ( $this->pageExists( $title ) ) {
144
+			list($defaultNamespace, $prefix) = $this->getCommonsNamespace($namespace);
145
+			$title = $this->titleParser->parseTitle($prefix.$commonsLink, $defaultNamespace);
146
+			if ($this->pageExists($title)) {
147 147
 				$message = null;
148 148
 				$status = CheckResult::STATUS_COMPLIANCE;
149 149
 			} else {
150
-				if ( $this->valueIncludesNamespace( $commonsLink, $namespace ) ) {
151
-					throw new MalformedTitleException( 'wbqc-violation-message-commons-link-not-well-formed', $commonsLink ); // caught below
150
+				if ($this->valueIncludesNamespace($commonsLink, $namespace)) {
151
+					throw new MalformedTitleException('wbqc-violation-message-commons-link-not-well-formed', $commonsLink); // caught below
152 152
 				} else {
153
-					$message = wfMessage( "wbqc-violation-message-commons-link-no-existent" )->escaped();
153
+					$message = wfMessage("wbqc-violation-message-commons-link-no-existent")->escaped();
154 154
 					$status = CheckResult::STATUS_VIOLATION;
155 155
 				}
156 156
 			}
157
-		} catch ( MalformedTitleException $e ) {
158
-			$message = wfMessage( "wbqc-violation-message-commons-link-not-well-formed" )->escaped();
157
+		} catch (MalformedTitleException $e) {
158
+			$message = wfMessage("wbqc-violation-message-commons-link-not-well-formed")->escaped();
159 159
 			$status = CheckResult::STATUS_VIOLATION;
160 160
 		}
161 161
 
162
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
162
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
163 163
 	}
164 164
 
165
-	public function checkConstraintParameters( Constraint $constraint ) {
165
+	public function checkConstraintParameters(Constraint $constraint) {
166 166
 		$constraintParameters = $constraint->getConstraintParameters();
167 167
 		$exceptions = [];
168 168
 		try {
169
-			$this->constraintParameterParser->parseNamespaceParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
170
-		} catch ( ConstraintParameterException $e ) {
169
+			$this->constraintParameterParser->parseNamespaceParameter($constraintParameters, $constraint->getConstraintTypeItemId());
170
+		} catch (ConstraintParameterException $e) {
171 171
 			$exceptions[] = $e;
172 172
 		}
173 173
 		return $exceptions;
@@ -178,19 +178,19 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return bool
180 180
 	 */
181
-	private function pageExists( TitleValue $title ) {
181
+	private function pageExists(TitleValue $title) {
182 182
 		$commonsWikiId = 'commonswiki';
183
-		if ( defined( 'MW_PHPUNIT_TEST' ) ) {
183
+		if (defined('MW_PHPUNIT_TEST')) {
184 184
 			$commonsWikiId = false;
185 185
 		}
186 186
 
187
-		$dbLoadBalancer = wfGetLB( $commonsWikiId );
187
+		$dbLoadBalancer = wfGetLB($commonsWikiId);
188 188
 		$dbConnection = $dbLoadBalancer->getConnection(
189 189
 			DB_REPLICA, false, $commonsWikiId );
190
-		$row = $dbConnection->selectRow( 'page', '*', [
190
+		$row = $dbConnection->selectRow('page', '*', [
191 191
 			'page_title' => $title->getDBkey(),
192 192
 			'page_namespace' => $title->getNamespace()
193
-		] );
193
+		]);
194 194
 
195 195
 		return $row !== false;
196 196
 	}
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return bool
202 202
 	 */
203
-	private function commonsLinkIsWellFormed( $commonsLink ) {
204
-		$toReplace = [ "_", "%20" ];
205
-		$compareString = trim( str_replace( $toReplace, '', $commonsLink ) );
203
+	private function commonsLinkIsWellFormed($commonsLink) {
204
+		$toReplace = ["_", "%20"];
205
+		$compareString = trim(str_replace($toReplace, '', $commonsLink));
206 206
 		return $commonsLink === $compareString;
207 207
 	}
208 208
 
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return bool
217 217
 	 */
218
-	private function valueIncludesNamespace( $value, $namespace ) {
218
+	private function valueIncludesNamespace($value, $namespace) {
219 219
 		return $namespace !== '' &&
220
-			strncasecmp( $value, $namespace . ':', strlen( $namespace ) + 1 ) === 0;
220
+			strncasecmp($value, $namespace.':', strlen($namespace) + 1) === 0;
221 221
 	}
222 222
 
223 223
 }
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
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 		];
36 36
 	}
37 37
 
38
-	public function checkConstraint( Context $context, Constraint $constraint ) {
39
-		if ( $context->getType() === Context::TYPE_STATEMENT ) {
40
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
38
+	public function checkConstraint(Context $context, Constraint $constraint) {
39
+		if ($context->getType() === Context::TYPE_STATEMENT) {
40
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
41 41
 		} else {
42
-			$message = wfMessage( 'wbqc-violation-message-valueOnly' )->escaped();
43
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
42
+			$message = wfMessage('wbqc-violation-message-valueOnly')->escaped();
43
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
44 44
 		}
45 45
 	}
46 46
 
47
-	public function checkConstraintParameters( Constraint $constraint ) {
47
+	public function checkConstraintParameters(Constraint $constraint) {
48 48
 		// no parameters
49 49
 		return [];
50 50
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/TypeChecker.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -83,34 +83,34 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/MultiValueChecker.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return CheckResult
56 56
 	 */
57
-	public function checkConstraint( Context $context, Constraint $constraint ) {
58
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
59
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
57
+	public function checkConstraint(Context $context, Constraint $constraint) {
58
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
59
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
60 60
 		}
61 61
 
62 62
 		$propertyId = $context->getSnak()->getPropertyId();
@@ -68,18 +68,18 @@  discard block
 block discarded – undo
68 68
 			$propertyId
69 69
 		);
70 70
 
71
-		if ( $propertyCount <= 1 ) {
72
-			$message = wfMessage( "wbqc-violation-message-multi-value" )->escaped();
71
+		if ($propertyCount <= 1) {
72
+			$message = wfMessage("wbqc-violation-message-multi-value")->escaped();
73 73
 			$status = CheckResult::STATUS_VIOLATION;
74 74
 		} else {
75 75
 			$message = null;
76 76
 			$status = CheckResult::STATUS_COMPLIANCE;
77 77
 		}
78 78
 
79
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
79
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
80 80
 	}
81 81
 
82
-	public function checkConstraintParameters( Constraint $constraint ) {
82
+	public function checkConstraintParameters(Constraint $constraint) {
83 83
 		// no parameters
84 84
 		return [];
85 85
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/UniqueValueChecker.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -72,22 +72,22 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/SingleValueChecker.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return CheckResult
56 56
 	 */
57
-	public function checkConstraint( Context $context, Constraint $constraint ) {
58
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
59
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
57
+	public function checkConstraint(Context $context, Constraint $constraint) {
58
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
59
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
60 60
 		}
61 61
 
62 62
 		$propertyId = $context->getSnak()->getPropertyId();
@@ -68,18 +68,18 @@  discard block
 block discarded – undo
68 68
 			$propertyId
69 69
 		);
70 70
 
71
-		if ( $propertyCount > 1 ) {
72
-			$message = wfMessage( "wbqc-violation-message-single-value" )->escaped();
71
+		if ($propertyCount > 1) {
72
+			$message = wfMessage("wbqc-violation-message-single-value")->escaped();
73 73
 			$status = CheckResult::STATUS_VIOLATION;
74 74
 		} else {
75 75
 			$message = null;
76 76
 			$status = CheckResult::STATUS_COMPLIANCE;
77 77
 		}
78 78
 
79
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
79
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
80 80
 	}
81 81
 
82
-	public function checkConstraintParameters( Constraint $constraint ) {
82
+	public function checkConstraintParameters(Constraint $constraint) {
83 83
 		// no parameters
84 84
 		return [];
85 85
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ItemChecker.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
 	 * @throws ConstraintParameterException
86 86
 	 * @return CheckResult
87 87
 	 */
88
-	public function checkConstraint( Context $context, Constraint $constraint ) {
89
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
90
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
88
+	public function checkConstraint(Context $context, Constraint $constraint) {
89
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
90
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
91 91
 		}
92 92
 
93 93
 		$parameters = [];
94 94
 		$constraintParameters = $constraint->getConstraintParameters();
95 95
 
96
-		$propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
97
-		$parameters['property'] = [ $propertyId ];
96
+		$propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
97
+		$parameters['property'] = [$propertyId];
98 98
 
99
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
99
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
100 100
 		$parameters['items'] = $items;
101 101
 
102 102
 		/*
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		 *   a) a property only
105 105
 		 *   b) a property and a number of items (each combination of property and item forming an individual claim)
106 106
 		 */
107
-		if ( $items === [] ) {
107
+		if ($items === []) {
108 108
 			$requiredStatement = $this->connectionCheckerHelper->findStatementWithProperty(
109 109
 				$context->getEntity()->getStatements(),
110 110
 				$propertyId
@@ -117,35 +117,35 @@  discard block
 block discarded – undo
117 117
 			);
118 118
 		}
119 119
 
120
-		if ( $requiredStatement !== null ) {
120
+		if ($requiredStatement !== null) {
121 121
 			$status = CheckResult::STATUS_COMPLIANCE;
122 122
 			$message = null;
123 123
 		} else {
124 124
 			$status = CheckResult::STATUS_VIOLATION;
125
-			$message = wfMessage( 'wbqc-violation-message-item' );
125
+			$message = wfMessage('wbqc-violation-message-item');
126 126
 			$message->rawParams(
127
-				$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
128
-				$this->constraintParameterRenderer->formatEntityId( $propertyId, Role::PREDICATE )
127
+				$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
128
+				$this->constraintParameterRenderer->formatEntityId($propertyId, Role::PREDICATE)
129 129
 			);
130
-			$message->numParams( count( $items ) );
131
-			$message->rawParams( $this->constraintParameterRenderer->formatItemIdSnakValueList( $items, Role::OBJECT ) );
130
+			$message->numParams(count($items));
131
+			$message->rawParams($this->constraintParameterRenderer->formatItemIdSnakValueList($items, Role::OBJECT));
132 132
 			$message = $message->escaped();
133 133
 		}
134 134
 
135
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
135
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
136 136
 	}
137 137
 
138
-	public function checkConstraintParameters( Constraint $constraint ) {
138
+	public function checkConstraintParameters(Constraint $constraint) {
139 139
 		$constraintParameters = $constraint->getConstraintParameters();
140 140
 		$exceptions = [];
141 141
 		try {
142
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
143
-		} catch ( ConstraintParameterException $e ) {
142
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
143
+		} catch (ConstraintParameterException $e) {
144 144
 			$exceptions[] = $e;
145 145
 		}
146 146
 		try {
147
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
148
-		} catch ( ConstraintParameterException $e ) {
147
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
148
+		} catch (ConstraintParameterException $e) {
149 149
 			$exceptions[] = $e;
150 150
 		}
151 151
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/OneOfChecker.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,43 +67,43 @@
 block discarded – undo
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 = [];
76 76
 		$constraintParameters = $constraint->getConstraintParameters();
77 77
 
78
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), true );
78
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), true);
79 79
 		$parameters['item'] = $items;
80 80
 
81 81
 		$snak = $context->getSnak();
82 82
 
83
-		$message = wfMessage( 'wbqc-violation-message-one-of' );
84
-		$message->rawParams( $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE ) );
85
-		$message->numParams( count( $items ) );
86
-		$message->rawParams( $this->constraintParameterRenderer->formatItemIdSnakValueList( $items, Role::OBJECT ) );
83
+		$message = wfMessage('wbqc-violation-message-one-of');
84
+		$message->rawParams($this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE));
85
+		$message->numParams(count($items));
86
+		$message->rawParams($this->constraintParameterRenderer->formatItemIdSnakValueList($items, Role::OBJECT));
87 87
 		$message = $message->escaped();
88 88
 		$status = CheckResult::STATUS_VIOLATION;
89 89
 
90
-		foreach ( $items as $item ) {
91
-			if ( $item->matchesSnak( $snak ) ) {
90
+		foreach ($items as $item) {
91
+			if ($item->matchesSnak($snak)) {
92 92
 				$message = null;
93 93
 				$status = CheckResult::STATUS_COMPLIANCE;
94 94
 				break;
95 95
 			}
96 96
 		}
97 97
 
98
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
98
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
99 99
 	}
100 100
 
101
-	public function checkConstraintParameters( Constraint $constraint ) {
101
+	public function checkConstraintParameters(Constraint $constraint) {
102 102
 		$constraintParameters = $constraint->getConstraintParameters();
103 103
 		$exceptions = [];
104 104
 		try {
105
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), true );
106
-		} catch ( ConstraintParameterException $e ) {
105
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), true);
106
+		} catch (ConstraintParameterException $e) {
107 107
 			$exceptions[] = $e;
108 108
 		}
109 109
 		return $exceptions;
Please login to merge, or discard this patch.