Completed
Push — master ( d728d0...adb712 )
by
unknown
01:40
created
src/CachingConstraintLookup.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	/**
27 27
 	 * @param ConstraintLookup $lookup The lookup to which all queries are delegated.
28 28
 	 */
29
-	public function __construct( ConstraintLookup $lookup ) {
29
+	public function __construct(ConstraintLookup $lookup) {
30 30
 		$this->lookup = $lookup;
31 31
 	}
32 32
 
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return Constraint[]
37 37
 	 */
38
-	public function queryConstraintsForProperty( PropertyId $propertyId ) {
38
+	public function queryConstraintsForProperty(PropertyId $propertyId) {
39 39
 		$id = $propertyId->getSerialization();
40
-		if ( !array_key_exists( $id, $this->cache ) ) {
41
-			$this->cache[$id] = $this->lookup->queryConstraintsForProperty( $propertyId );
40
+		if (!array_key_exists($id, $this->cache)) {
41
+			$this->cache[$id] = $this->lookup->queryConstraintsForProperty($propertyId);
42 42
 		}
43 43
 		return $this->cache[$id];
44 44
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ContextCursor.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -64,6 +64,7 @@
 block discarded – undo
64 64
 	 *
65 65
 	 * @param ?array $result
66 66
 	 * @param array[] &$container
67
+	 * @return void
67 68
 	 */
68 69
 	public function storeCheckResultInArray( ?array $result, array &$container );
69 70
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,6 +65,6 @@
 block discarded – undo
65 65
 	 * @param ?array $result
66 66
 	 * @param array[] &$container
67 67
 	 */
68
-	public function storeCheckResultInArray( ?array $result, array &$container );
68
+	public function storeCheckResultInArray(?array $result, array &$container);
69 69
 
70 70
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/EntityContextCursor.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @codeCoverageIgnore This method is not supported.
36 36
 	 */
37 37
 	public function getType() {
38
-		throw new LogicException( 'EntityContextCursor has no full associated context' );
38
+		throw new LogicException('EntityContextCursor has no full associated context');
39 39
 	}
40 40
 
41 41
 	public function getEntityId() {
@@ -46,35 +46,35 @@  discard block
 block discarded – undo
46 46
 	 * @codeCoverageIgnore This method is not supported.
47 47
 	 */
48 48
 	public function getStatementPropertyId() {
49
-		throw new LogicException( 'EntityContextCursor has no full associated context' );
49
+		throw new LogicException('EntityContextCursor has no full associated context');
50 50
 	}
51 51
 
52 52
 	/**
53 53
 	 * @codeCoverageIgnore This method is not supported.
54 54
 	 */
55 55
 	public function getStatementGuid() {
56
-		throw new LogicException( 'EntityContextCursor has no full associated context' );
56
+		throw new LogicException('EntityContextCursor has no full associated context');
57 57
 	}
58 58
 
59 59
 	/**
60 60
 	 * @codeCoverageIgnore This method is not supported.
61 61
 	 */
62 62
 	public function getSnakPropertyId() {
63
-		throw new LogicException( 'EntityContextCursor has no full associated context' );
63
+		throw new LogicException('EntityContextCursor has no full associated context');
64 64
 	}
65 65
 
66 66
 	/**
67 67
 	 * @codeCoverageIgnore This method is not supported.
68 68
 	 */
69 69
 	public function getSnakHash() {
70
-		throw new LogicException( 'EntityContextCursor has no full associated context' );
70
+		throw new LogicException('EntityContextCursor has no full associated context');
71 71
 	}
72 72
 
73 73
 	/**
74 74
 	 * @codeCoverageIgnore This method is not supported.
75 75
 	 */
76
-	public function &getMainArray( array &$container ) {
77
-		throw new LogicException( 'EntityContextCursor cannot store check results' );
76
+	public function &getMainArray(array &$container) {
77
+		throw new LogicException('EntityContextCursor cannot store check results');
78 78
 	}
79 79
 
80 80
 	/**
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
 	 * @param ?array $result must be null
84 84
 	 * @param array[] &$container
85 85
 	 */
86
-	public function storeCheckResultInArray( ?array $result, array &$container ) {
87
-		if ( $result !== null ) {
88
-			throw new LogicException( 'EntityContextCursor cannot store check results' );
86
+	public function storeCheckResultInArray(?array $result, array &$container) {
87
+		if ($result !== null) {
88
+			throw new LogicException('EntityContextCursor cannot store check results');
89 89
 		}
90 90
 
91 91
 		// this ensures that the claims array is present in the $container,
92 92
 		// populating it if necessary, even though we ignore the return value
93
-		$this->getClaimsArray( $container );
93
+		$this->getClaimsArray($container);
94 94
 	}
95 95
 
96 96
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ApiV2ContextCursor.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 	 * @param array[] &$container
28 28
 	 * @return array
29 29
 	 */
30
-	protected function &getClaimsArray( array &$container ) {
30
+	protected function &getClaimsArray(array &$container) {
31 31
 		$entityId = $this->getEntityId();
32 32
 
33
-		if ( !array_key_exists( $entityId, $container ) ) {
33
+		if (!array_key_exists($entityId, $container)) {
34 34
 			$container[$entityId] = [];
35 35
 		}
36 36
 		$entityContainer = &$container[$entityId];
37 37
 
38
-		if ( !array_key_exists( 'claims', $entityContainer ) ) {
38
+		if (!array_key_exists('claims', $entityContainer)) {
39 39
 			$entityContainer['claims'] = [];
40 40
 		}
41 41
 		$claimsArray = &$entityContainer['claims'];
@@ -49,25 +49,25 @@  discard block
 block discarded – undo
49 49
 	 * @param array[] &$container
50 50
 	 * @return array
51 51
 	 */
52
-	protected function &getStatementArray( array &$container ) {
52
+	protected function &getStatementArray(array &$container) {
53 53
 		$statementPropertyId = $this->getStatementPropertyId();
54 54
 		$statementGuid = $this->getStatementGuid();
55 55
 
56
-		$claimsContainer = &$this->getClaimsArray( $container );
56
+		$claimsContainer = &$this->getClaimsArray($container);
57 57
 
58
-		if ( !array_key_exists( $statementPropertyId, $claimsContainer ) ) {
58
+		if (!array_key_exists($statementPropertyId, $claimsContainer)) {
59 59
 			$claimsContainer[$statementPropertyId] = [];
60 60
 		}
61 61
 		$propertyContainer = &$claimsContainer[$statementPropertyId];
62 62
 
63
-		foreach ( $propertyContainer as &$statement ) {
64
-			if ( $statement['id'] === $statementGuid ) {
63
+		foreach ($propertyContainer as &$statement) {
64
+			if ($statement['id'] === $statementGuid) {
65 65
 				$statementArray = &$statement;
66 66
 				break;
67 67
 			}
68 68
 		}
69
-		if ( !isset( $statementArray ) ) {
70
-			$statementArray = [ 'id' => $statementGuid ];
69
+		if (!isset($statementArray)) {
70
+			$statementArray = ['id' => $statementGuid];
71 71
 			$propertyContainer[] = &$statementArray;
72 72
 		}
73 73
 
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 	 * @param array[] &$container
83 83
 	 * @return array
84 84
 	 */
85
-	abstract protected function &getMainArray( array &$container );
85
+	abstract protected function &getMainArray(array &$container);
86 86
 
87 87
 	/**
88 88
 	 * @param ?array $result
89 89
 	 * @param array[] &$container
90 90
 	 */
91
-	public function storeCheckResultInArray( ?array $result, array &$container ) {
92
-		$mainArray = &$this->getMainArray( $container );
93
-		if ( !array_key_exists( 'results', $mainArray ) ) {
91
+	public function storeCheckResultInArray(?array $result, array &$container) {
92
+		$mainArray = &$this->getMainArray($container);
93
+		if (!array_key_exists('results', $mainArray)) {
94 94
 			$mainArray['results'] = [];
95 95
 		}
96 96
 
97
-		if ( $result !== null ) {
97
+		if ($result !== null) {
98 98
 			$mainArray['results'][] = $result;
99 99
 		}
100 100
 	}
Please login to merge, or discard this patch.
src/WikibaseServices.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,35 +20,35 @@
 block discarded – undo
20 20
 	const PROPERTY_DATA_TYPE_LOOKUP = 'WBQC_PropertyDataTypeLookup';
21 21
 	const ENTITY_LOOKUP_WITHOUT_CACHE = 'WBQC_EntityLookupWithoutCache';
22 22
 
23
-	private static function getService( ?MediaWikiServices $services, $name ) {
24
-		if ( $services === null ) {
23
+	private static function getService(?MediaWikiServices $services, $name) {
24
+		if ($services === null) {
25 25
 			$services = MediaWikiServices::getInstance();
26 26
 		}
27
-		return $services->getService( $name );
27
+		return $services->getService($name);
28 28
 	}
29 29
 
30 30
 	/**
31 31
 	 * @param MediaWikiServices|null $services
32 32
 	 * @return EntityLookup
33 33
 	 */
34
-	public static function getEntityLookup( MediaWikiServices $services = null ) {
35
-		return self::getService( $services, self::ENTITY_LOOKUP );
34
+	public static function getEntityLookup(MediaWikiServices $services = null) {
35
+		return self::getService($services, self::ENTITY_LOOKUP);
36 36
 	}
37 37
 
38 38
 	/**
39 39
 	 * @param MediaWikiServices|null $services
40 40
 	 * @return PropertyDataTypeLookup
41 41
 	 */
42
-	public static function getPropertyDataTypeLookup( MediaWikiServices $services = null ) {
43
-		return self::getService( $services, self::PROPERTY_DATA_TYPE_LOOKUP );
42
+	public static function getPropertyDataTypeLookup(MediaWikiServices $services = null) {
43
+		return self::getService($services, self::PROPERTY_DATA_TYPE_LOOKUP);
44 44
 	}
45 45
 
46 46
 	/**
47 47
 	 * @param MediaWikiServices|null $services
48 48
 	 * @return EntityLookup
49 49
 	 */
50
-	public static function getEntityLookupWithoutCache( MediaWikiServices $services = null ) {
51
-		return self::getService( $services, self::ENTITY_LOOKUP_WITHOUT_CACHE );
50
+	public static function getEntityLookupWithoutCache(MediaWikiServices $services = null) {
51
+		return self::getService($services, self::ENTITY_LOOKUP_WITHOUT_CACHE);
52 52
 	}
53 53
 
54 54
 }
Please login to merge, or discard this patch.
src/ConstraintCheckerServices.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -40,243 +40,243 @@
 block discarded – undo
40 40
 	const PROPERTY_SCOPE_CHECKER = 'WBQC_PropertyScopeChecker';
41 41
 	const CONTEMPORARY_CHECKER = 'WBQC_ContemporaryChecker';
42 42
 
43
-	private static function getService( ?MediaWikiServices $services, $name ) {
44
-		if ( $services === null ) {
43
+	private static function getService(?MediaWikiServices $services, $name) {
44
+		if ($services === null) {
45 45
 			$services = MediaWikiServices::getInstance();
46 46
 		}
47
-		return $services->getService( $name );
47
+		return $services->getService($name);
48 48
 	}
49 49
 
50 50
 	/**
51 51
 	 * @param MediaWikiServices|null $services
52 52
 	 * @return ConstraintChecker
53 53
 	 */
54
-	public static function getConflictsWithChecker( MediaWikiServices $services = null ) {
55
-		return self::getService( $services, self::CONFLICTS_WITH_CHECKER );
54
+	public static function getConflictsWithChecker(MediaWikiServices $services = null) {
55
+		return self::getService($services, self::CONFLICTS_WITH_CHECKER);
56 56
 	}
57 57
 
58 58
 	/**
59 59
 	 * @param MediaWikiServices|null $services
60 60
 	 * @return ConstraintChecker
61 61
 	 */
62
-	public static function getItemChecker( MediaWikiServices $services = null ) {
63
-		return self::getService( $services, self::ITEM_CHECKER );
62
+	public static function getItemChecker(MediaWikiServices $services = null) {
63
+		return self::getService($services, self::ITEM_CHECKER);
64 64
 	}
65 65
 
66 66
 	/**
67 67
 	 * @param MediaWikiServices|null $services
68 68
 	 * @return ConstraintChecker
69 69
 	 */
70
-	public static function getTargetRequiredClaimChecker( MediaWikiServices $services = null ) {
71
-		return self::getService( $services, self::TARGET_REQUIRED_CLAIM_CHECKER );
70
+	public static function getTargetRequiredClaimChecker(MediaWikiServices $services = null) {
71
+		return self::getService($services, self::TARGET_REQUIRED_CLAIM_CHECKER);
72 72
 	}
73 73
 
74 74
 	/**
75 75
 	 * @param MediaWikiServices|null $services
76 76
 	 * @return ConstraintChecker
77 77
 	 */
78
-	public static function getSymmetricChecker( MediaWikiServices $services = null ) {
79
-		return self::getService( $services, self::SYMMETRIC_CHECKER );
78
+	public static function getSymmetricChecker(MediaWikiServices $services = null) {
79
+		return self::getService($services, self::SYMMETRIC_CHECKER);
80 80
 	}
81 81
 
82 82
 	/**
83 83
 	 * @param MediaWikiServices|null $services
84 84
 	 * @return ConstraintChecker
85 85
 	 */
86
-	public static function getInverseChecker( MediaWikiServices $services = null ) {
87
-		return self::getService( $services, self::INVERSE_CHECKER );
86
+	public static function getInverseChecker(MediaWikiServices $services = null) {
87
+		return self::getService($services, self::INVERSE_CHECKER);
88 88
 	}
89 89
 
90 90
 	/**
91 91
 	 * @param MediaWikiServices|null $services
92 92
 	 * @return ConstraintChecker
93 93
 	 */
94
-	public static function getQualifierChecker( MediaWikiServices $services = null ) {
95
-		return self::getService( $services, self::QUALIFIER_CHECKER );
94
+	public static function getQualifierChecker(MediaWikiServices $services = null) {
95
+		return self::getService($services, self::QUALIFIER_CHECKER);
96 96
 	}
97 97
 
98 98
 	/**
99 99
 	 * @param MediaWikiServices|null $services
100 100
 	 * @return ConstraintChecker
101 101
 	 */
102
-	public static function getQualifiersChecker( MediaWikiServices $services = null ) {
103
-		return self::getService( $services, self::QUALIFIERS_CHECKER );
102
+	public static function getQualifiersChecker(MediaWikiServices $services = null) {
103
+		return self::getService($services, self::QUALIFIERS_CHECKER);
104 104
 	}
105 105
 
106 106
 	/**
107 107
 	 * @param MediaWikiServices|null $services
108 108
 	 * @return ConstraintChecker
109 109
 	 */
110
-	public static function getMandatoryQualifiersChecker( MediaWikiServices $services = null ) {
111
-		return self::getService( $services, self::MANDATORY_QUALIFIERS_CHECKER );
110
+	public static function getMandatoryQualifiersChecker(MediaWikiServices $services = null) {
111
+		return self::getService($services, self::MANDATORY_QUALIFIERS_CHECKER);
112 112
 	}
113 113
 
114 114
 	/**
115 115
 	 * @param MediaWikiServices|null $services
116 116
 	 * @return ConstraintChecker
117 117
 	 */
118
-	public static function getRangeChecker( MediaWikiServices $services = null ) {
119
-		return self::getService( $services, self::RANGE_CHECKER );
118
+	public static function getRangeChecker(MediaWikiServices $services = null) {
119
+		return self::getService($services, self::RANGE_CHECKER);
120 120
 	}
121 121
 
122 122
 	/**
123 123
 	 * @param MediaWikiServices|null $services
124 124
 	 * @return ConstraintChecker
125 125
 	 */
126
-	public static function getDiffWithinRangeChecker( MediaWikiServices $services = null ) {
127
-		return self::getService( $services, self::DIFF_WITHIN_RANGE_CHECKER );
126
+	public static function getDiffWithinRangeChecker(MediaWikiServices $services = null) {
127
+		return self::getService($services, self::DIFF_WITHIN_RANGE_CHECKER);
128 128
 	}
129 129
 
130 130
 	/**
131 131
 	 * @param MediaWikiServices|null $services
132 132
 	 * @return ConstraintChecker
133 133
 	 */
134
-	public static function getTypeChecker( MediaWikiServices $services = null ) {
135
-		return self::getService( $services, self::TYPE_CHECKER );
134
+	public static function getTypeChecker(MediaWikiServices $services = null) {
135
+		return self::getService($services, self::TYPE_CHECKER);
136 136
 	}
137 137
 
138 138
 	/**
139 139
 	 * @param MediaWikiServices|null $services
140 140
 	 * @return ConstraintChecker
141 141
 	 */
142
-	public static function getValueTypeChecker( MediaWikiServices $services = null ) {
143
-		return self::getService( $services, self::VALUE_TYPE_CHECKER );
142
+	public static function getValueTypeChecker(MediaWikiServices $services = null) {
143
+		return self::getService($services, self::VALUE_TYPE_CHECKER);
144 144
 	}
145 145
 
146 146
 	/**
147 147
 	 * @param MediaWikiServices|null $services
148 148
 	 * @return ConstraintChecker
149 149
 	 */
150
-	public static function getSingleValueChecker( MediaWikiServices $services = null ) {
151
-		return self::getService( $services, self::SINGLE_VALUE_CHECKER );
150
+	public static function getSingleValueChecker(MediaWikiServices $services = null) {
151
+		return self::getService($services, self::SINGLE_VALUE_CHECKER);
152 152
 	}
153 153
 
154 154
 	/**
155 155
 	 * @param MediaWikiServices|null $services
156 156
 	 * @return ConstraintChecker
157 157
 	 */
158
-	public static function getMultiValueChecker( MediaWikiServices $services = null ) {
159
-		return self::getService( $services, self::MULTI_VALUE_CHECKER );
158
+	public static function getMultiValueChecker(MediaWikiServices $services = null) {
159
+		return self::getService($services, self::MULTI_VALUE_CHECKER);
160 160
 	}
161 161
 
162 162
 	/**
163 163
 	 * @param MediaWikiServices|null $services
164 164
 	 * @return ConstraintChecker
165 165
 	 */
166
-	public static function getUniqueValueChecker( MediaWikiServices $services = null ) {
167
-		return self::getService( $services, self::UNIQUE_VALUE_CHECKER );
166
+	public static function getUniqueValueChecker(MediaWikiServices $services = null) {
167
+		return self::getService($services, self::UNIQUE_VALUE_CHECKER);
168 168
 	}
169 169
 
170 170
 	/**
171 171
 	 * @param MediaWikiServices|null $services
172 172
 	 * @return ConstraintChecker
173 173
 	 */
174
-	public static function getFormatChecker( MediaWikiServices $services = null ) {
175
-		return self::getService( $services, self::FORMAT_CHECKER );
174
+	public static function getFormatChecker(MediaWikiServices $services = null) {
175
+		return self::getService($services, self::FORMAT_CHECKER);
176 176
 	}
177 177
 
178 178
 	/**
179 179
 	 * @param MediaWikiServices|null $services
180 180
 	 * @return ConstraintChecker
181 181
 	 */
182
-	public static function getCommonsLinkChecker( MediaWikiServices $services = null ) {
183
-		return self::getService( $services, self::COMMONS_LINK_CHECKER );
182
+	public static function getCommonsLinkChecker(MediaWikiServices $services = null) {
183
+		return self::getService($services, self::COMMONS_LINK_CHECKER);
184 184
 	}
185 185
 
186 186
 	/**
187 187
 	 * @param MediaWikiServices|null $services
188 188
 	 * @return ConstraintChecker
189 189
 	 */
190
-	public static function getOneOfChecker( MediaWikiServices $services = null ) {
191
-		return self::getService( $services, self::ONE_OF_CHECKER );
190
+	public static function getOneOfChecker(MediaWikiServices $services = null) {
191
+		return self::getService($services, self::ONE_OF_CHECKER);
192 192
 	}
193 193
 
194 194
 	/**
195 195
 	 * @param MediaWikiServices|null $services
196 196
 	 * @return ConstraintChecker
197 197
 	 */
198
-	public static function getValueOnlyChecker( MediaWikiServices $services = null ) {
199
-		return self::getService( $services, self::VALUE_ONLY_CHECKER );
198
+	public static function getValueOnlyChecker(MediaWikiServices $services = null) {
199
+		return self::getService($services, self::VALUE_ONLY_CHECKER);
200 200
 	}
201 201
 
202 202
 	/**
203 203
 	 * @param MediaWikiServices|null $services
204 204
 	 * @return ConstraintChecker
205 205
 	 */
206
-	public static function getReferenceChecker( MediaWikiServices $services = null ) {
207
-		return self::getService( $services, self::REFERENCE_CHECKER );
206
+	public static function getReferenceChecker(MediaWikiServices $services = null) {
207
+		return self::getService($services, self::REFERENCE_CHECKER);
208 208
 	}
209 209
 
210 210
 	/**
211 211
 	 * @param MediaWikiServices|null $services
212 212
 	 * @return ConstraintChecker
213 213
 	 */
214
-	public static function getNoBoundsChecker( MediaWikiServices $services = null ) {
215
-		return self::getService( $services, self::NO_BOUNDS_CHECKER );
214
+	public static function getNoBoundsChecker(MediaWikiServices $services = null) {
215
+		return self::getService($services, self::NO_BOUNDS_CHECKER);
216 216
 	}
217 217
 
218 218
 	/**
219 219
 	 * @param MediaWikiServices|null $services
220 220
 	 * @return ConstraintChecker
221 221
 	 */
222
-	public static function getAllowedUnitsChecker( MediaWikiServices $services = null ) {
223
-		return self::getService( $services, self::ALLOWED_UNITS_CHECKER );
222
+	public static function getAllowedUnitsChecker(MediaWikiServices $services = null) {
223
+		return self::getService($services, self::ALLOWED_UNITS_CHECKER);
224 224
 	}
225 225
 
226 226
 	/**
227 227
 	 * @param MediaWikiServices|null $services
228 228
 	 * @return ConstraintChecker
229 229
 	 */
230
-	public static function getSingleBestValueChecker( MediaWikiServices $services = null ) {
231
-		return self::getService( $services, self::SINGLE_BEST_VALUE_CHECKER );
230
+	public static function getSingleBestValueChecker(MediaWikiServices $services = null) {
231
+		return self::getService($services, self::SINGLE_BEST_VALUE_CHECKER);
232 232
 	}
233 233
 
234 234
 	/**
235 235
 	 * @param MediaWikiServices|null $services
236 236
 	 * @return ConstraintChecker
237 237
 	 */
238
-	public static function getEntityTypeChecker( MediaWikiServices $services = null ) {
239
-		return self::getService( $services, self::ENTITY_TYPE_CHECKER );
238
+	public static function getEntityTypeChecker(MediaWikiServices $services = null) {
239
+		return self::getService($services, self::ENTITY_TYPE_CHECKER);
240 240
 	}
241 241
 
242 242
 	/**
243 243
 	 * @param MediaWikiServices|null $services
244 244
 	 * @return ConstraintChecker
245 245
 	 */
246
-	public static function getNoneOfChecker( MediaWikiServices $services = null ) {
247
-		return self::getService( $services, self::NONE_OF_CHECKER );
246
+	public static function getNoneOfChecker(MediaWikiServices $services = null) {
247
+		return self::getService($services, self::NONE_OF_CHECKER);
248 248
 	}
249 249
 
250 250
 	/**
251 251
 	 * @param MediaWikiServices|null $services
252 252
 	 * @return ConstraintChecker
253 253
 	 */
254
-	public static function getIntegerChecker( MediaWikiServices $services = null ) {
255
-		return self::getService( $services, self::INTEGER_CHECKER );
254
+	public static function getIntegerChecker(MediaWikiServices $services = null) {
255
+		return self::getService($services, self::INTEGER_CHECKER);
256 256
 	}
257 257
 
258 258
 	/**
259 259
 	 * @param MediaWikiServices|null $services
260 260
 	 * @return ConstraintChecker
261 261
 	 */
262
-	public static function getCitationNeededChecker( MediaWikiServices $services = null ) {
263
-		return self::getService( $services, self::CITATION_NEEDED_CHECKER );
262
+	public static function getCitationNeededChecker(MediaWikiServices $services = null) {
263
+		return self::getService($services, self::CITATION_NEEDED_CHECKER);
264 264
 	}
265 265
 
266 266
 	/**
267 267
 	 * @param MediaWikiServices|null $services
268 268
 	 * @return ConstraintChecker
269 269
 	 */
270
-	public static function getPropertyScopeChecker( MediaWikiServices $services = null ) {
271
-		return self::getService( $services, self::PROPERTY_SCOPE_CHECKER );
270
+	public static function getPropertyScopeChecker(MediaWikiServices $services = null) {
271
+		return self::getService($services, self::PROPERTY_SCOPE_CHECKER);
272 272
 	}
273 273
 
274 274
 	/**
275 275
 	 * @param MediaWikiServices|null $services
276 276
 	 * @return ConstraintChecker
277 277
 	 */
278
-	public static function getContemporaryChecker( MediaWikiServices $services = null ) {
279
-		return self::getService( $services, self::CONTEMPORARY_CHECKER );
278
+	public static function getContemporaryChecker(MediaWikiServices $services = null) {
279
+		return self::getService($services, self::CONTEMPORARY_CHECKER);
280 280
 	}
281 281
 
282 282
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/ItemIdSnakValue.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param ItemId $itemId
45 45
 	 * @return self
46 46
 	 */
47
-	public static function fromItemId( ItemId $itemId ) {
47
+	public static function fromItemId(ItemId $itemId) {
48 48
 		$ret = new self;
49 49
 		$ret->itemId = $itemId;
50 50
 		return $ret;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 * @throws InvalidArgumentException
81 81
 	 * @return self
82 82
 	 */
83
-	public static function fromSnak( Snak $snak ) {
84
-		switch ( true ) {
83
+	public static function fromSnak(Snak $snak) {
84
+		switch (true) {
85 85
 			case $snak instanceof PropertyValueSnak:
86 86
 				$dataValue = $snak->getDataValue();
87
-				if ( $dataValue instanceof EntityIdValue ) {
87
+				if ($dataValue instanceof EntityIdValue) {
88 88
 					$itemId = $dataValue->getEntityId();
89
-					if ( $itemId instanceof ItemId ) {
90
-						return self::fromItemId( $itemId );
89
+					if ($itemId instanceof ItemId) {
90
+						return self::fromItemId($itemId);
91 91
 					}
92 92
 				}
93 93
 				break;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 				return self::noValue();
98 98
 		}
99 99
 
100
-		throw new InvalidArgumentException( 'Snak must contain item ID value or be a somevalue / novalue snak' );
100
+		throw new InvalidArgumentException('Snak must contain item ID value or be a somevalue / novalue snak');
101 101
 	}
102 102
 
103 103
 	/**
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 	 * @return ItemId
136 136
 	 */
137 137
 	public function getItemId() {
138
-		if ( !$this->isValue() ) {
139
-			throw new DomainException( 'This value does not contain an item ID.' );
138
+		if (!$this->isValue()) {
139
+			throw new DomainException('This value does not contain an item ID.');
140 140
 		}
141 141
 		return $this->itemId;
142 142
 	}
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 	 * @param Snak $snak
149 149
 	 * @return bool
150 150
 	 */
151
-	public function matchesSnak( Snak $snak ) {
152
-		switch ( true ) {
151
+	public function matchesSnak(Snak $snak) {
152
+		switch (true) {
153 153
 			case $snak instanceof PropertyValueSnak:
154 154
 				$dataValue = $snak->getDataValue();
155 155
 				return $this->isValue() &&
156 156
 					$dataValue instanceof EntityIdValue &&
157 157
 					$dataValue->getEntityId() instanceof ItemId &&
158
-					$dataValue->getEntityId()->equals( $this->getItemId() );
158
+					$dataValue->getEntityId()->equals($this->getItemId());
159 159
 			case $snak instanceof PropertySomeValueSnak:
160 160
 				return $this->isSomeValue();
161 161
 			case $snak instanceof PropertyNoValueSnak:
Please login to merge, or discard this patch.
src/Job/CheckConstraintsJob.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,25 +37,25 @@  discard block
 block discarded – undo
37 37
 	 * @param Title $title
38 38
 	 * @param string[] $params should contain 'entityId' => 'Q1234'
39 39
 	 */
40
-	public function __construct( Title $title, array $params ) {
41
-		parent::__construct( self::COMMAND, $title, $params );
40
+	public function __construct(Title $title, array $params) {
41
+		parent::__construct(self::COMMAND, $title, $params);
42 42
 		$this->removeDuplicates = true;
43 43
 
44
-		Assert::parameterType( 'string', $params['entityId'], '$params[\'entityId\']' );
44
+		Assert::parameterType('string', $params['entityId'], '$params[\'entityId\']');
45 45
 
46
-		$resultSource = ConstraintsServices::getResultsSource( MediaWikiServices::getInstance() );
46
+		$resultSource = ConstraintsServices::getResultsSource(MediaWikiServices::getInstance());
47 47
 		'@phan-var CachingResultsSource $resultSource';
48 48
 		// This job should only ever be used when caching result sources are used.
49
-		$this->setResultsSource( $resultSource );
49
+		$this->setResultsSource($resultSource);
50 50
 
51
-		$this->setEntityIdParser( WikibaseRepo::getDefaultInstance()->getEntityIdParser() );
51
+		$this->setEntityIdParser(WikibaseRepo::getDefaultInstance()->getEntityIdParser());
52 52
 	}
53 53
 
54
-	public function setResultsSource( CachingResultsSource $resultsSource ) {
54
+	public function setResultsSource(CachingResultsSource $resultsSource) {
55 55
 		$this->resultsSource = $resultsSource;
56 56
 	}
57 57
 
58
-	public function setEntityIdParser( EntityIdParser $parser ) {
58
+	public function setEntityIdParser(EntityIdParser $parser) {
59 59
 		$this->entityIdParser = $parser;
60 60
 	}
61 61
 
@@ -66,19 +66,19 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function run() {
68 68
 		try {
69
-			$entityId = $this->entityIdParser->parse( $this->params['entityId'] );
70
-		} catch ( EntityIdParsingException $e ) {
69
+			$entityId = $this->entityIdParser->parse($this->params['entityId']);
70
+		} catch (EntityIdParsingException $e) {
71 71
 			return false;
72 72
 		}
73 73
 
74
-		$this->checkConstraints( $entityId );
74
+		$this->checkConstraints($entityId);
75 75
 
76 76
 		return true;
77 77
 	}
78 78
 
79
-	private function checkConstraints( EntityId $entityId ) {
79
+	private function checkConstraints(EntityId $entityId) {
80 80
 		$this->resultsSource->getResults(
81
-			[ $entityId ],
81
+			[$entityId],
82 82
 			[],
83 83
 			null,
84 84
 			[]
Please login to merge, or discard this patch.
src/Api/CheckConstraintParameters.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -75,17 +75,17 @@  discard block
 block discarded – undo
75 75
 		DelegatingConstraintChecker $delegatingConstraintChecker
76 76
 	): self {
77 77
 		$repo = WikibaseRepo::getDefaultInstance();
78
-		$helperFactory = $repo->getApiHelperFactory( RequestContext::getMain() );
78
+		$helperFactory = $repo->getApiHelperFactory(RequestContext::getMain());
79 79
 		$language = $repo->getUserLanguage();
80 80
 
81 81
 		$entityIdHtmlLinkFormatterFactory = $repo->getEntityIdHtmlLinkFormatterFactory();
82 82
 		$entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory
83
-			->getEntityIdFormatter( $language );
83
+			->getEntityIdFormatter($language);
84 84
 		$formatterOptions = new FormatterOptions();
85
-		$formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() );
85
+		$formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode());
86 86
 		$valueFormatterFactory = $repo->getValueFormatterFactory();
87 87
 		$dataValueFormatter = $valueFormatterFactory
88
-			->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions );
88
+			->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions);
89 89
 		$violationMessageRenderer = new MultilingualTextViolationMessageRenderer(
90 90
 			$entityIdHtmlLinkFormatter,
91 91
 			$dataValueFormatter,
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 		StatementGuidParser $statementGuidParser,
122 122
 		IBufferingStatsdDataFactory $dataFactory
123 123
 	) {
124
-		parent::__construct( $main, $name );
124
+		parent::__construct($main, $name);
125 125
 
126
-		$this->apiErrorReporter = $apiHelperFactory->getErrorReporter( $this );
126
+		$this->apiErrorReporter = $apiHelperFactory->getErrorReporter($this);
127 127
 		$this->delegatingConstraintChecker = $delegatingConstraintChecker;
128 128
 		$this->violationMessageRenderer = $violationMessageRenderer;
129 129
 		$this->statementGuidParser = $statementGuidParser;
@@ -138,39 +138,39 @@  discard block
 block discarded – undo
138 138
 		$params = $this->extractRequestParams();
139 139
 		$result = $this->getResult();
140 140
 
141
-		$propertyIds = $this->parsePropertyIds( $params[self::PARAM_PROPERTY_ID] );
142
-		$constraintIds = $this->parseConstraintIds( $params[self::PARAM_CONSTRAINT_ID] );
141
+		$propertyIds = $this->parsePropertyIds($params[self::PARAM_PROPERTY_ID]);
142
+		$constraintIds = $this->parseConstraintIds($params[self::PARAM_CONSTRAINT_ID]);
143 143
 
144
-		$this->checkPropertyIds( $propertyIds, $result );
145
-		$this->checkConstraintIds( $constraintIds, $result );
144
+		$this->checkPropertyIds($propertyIds, $result);
145
+		$this->checkConstraintIds($constraintIds, $result);
146 146
 
147
-		$result->addValue( null, 'success', 1 );
147
+		$result->addValue(null, 'success', 1);
148 148
 	}
149 149
 
150 150
 	/**
151 151
 	 * @param array|null $propertyIdSerializations
152 152
 	 * @return PropertyId[]
153 153
 	 */
154
-	private function parsePropertyIds( $propertyIdSerializations ) {
155
-		if ( $propertyIdSerializations === null ) {
154
+	private function parsePropertyIds($propertyIdSerializations) {
155
+		if ($propertyIdSerializations === null) {
156 156
 			return [];
157
-		} elseif ( empty( $propertyIdSerializations ) ) {
157
+		} elseif (empty($propertyIdSerializations)) {
158 158
 			$this->apiErrorReporter->dieError(
159
-				'If ' . self::PARAM_PROPERTY_ID . ' is specified, it must be nonempty.',
159
+				'If '.self::PARAM_PROPERTY_ID.' is specified, it must be nonempty.',
160 160
 				'no-data'
161 161
 			);
162 162
 		}
163 163
 
164 164
 		return array_map(
165
-			function( $propertyIdSerialization ) {
165
+			function($propertyIdSerialization) {
166 166
 				try {
167
-					return new PropertyId( $propertyIdSerialization );
168
-				} catch ( InvalidArgumentException $e ) {
167
+					return new PropertyId($propertyIdSerialization);
168
+				} catch (InvalidArgumentException $e) {
169 169
 					$this->apiErrorReporter->dieError(
170 170
 						"Invalid id: $propertyIdSerialization",
171 171
 						'invalid-property-id',
172 172
 						0, // default argument
173
-						[ self::PARAM_PROPERTY_ID => $propertyIdSerialization ]
173
+						[self::PARAM_PROPERTY_ID => $propertyIdSerialization]
174 174
 					);
175 175
 				}
176 176
 			},
@@ -182,35 +182,35 @@  discard block
 block discarded – undo
182 182
 	 * @param array|null $constraintIds
183 183
 	 * @return string[]
184 184
 	 */
185
-	private function parseConstraintIds( $constraintIds ) {
186
-		if ( $constraintIds === null ) {
185
+	private function parseConstraintIds($constraintIds) {
186
+		if ($constraintIds === null) {
187 187
 			return [];
188
-		} elseif ( empty( $constraintIds ) ) {
188
+		} elseif (empty($constraintIds)) {
189 189
 			$this->apiErrorReporter->dieError(
190
-				'If ' . self::PARAM_CONSTRAINT_ID . ' is specified, it must be nonempty.',
190
+				'If '.self::PARAM_CONSTRAINT_ID.' is specified, it must be nonempty.',
191 191
 				'no-data'
192 192
 			);
193 193
 		}
194 194
 
195 195
 		return array_map(
196
-			function( $constraintId ) {
196
+			function($constraintId) {
197 197
 				try {
198
-					$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
199
-					if ( !$propertyId instanceof PropertyId ) {
198
+					$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
199
+					if (!$propertyId instanceof PropertyId) {
200 200
 						$this->apiErrorReporter->dieError(
201 201
 							"Invalid property ID: {$propertyId->getSerialization()}",
202 202
 							'invalid-property-id',
203 203
 							0, // default argument
204
-							[ self::PARAM_CONSTRAINT_ID => $constraintId ]
204
+							[self::PARAM_CONSTRAINT_ID => $constraintId]
205 205
 						);
206 206
 					}
207 207
 					return $constraintId;
208
-				} catch ( StatementGuidParsingException $e ) {
208
+				} catch (StatementGuidParsingException $e) {
209 209
 					$this->apiErrorReporter->dieError(
210 210
 						"Invalid statement GUID: $constraintId",
211 211
 						'invalid-guid',
212 212
 						0, // default argument
213
-						[ self::PARAM_CONSTRAINT_ID => $constraintId ]
213
+						[self::PARAM_CONSTRAINT_ID => $constraintId]
214 214
 					);
215 215
 				}
216 216
 			},
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
 	 * @param PropertyId[] $propertyIds
223 223
 	 * @param ApiResult $result
224 224
 	 */
225
-	private function checkPropertyIds( array $propertyIds, ApiResult $result ) {
226
-		foreach ( $propertyIds as $propertyId ) {
227
-			$result->addArrayType( $this->getResultPathForPropertyId( $propertyId ), 'assoc' );
225
+	private function checkPropertyIds(array $propertyIds, ApiResult $result) {
226
+		foreach ($propertyIds as $propertyId) {
227
+			$result->addArrayType($this->getResultPathForPropertyId($propertyId), 'assoc');
228 228
 			$allConstraintExceptions = $this->delegatingConstraintChecker
229
-				->checkConstraintParametersOnPropertyId( $propertyId );
230
-			foreach ( $allConstraintExceptions as $constraintId => $constraintParameterExceptions ) {
229
+				->checkConstraintParametersOnPropertyId($propertyId);
230
+			foreach ($allConstraintExceptions as $constraintId => $constraintParameterExceptions) {
231 231
 				$this->addConstraintParameterExceptionsToResult(
232 232
 					$constraintId,
233 233
 					$constraintParameterExceptions,
@@ -241,15 +241,15 @@  discard block
 block discarded – undo
241 241
 	 * @param string[] $constraintIds
242 242
 	 * @param ApiResult $result
243 243
 	 */
244
-	private function checkConstraintIds( array $constraintIds, ApiResult $result ) {
245
-		foreach ( $constraintIds as $constraintId ) {
246
-			if ( $result->getResultData( $this->getResultPathForConstraintId( $constraintId ) ) ) {
244
+	private function checkConstraintIds(array $constraintIds, ApiResult $result) {
245
+		foreach ($constraintIds as $constraintId) {
246
+			if ($result->getResultData($this->getResultPathForConstraintId($constraintId))) {
247 247
 				// already checked as part of checkPropertyIds()
248 248
 				continue;
249 249
 			}
250 250
 			$constraintParameterExceptions = $this->delegatingConstraintChecker
251
-				->checkConstraintParametersOnConstraintId( $constraintId );
252
-			$this->addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, $result );
251
+				->checkConstraintParametersOnConstraintId($constraintId);
252
+			$this->addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, $result);
253 253
 		}
254 254
 	}
255 255
 
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 	 * @param PropertyId $propertyId
258 258
 	 * @return string[]
259 259
 	 */
260
-	private function getResultPathForPropertyId( PropertyId $propertyId ) {
261
-		return [ $this->getModuleName(), $propertyId->getSerialization() ];
260
+	private function getResultPathForPropertyId(PropertyId $propertyId) {
261
+		return [$this->getModuleName(), $propertyId->getSerialization()];
262 262
 	}
263 263
 
264 264
 	/**
265 265
 	 * @param string $constraintId
266 266
 	 * @return string[]
267 267
 	 */
268
-	private function getResultPathForConstraintId( $constraintId ) {
269
-		$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
268
+	private function getResultPathForConstraintId($constraintId) {
269
+		$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
270 270
 		'@phan-var PropertyId $propertyId';
271
-		return array_merge( $this->getResultPathForPropertyId( $propertyId ), [ $constraintId ] );
271
+		return array_merge($this->getResultPathForPropertyId($propertyId), [$constraintId]);
272 272
 	}
273 273
 
274 274
 	/**
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 		$constraintParameterExceptions,
284 284
 		ApiResult $result
285 285
 	) {
286
-		$path = $this->getResultPathForConstraintId( $constraintId );
287
-		if ( $constraintParameterExceptions === null ) {
286
+		$path = $this->getResultPathForConstraintId($constraintId);
287
+		if ($constraintParameterExceptions === null) {
288 288
 			$result->addValue(
289 289
 				$path,
290 290
 				self::KEY_STATUS,
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
 			$result->addValue(
295 295
 				$path,
296 296
 				self::KEY_STATUS,
297
-				empty( $constraintParameterExceptions ) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY
297
+				empty($constraintParameterExceptions) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY
298 298
 			);
299 299
 			$result->addValue(
300 300
 				$path,
301 301
 				self::KEY_PROBLEMS,
302
-				array_map( [ $this, 'formatConstraintParameterException' ], $constraintParameterExceptions )
302
+				array_map([$this, 'formatConstraintParameterException'], $constraintParameterExceptions)
303 303
 			);
304 304
 		}
305 305
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * @param ConstraintParameterException $e
311 311
 	 * @return string[]
312 312
 	 */
313
-	private function formatConstraintParameterException( ConstraintParameterException $e ) {
313
+	private function formatConstraintParameterException(ConstraintParameterException $e) {
314 314
 		return [
315 315
 			self::KEY_MESSAGE_HTML => $this->violationMessageRenderer->render(
316 316
 				$e->getViolationMessage()
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 		return [
344 344
 			'action=wbcheckconstraintparameters&propertyid=P247'
345 345
 				=> 'apihelp-wbcheckconstraintparameters-example-propertyid-1',
346
-			'action=wbcheckconstraintparameters&' .
347
-			'constraintid=P247$0fe1711e-4c0f-82ce-3af0-830b721d0fba|' .
346
+			'action=wbcheckconstraintparameters&'.
347
+			'constraintid=P247$0fe1711e-4c0f-82ce-3af0-830b721d0fba|'.
348 348
 			'P225$cdc71e4a-47a0-12c5-dfb3-3f6fc0b6613f'
349 349
 				=> 'apihelp-wbcheckconstraintparameters-example-constraintid-2',
350 350
 		];
Please login to merge, or discard this patch.