Completed
Push — master ( 66a8d7...54b0e6 )
by
unknown
02:31
created
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|null $result must be null
84 84
 	 * @param array[] &$container
85 85
 	 */
86
-	public function storeCheckResultInArray( array $result = null, array &$container ) {
87
-		if ( $result !== null ) {
88
-			throw new LogicException( 'EntityContextCursor cannot store check results' );
86
+	public function storeCheckResultInArray(array $result = null, 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.
maintenance/ImportConstraintStatements.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
 use Wikibase\Repo\WikibaseRepo;
10 10
 
11 11
 // @codeCoverageIgnoreStart
12
-$basePath = getenv( "MW_INSTALL_PATH" ) !== false
13
-	? getenv( "MW_INSTALL_PATH" ) : __DIR__ . "/../../..";
12
+$basePath = getenv("MW_INSTALL_PATH") !== false
13
+	? getenv("MW_INSTALL_PATH") : __DIR__."/../../..";
14 14
 
15
-require_once $basePath . "/maintenance/Maintenance.php";
15
+require_once $basePath."/maintenance/Maintenance.php";
16 16
 // @codeCoverageIgnoreEnd
17 17
 
18 18
 /**
@@ -38,39 +38,39 @@  discard block
 block discarded – undo
38 38
 
39 39
 	public function __construct() {
40 40
 		parent::__construct();
41
-		$this->newUpdateConstraintsTableJob = function ( $propertyIdSerialization ) {
41
+		$this->newUpdateConstraintsTableJob = function($propertyIdSerialization) {
42 42
 			return UpdateConstraintsTableJob::newFromGlobalState(
43 43
 				Title::newMainPage(),
44
-				[ 'propertyId' => $propertyIdSerialization ]
44
+				['propertyId' => $propertyIdSerialization]
45 45
 			);
46 46
 		};
47 47
 
48
-		$this->addDescription( 'Imports property constraints from statements on properties' );
49
-		$this->requireExtension( 'WikibaseQualityConstraints' );
48
+		$this->addDescription('Imports property constraints from statements on properties');
49
+		$this->requireExtension('WikibaseQualityConstraints');
50 50
 
51 51
 		// Wikibase classes are not yet loaded, so setup services in a callback run in execute
52 52
 		// that can be overridden in tests.
53
-		$this->setupServices = function () {
53
+		$this->setupServices = function() {
54 54
 			$repo = WikibaseRepo::getDefaultInstance();
55 55
 			$this->propertyInfoLookup = $repo->getStore()->getPropertyInfoLookup();
56 56
 		};
57 57
 	}
58 58
 
59 59
 	public function execute() {
60
-		( $this->setupServices )();
61
-		if ( !$this->getConfig()->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) ) {
62
-			$this->error( 'Constraint statements are not enabled. Aborting.' );
60
+		($this->setupServices)();
61
+		if (!$this->getConfig()->get('WBQualityConstraintsEnableConstraintsImportFromStatements')) {
62
+			$this->error('Constraint statements are not enabled. Aborting.');
63 63
 			return;
64 64
 		}
65 65
 
66
-		foreach ( $this->propertyInfoLookup->getAllPropertyInfo() as $propertyIdSerialization => $info ) {
67
-			$this->output( sprintf( 'Importing constraint statements for % 6s... ', $propertyIdSerialization ), $propertyIdSerialization );
68
-			$startTime = microtime( true );
69
-			$job = call_user_func( $this->newUpdateConstraintsTableJob, $propertyIdSerialization );
66
+		foreach ($this->propertyInfoLookup->getAllPropertyInfo() as $propertyIdSerialization => $info) {
67
+			$this->output(sprintf('Importing constraint statements for % 6s... ', $propertyIdSerialization), $propertyIdSerialization);
68
+			$startTime = microtime(true);
69
+			$job = call_user_func($this->newUpdateConstraintsTableJob, $propertyIdSerialization);
70 70
 			$job->run();
71
-			$endTime = microtime( true );
72
-			$millis = ( $endTime - $startTime ) * 1000;
73
-			$this->output( sprintf( 'done in % 6.2f ms.', $millis ), $propertyIdSerialization );
71
+			$endTime = microtime(true);
72
+			$millis = ($endTime - $startTime) * 1000;
73
+			$this->output(sprintf('done in % 6.2f ms.', $millis), $propertyIdSerialization);
74 74
 		}
75 75
 	}
76 76
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Helper/TypeCheckerHelper.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -80,23 +80,23 @@  discard block
 block discarded – undo
80 80
 	 * @return bool
81 81
 	 * @throws OverflowException if $entitiesChecked exceeds the configured limit
82 82
 	 */
83
-	private function isSubclassOf( EntityId $comparativeClass, array $classesToCheck, &$entitiesChecked = 0 ) {
84
-		$maxEntities = $this->config->get( 'WBQualityConstraintsTypeCheckMaxEntities' );
83
+	private function isSubclassOf(EntityId $comparativeClass, array $classesToCheck, &$entitiesChecked = 0) {
84
+		$maxEntities = $this->config->get('WBQualityConstraintsTypeCheckMaxEntities');
85 85
 		if ( ++$entitiesChecked > $maxEntities ) {
86
-			throw new OverflowException( 'Too many entities to check' );
86
+			throw new OverflowException('Too many entities to check');
87 87
 		}
88 88
 
89
-		$item = $this->entityLookup->getEntity( $comparativeClass );
90
-		if ( !( $item instanceof StatementListProvider ) ) {
89
+		$item = $this->entityLookup->getEntity($comparativeClass);
90
+		if (!($item instanceof StatementListProvider)) {
91 91
 			return false; // lookup failed, probably because item doesn't exist
92 92
 		}
93 93
 
94
-		$subclassId = $this->config->get( 'WBQualityConstraintsSubclassOfId' );
94
+		$subclassId = $this->config->get('WBQualityConstraintsSubclassOfId');
95 95
 		/** @var Statement $statement */
96
-		foreach ( $item->getStatements()->getByPropertyId( new PropertyId( $subclassId ) ) as $statement ) {
96
+		foreach ($item->getStatements()->getByPropertyId(new PropertyId($subclassId)) as $statement) {
97 97
 			$mainSnak = $statement->getMainSnak();
98 98
 
99
-			if ( !( $this->hasCorrectType( $mainSnak ) ) ) {
99
+			if (!($this->hasCorrectType($mainSnak))) {
100 100
 				continue;
101 101
 			}
102 102
 			/** @var PropertyValueSnak $mainSnak */
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 			$dataValue = $mainSnak->getDataValue();
106 106
 			$comparativeClass = $dataValue->getEntityId();
107 107
 
108
-			if ( in_array( $comparativeClass->getSerialization(), $classesToCheck ) ) {
108
+			if (in_array($comparativeClass->getSerialization(), $classesToCheck)) {
109 109
 				return true;
110 110
 			}
111 111
 
112
-			if ( $this->isSubclassOf( $comparativeClass, $classesToCheck, $entitiesChecked ) ) {
112
+			if ($this->isSubclassOf($comparativeClass, $classesToCheck, $entitiesChecked)) {
113 113
 				return true;
114 114
 			}
115 115
 		}
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
 	 * @return CachedBool
131 131
 	 * @throws SparqlHelperException if SPARQL is used and the query times out or some other error occurs
132 132
 	 */
133
-	public function isSubclassOfWithSparqlFallback( EntityId $comparativeClass, array $classesToCheck ) {
133
+	public function isSubclassOfWithSparqlFallback(EntityId $comparativeClass, array $classesToCheck) {
134 134
 		try {
135 135
 			return new CachedBool(
136
-				$this->isSubclassOf( $comparativeClass, $classesToCheck ),
136
+				$this->isSubclassOf($comparativeClass, $classesToCheck),
137 137
 				Metadata::blank()
138 138
 			);
139
-		} catch ( OverflowException $e ) {
140
-			if ( !( $this->sparqlHelper instanceof DummySparqlHelper ) ) {
139
+		} catch (OverflowException $e) {
140
+			if (!($this->sparqlHelper instanceof DummySparqlHelper)) {
141 141
 				$this->dataFactory->increment(
142 142
 					'wikibase.quality.constraints.sparql.typeFallback'
143 143
 				);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 					/* withInstance = */ false
148 148
 				);
149 149
 			} else {
150
-				return new CachedBool( false, Metadata::blank() );
150
+				return new CachedBool(false, Metadata::blank());
151 151
 			}
152 152
 		}
153 153
 	}
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 	 * @return CachedBool
166 166
 	 * @throws SparqlHelperException if SPARQL is used and the query times out or some other error occurs
167 167
 	 */
168
-	public function hasClassInRelation( StatementList $statements, array $relationIds, array $classesToCheck ) {
168
+	public function hasClassInRelation(StatementList $statements, array $relationIds, array $classesToCheck) {
169 169
 		$metadatas = [];
170 170
 
171
-		foreach ( $this->getStatementsByPropertyIds( $statements, $relationIds ) as $statement ) {
171
+		foreach ($this->getStatementsByPropertyIds($statements, $relationIds) as $statement) {
172 172
 			$mainSnak = $statement->getMainSnak();
173 173
 
174
-			if ( !$this->hasCorrectType( $mainSnak ) ) {
174
+			if (!$this->hasCorrectType($mainSnak)) {
175 175
 				continue;
176 176
 			}
177 177
 			/** @var PropertyValueSnak $mainSnak */
@@ -180,28 +180,28 @@  discard block
 block discarded – undo
180 180
 			$dataValue = $mainSnak->getDataValue();
181 181
 			$comparativeClass = $dataValue->getEntityId();
182 182
 
183
-			if ( in_array( $comparativeClass->getSerialization(), $classesToCheck ) ) {
183
+			if (in_array($comparativeClass->getSerialization(), $classesToCheck)) {
184 184
 				// discard $metadatas, we know this is fresh
185
-				return new CachedBool( true, Metadata::blank() );
185
+				return new CachedBool(true, Metadata::blank());
186 186
 			}
187 187
 
188
-			$result = $this->isSubclassOfWithSparqlFallback( $comparativeClass, $classesToCheck );
188
+			$result = $this->isSubclassOfWithSparqlFallback($comparativeClass, $classesToCheck);
189 189
 			$metadatas[] = $result->getMetadata();
190
-			if ( $result->getBool() ) {
190
+			if ($result->getBool()) {
191 191
 				return new CachedBool(
192 192
 					true,
193
-					Metadata::merge( $metadatas )
193
+					Metadata::merge($metadatas)
194 194
 				);
195 195
 			}
196 196
 		}
197 197
 
198 198
 		return new CachedBool(
199 199
 			false,
200
-			Metadata::merge( $metadatas )
200
+			Metadata::merge($metadatas)
201 201
 		);
202 202
 	}
203 203
 
204
-	private function hasCorrectType( Snak $mainSnak ) {
204
+	private function hasCorrectType(Snak $mainSnak) {
205 205
 		return $mainSnak instanceof PropertyValueSnak
206 206
 			&& $mainSnak->getDataValue()->getType() === 'wikibase-entityid';
207 207
 	}
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	) {
219 219
 		$statementArrays = [];
220 220
 
221
-		foreach ( $propertyIdSerializations as $propertyIdSerialization ) {
222
-			$propertyId = new PropertyId( $propertyIdSerialization );
223
-			$statementArrays[] = $statements->getByPropertyId( $propertyId )->toArray();
221
+		foreach ($propertyIdSerializations as $propertyIdSerialization) {
222
+			$propertyId = new PropertyId($propertyIdSerialization);
223
+			$statementArrays[] = $statements->getByPropertyId($propertyId)->toArray();
224 224
 		}
225 225
 
226
-		return call_user_func_array( 'array_merge', $statementArrays );
226
+		return call_user_func_array('array_merge', $statementArrays);
227 227
 	}
228 228
 
229 229
 	/**
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @return ViolationMessage
237 237
 	 */
238
-	public function getViolationMessage( PropertyId $propertyId, EntityId $entityId, array $classes, $checker, $relation ) {
238
+	public function getViolationMessage(PropertyId $propertyId, EntityId $entityId, array $classes, $checker, $relation) {
239 239
 		$classes = array_map(
240
-			function( $itemIdSerialization ) {
241
-				return new ItemId( $itemIdSerialization );
240
+			function($itemIdSerialization) {
241
+				return new ItemId($itemIdSerialization);
242 242
 			},
243 243
 			$classes
244 244
 		);
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
 		// wbqc-violation-message-valueType-instance
251 251
 		// wbqc-violation-message-valueType-subclass
252 252
 		// wbqc-violation-message-valueType-instanceOrSubclass
253
-		return ( new ViolationMessage( 'wbqc-violation-message-' . $checker . '-' . $relation ) )
254
-			->withEntityId( $propertyId, Role::CONSTRAINT_PROPERTY )
255
-			->withEntityId( $entityId, Role::SUBJECT )
256
-			->withEntityIdList( $classes, Role::OBJECT );
253
+		return (new ViolationMessage('wbqc-violation-message-'.$checker.'-'.$relation))
254
+			->withEntityId($propertyId, Role::CONSTRAINT_PROPERTY)
255
+			->withEntityId($entityId, Role::SUBJECT)
256
+			->withEntityIdList($classes, Role::OBJECT);
257 257
 	}
258 258
 
259 259
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/Helper/DummySparqlHelper.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
 		// no parent::__construct() call
23 23
 	}
24 24
 
25
-	public function hasType( $id, array $classes, $withInstance ) {
26
-		throw new LogicException( 'methods of this class should never be called' );
25
+	public function hasType($id, array $classes, $withInstance) {
26
+		throw new LogicException('methods of this class should never be called');
27 27
 	}
28 28
 
29 29
 	public function findEntitiesWithSameStatement(
30 30
 		Statement $statement,
31 31
 		$ignoreDeprecatedStatements
32 32
 	) {
33
-		throw new LogicException( 'methods of this class should never be called' );
33
+		throw new LogicException('methods of this class should never be called');
34 34
 	}
35 35
 
36 36
 	public function findEntitiesWithSameQualifierOrReference(
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
 		$type,
40 40
 		$ignoreDeprecatedStatements
41 41
 	) {
42
-		throw new LogicException( 'methods of this class should never be called' );
42
+		throw new LogicException('methods of this class should never be called');
43 43
 	}
44 44
 
45
-	public function matchesRegularExpression( $text, $regex ) {
46
-		throw new LogicException( 'methods of this class should never be called' );
45
+	public function matchesRegularExpression($text, $regex) {
46
+		throw new LogicException('methods of this class should never be called');
47 47
 	}
48 48
 
49
-	public function runQuery( $query ) {
50
-		throw new LogicException( 'methods of this class should never be called' );
49
+	public function runQuery($query) {
50
+		throw new LogicException('methods of this class should never be called');
51 51
 	}
52 52
 
53 53
 }
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
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
 	 * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs
65 65
 	 * @return CheckResult
66 66
 	 */
67
-	public function checkConstraint( Context $context, Constraint $constraint ) {
68
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
69
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
67
+	public function checkConstraint(Context $context, Constraint $constraint) {
68
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
69
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
70 70
 		}
71 71
 
72 72
 		$parameters = [];
73 73
 
74
-		if ( !( $this->sparqlHelper instanceof DummySparqlHelper ) ) {
75
-			if ( $context->getType() === 'statement' ) {
74
+		if (!($this->sparqlHelper instanceof DummySparqlHelper)) {
75
+			if ($context->getType() === 'statement') {
76 76
 				$result = $this->sparqlHelper->findEntitiesWithSameStatement(
77 77
 					$context->getSnakStatement(),
78 78
 					true // ignore deprecated statements
79 79
 				);
80 80
 			} else {
81
-				if ( $context->getSnak()->getType() !== 'value' ) {
82
-					return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
81
+				if ($context->getSnak()->getType() !== 'value') {
82
+					return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
83 83
 				}
84 84
 				$result = $this->sparqlHelper->findEntitiesWithSameQualifierOrReference(
85 85
 					$context->getEntity()->getId(),
@@ -92,27 +92,27 @@  discard block
 block discarded – undo
92 92
 			$otherEntities = $result->getArray();
93 93
 			$metadata = $result->getMetadata();
94 94
 
95
-			if ( $otherEntities === [] ) {
95
+			if ($otherEntities === []) {
96 96
 				$status = CheckResult::STATUS_COMPLIANCE;
97 97
 				$message = null;
98 98
 			} else {
99
-				$otherEntities = array_values( array_filter( $otherEntities ) ); // remove nulls
99
+				$otherEntities = array_values(array_filter($otherEntities)); // remove nulls
100 100
 				$status = CheckResult::STATUS_VIOLATION;
101
-				$message = ( new ViolationMessage( 'wbqc-violation-message-unique-value' ) )
102
-					->withEntityIdList( $otherEntities, Role::SUBJECT );
101
+				$message = (new ViolationMessage('wbqc-violation-message-unique-value'))
102
+					->withEntityIdList($otherEntities, Role::SUBJECT);
103 103
 			}
104 104
 		} else {
105 105
 			$status = CheckResult::STATUS_TODO;
106
-			$message = ( new ViolationMessage( 'wbqc-violation-message-not-yet-implemented' ) )
107
-				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM );
106
+			$message = (new ViolationMessage('wbqc-violation-message-not-yet-implemented'))
107
+				->withEntityId(new ItemId($constraint->getConstraintTypeItemId()), Role::CONSTRAINT_TYPE_ITEM);
108 108
 			$metadata = Metadata::blank();
109 109
 		}
110 110
 
111
-		return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) )
112
-			->withMetadata( $metadata );
111
+		return (new CheckResult($context, $constraint, $parameters, $status, $message))
112
+			->withMetadata($metadata);
113 113
 	}
114 114
 
115
-	public function checkConstraintParameters( Constraint $constraint ) {
115
+	public function checkConstraintParameters(Constraint $constraint) {
116 116
 		// no parameters
117 117
 		return [];
118 118
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/FormatChecker.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 	 * @throws ConstraintParameterException
86 86
 	 * @return CheckResult
87 87
 	 */
88
-	public function checkConstraint( Context $context, Constraint $constraint ) {
88
+	public function checkConstraint(Context $context, Constraint $constraint) {
89 89
 		$parameters = [];
90 90
 		$constraintParameters = $constraint->getConstraintParameters();
91 91
 
92
-		$format = $this->constraintParameterParser->parseFormatParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
93
-		$parameters['pattern'] = [ $format ];
92
+		$format = $this->constraintParameterParser->parseFormatParameter($constraintParameters, $constraint->getConstraintTypeItemId());
93
+		$parameters['pattern'] = [$format];
94 94
 
95 95
 		$syntaxClarifications = $this->constraintParameterParser->parseSyntaxClarificationParameter(
96 96
 			$constraintParameters
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 
99 99
 		$snak = $context->getSnak();
100 100
 
101
-		if ( !$snak instanceof PropertyValueSnak ) {
101
+		if (!$snak instanceof PropertyValueSnak) {
102 102
 			// nothing to check
103
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
103
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
104 104
 		}
105 105
 
106 106
 		$dataValue = $snak->getDataValue();
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		 * error handling:
110 110
 		 *   type of $dataValue for properties with 'Format' constraint has to be 'string' or 'monolingualtext'
111 111
 		 */
112
-		switch ( $dataValue->getType() ) {
112
+		switch ($dataValue->getType()) {
113 113
 			case 'string':
114 114
 				$text = $dataValue->getValue();
115 115
 				break;
@@ -118,49 +118,49 @@  discard block
 block discarded – undo
118 118
 				$text = $dataValue->getText();
119 119
 				break;
120 120
 			default:
121
-				$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-types-2' ) )
122
-					->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
123
-					->withDataValueType( 'string' )
124
-					->withDataValueType( 'monolingualtext' );
125
-				return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
121
+				$message = (new ViolationMessage('wbqc-violation-message-value-needed-of-types-2'))
122
+					->withEntityId(new ItemId($constraint->getConstraintTypeItemId()), Role::CONSTRAINT_TYPE_ITEM)
123
+					->withDataValueType('string')
124
+					->withDataValueType('monolingualtext');
125
+				return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
126 126
 		}
127 127
 
128 128
 		if (
129
-			!( $this->sparqlHelper instanceof DummySparqlHelper ) &&
130
-			$this->config->get( 'WBQualityConstraintsCheckFormatConstraint' )
129
+			!($this->sparqlHelper instanceof DummySparqlHelper) &&
130
+			$this->config->get('WBQualityConstraintsCheckFormatConstraint')
131 131
 		) {
132
-			if ( $this->sparqlHelper->matchesRegularExpression( $text, $format ) ) {
132
+			if ($this->sparqlHelper->matchesRegularExpression($text, $format)) {
133 133
 				$message = null;
134 134
 				$status = CheckResult::STATUS_COMPLIANCE;
135 135
 			} else {
136
-				$message = ( new ViolationMessage( 'wbqc-violation-message-format-clarification' ) )
137
-					->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
138
-					->withDataValue( new StringValue( $text ), Role::OBJECT )
139
-					->withInlineCode( $format, Role::CONSTRAINT_PARAMETER_VALUE )
140
-					->withMultilingualText( $syntaxClarifications, Role::CONSTRAINT_PARAMETER_VALUE );
136
+				$message = (new ViolationMessage('wbqc-violation-message-format-clarification'))
137
+					->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY)
138
+					->withDataValue(new StringValue($text), Role::OBJECT)
139
+					->withInlineCode($format, Role::CONSTRAINT_PARAMETER_VALUE)
140
+					->withMultilingualText($syntaxClarifications, Role::CONSTRAINT_PARAMETER_VALUE);
141 141
 				$status = CheckResult::STATUS_VIOLATION;
142 142
 			}
143 143
 		} else {
144
-			$message = ( new ViolationMessage( 'wbqc-violation-message-security-reason' ) )
145
-				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM );
144
+			$message = (new ViolationMessage('wbqc-violation-message-security-reason'))
145
+				->withEntityId(new ItemId($constraint->getConstraintTypeItemId()), Role::CONSTRAINT_TYPE_ITEM);
146 146
 			$status = CheckResult::STATUS_TODO;
147 147
 		}
148
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
148
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
149 149
 	}
150 150
 
151
-	public function checkConstraintParameters( Constraint $constraint ) {
151
+	public function checkConstraintParameters(Constraint $constraint) {
152 152
 		$constraintParameters = $constraint->getConstraintParameters();
153 153
 		$exceptions = [];
154 154
 		try {
155
-			$this->constraintParameterParser->parseFormatParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
156
-		} catch ( ConstraintParameterException $e ) {
155
+			$this->constraintParameterParser->parseFormatParameter($constraintParameters, $constraint->getConstraintTypeItemId());
156
+		} catch (ConstraintParameterException $e) {
157 157
 			$exceptions[] = $e;
158 158
 		}
159 159
 		try {
160 160
 			$this->constraintParameterParser->parseSyntaxClarificationParameter(
161 161
 				$constraintParameters
162 162
 			);
163
-		} catch ( ConstraintParameterException $e ) {
163
+		} catch (ConstraintParameterException $e) {
164 164
 			$exceptions[] = $e;
165 165
 		}
166 166
 		return $exceptions;
Please login to merge, or discard this patch.
src/WikibaseQualityConstraintsHooks.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -31,48 +31,48 @@  discard block
 block discarded – undo
31 31
 	/**
32 32
 	 * @param DatabaseUpdater $updater
33 33
 	 */
34
-	public static function onCreateSchema( DatabaseUpdater $updater ) {
34
+	public static function onCreateSchema(DatabaseUpdater $updater) {
35 35
 		$updater->addExtensionTable(
36 36
 			'wbqc_constraints',
37
-			__DIR__ . '/../sql/create_wbqc_constraints.sql'
37
+			__DIR__.'/../sql/create_wbqc_constraints.sql'
38 38
 		);
39 39
 		$updater->addExtensionField(
40 40
 			'wbqc_constraints',
41 41
 			'constraint_id',
42
-			__DIR__ . '/../sql/patch-wbqc_constraints-constraint_id.sql'
42
+			__DIR__.'/../sql/patch-wbqc_constraints-constraint_id.sql'
43 43
 		);
44 44
 		$updater->addExtensionIndex(
45 45
 			'wbqc_constraints',
46 46
 			'wbqc_constraints_guid_uniq',
47
-			__DIR__ . '/../sql/patch-wbqc_constraints-wbqc_constraints_guid_uniq.sql'
47
+			__DIR__.'/../sql/patch-wbqc_constraints-wbqc_constraints_guid_uniq.sql'
48 48
 		);
49 49
 	}
50 50
 
51
-	public static function onWikibaseChange( Change $change ) {
51
+	public static function onWikibaseChange(Change $change) {
52 52
 		$config = MediaWikiServices::getInstance()->getMainConfig();
53
-		if ( $config->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) &&
54
-			self::isConstraintStatementsChange( $config, $change )
53
+		if ($config->get('WBQualityConstraintsEnableConstraintsImportFromStatements') &&
54
+			self::isConstraintStatementsChange($config, $change)
55 55
 		) {
56 56
 			/** @var EntityChange $change */
57 57
 			$title = Title::newMainPage();
58
-			$params = [ 'propertyId' => $change->getEntityId()->getSerialization() ];
58
+			$params = ['propertyId' => $change->getEntityId()->getSerialization()];
59 59
 			JobQueueGroup::singleton()->push(
60
-				new JobSpecification( 'constraintsTableUpdate', $params, [], $title )
60
+				new JobSpecification('constraintsTableUpdate', $params, [], $title)
61 61
 			);
62 62
 		}
63 63
 	}
64 64
 
65
-	public static function isConstraintStatementsChange( Config $config, Change $change ) {
66
-		if ( !( $change instanceof EntityChange ) ||
65
+	public static function isConstraintStatementsChange(Config $config, Change $change) {
66
+		if (!($change instanceof EntityChange) ||
67 67
 			 $change->getAction() !== EntityChange::UPDATE ||
68
-			 !( $change->getEntityId() instanceof PropertyId )
68
+			 !($change->getEntityId() instanceof PropertyId)
69 69
 		) {
70 70
 			return false;
71 71
 		}
72 72
 
73 73
 		$info = $change->getInfo();
74 74
 
75
-		if ( !array_key_exists( 'compactDiff', $info ) ) {
75
+		if (!array_key_exists('compactDiff', $info)) {
76 76
 			// the non-compact diff ($info['diff']) does not contain statement diffs (T110996),
77 77
 			// so we only know that the change *might* affect the constraint statements
78 78
 			return true;
@@ -81,46 +81,46 @@  discard block
 block discarded – undo
81 81
 		/** @var EntityDiffChangedAspects $aspects */
82 82
 		$aspects = $info['compactDiff'];
83 83
 
84
-		$propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' );
85
-		return in_array( $propertyConstraintId, $aspects->getStatementChanges() );
84
+		$propertyConstraintId = $config->get('WBQualityConstraintsPropertyConstraintId');
85
+		return in_array($propertyConstraintId, $aspects->getStatementChanges());
86 86
 	}
87 87
 
88
-	public static function onArticlePurge( WikiPage $wikiPage ) {
88
+	public static function onArticlePurge(WikiPage $wikiPage) {
89 89
 		$repo = WikibaseRepo::getDefaultInstance();
90 90
 
91 91
 		$entityContentFactory = $repo->getEntityContentFactory();
92
-		if ( $entityContentFactory->isEntityContentModel( $wikiPage->getContentModel() ) ) {
93
-			$entityId = $entityContentFactory->getEntityIdForTitle( $wikiPage->getTitle() );
94
-			if ( $entityId !== null ) {
92
+		if ($entityContentFactory->isEntityContentModel($wikiPage->getContentModel())) {
93
+			$entityId = $entityContentFactory->getEntityIdForTitle($wikiPage->getTitle());
94
+			if ($entityId !== null) {
95 95
 				$resultsCache = ResultsCache::getDefaultInstance();
96
-				$resultsCache->delete( $entityId );
96
+				$resultsCache->delete($entityId);
97 97
 			}
98 98
 		}
99 99
 	}
100 100
 
101
-	public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
101
+	public static function onBeforePageDisplay(OutputPage $out, Skin $skin) {
102 102
 		$repo = WikibaseRepo::getDefaultInstance();
103 103
 
104 104
 		$lookup = $repo->getEntityNamespaceLookup();
105 105
 		$title = $out->getTitle();
106
-		if ( $title === null ) {
106
+		if ($title === null) {
107 107
 			return;
108 108
 		}
109 109
 
110
-		if ( !$lookup->isEntityNamespace( $title->getNamespace() ) ) {
110
+		if (!$lookup->isEntityNamespace($title->getNamespace())) {
111 111
 			return;
112 112
 		}
113
-		if ( empty( $out->getJsConfigVars()['wbIsEditView'] ) ) {
113
+		if (empty($out->getJsConfigVars()['wbIsEditView'])) {
114 114
 			return;
115 115
 		}
116 116
 
117
-		$out->addModules( 'wikibase.quality.constraints.suggestions' );
117
+		$out->addModules('wikibase.quality.constraints.suggestions');
118 118
 
119
-		if ( !$out->getUser()->isLoggedIn() ) {
119
+		if (!$out->getUser()->isLoggedIn()) {
120 120
 			return;
121 121
 		}
122 122
 
123
-		$out->addModules( 'wikibase.quality.constraints.gadget' );
123
+		$out->addModules('wikibase.quality.constraints.gadget');
124 124
 	}
125 125
 
126 126
 	/**
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 	 * @param User $user
130 130
 	 * @param array[] &$prefs
131 131
 	 */
132
-	public static function onGetBetaFeaturePreferences( User $user, array &$prefs ) {
132
+	public static function onGetBetaFeaturePreferences(User $user, array &$prefs) {
133 133
 		$config = MediaWikiServices::getInstance()->getMainConfig();
134
-		$extensionAssetsPath = $config->get( 'ExtensionAssetsPath' );
135
-		if ( $config->get( 'WBQualityConstraintsSuggestionsBetaFeature' ) ) {
134
+		$extensionAssetsPath = $config->get('ExtensionAssetsPath');
135
+		if ($config->get('WBQualityConstraintsSuggestionsBetaFeature')) {
136 136
 			$prefs['constraint-suggestions'] = [
137 137
 					'label-message' => 'wbqc-beta-feature-label-message',
138 138
 					'desc-message' => 'wbqc-beta-feature-description-message',
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 	 * @param array &$vars
157 157
 	 * @param OutputPage $out
158 158
 	 */
159
-	public static function addVariables( &$vars, OutputPage $out ) {
159
+	public static function addVariables(&$vars, OutputPage $out) {
160 160
 		$config = MediaWikiServices::getInstance()->getMainConfig();
161 161
 
162
-		$vars['wbQualityConstraintsPropertyConstraintId'] = $config->get( 'WBQualityConstraintsPropertyConstraintId' );
163
-		$vars['wbQualityConstraintsOneOfConstraintId'] = $config->get( 'WBQualityConstraintsOneOfConstraintId' );
164
-		$vars['wbQualityConstraintsAllowedQualifierConstraintId'] = $config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' );
165
-		$vars['wbQualityConstraintsPropertyId'] = $config->get( 'WBQualityConstraintsPropertyId' );
166
-		$vars['wbQualityConstraintsQualifierOfPropertyConstraintId'] = $config->get( 'WBQualityConstraintsQualifierOfPropertyConstraintId' );
162
+		$vars['wbQualityConstraintsPropertyConstraintId'] = $config->get('WBQualityConstraintsPropertyConstraintId');
163
+		$vars['wbQualityConstraintsOneOfConstraintId'] = $config->get('WBQualityConstraintsOneOfConstraintId');
164
+		$vars['wbQualityConstraintsAllowedQualifierConstraintId'] = $config->get('WBQualityConstraintsAllowedQualifiersConstraintId');
165
+		$vars['wbQualityConstraintsPropertyId'] = $config->get('WBQualityConstraintsPropertyId');
166
+		$vars['wbQualityConstraintsQualifierOfPropertyConstraintId'] = $config->get('WBQualityConstraintsQualifierOfPropertyConstraintId');
167 167
 
168 168
 		$vars['wbQualityConstraintsSuggestionsGloballyEnabled'] = false;
169 169
 
170
-		if ( $config->get( 'WBQualityConstraintsSuggestionsBetaFeature' ) &&
171
-			ExtensionRegistry::getInstance()->isLoaded( 'BetaFeatures' ) &&
172
-			BetaFeatures::isFeatureEnabled( $out->getUser(), 'constraint-suggestions' )
170
+		if ($config->get('WBQualityConstraintsSuggestionsBetaFeature') &&
171
+			ExtensionRegistry::getInstance()->isLoaded('BetaFeatures') &&
172
+			BetaFeatures::isFeatureEnabled($out->getUser(), 'constraint-suggestions')
173 173
 			) {
174 174
 			$vars['wbQualityConstraintsSuggestionsGloballyEnabled'] = true;
175 175
 		}
Please login to merge, or discard this patch.
src/ConstraintReportFactory.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	public static function getDefaultInstance() {
137 137
 		static $instance = null;
138 138
 
139
-		if ( $instance === null ) {
139
+		if ($instance === null) {
140 140
 			$wikibaseRepo = WikibaseRepo::getDefaultInstance();
141 141
 			$config = MediaWikiServices::getInstance()->getMainConfig();
142 142
 			$titleParser = MediaWikiServices::getInstance()->getTitleParser();
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * @return DelegatingConstraintChecker
183 183
 	 */
184 184
 	public function getConstraintChecker() {
185
-		if ( $this->delegatingConstraintChecker === null ) {
185
+		if ($this->delegatingConstraintChecker === null) {
186 186
 			$this->delegatingConstraintChecker = new DelegatingConstraintChecker(
187 187
 				$this->lookup,
188 188
 				$this->getConstraintCheckerMap(),
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 				ConstraintsServices::getConstraintParameterParser(),
191 191
 				$this->statementGuidParser,
192 192
 				ConstraintsServices::getLoggingHelper(),
193
-				$this->config->get( 'WBQualityConstraintsCheckQualifiers' ),
194
-				$this->config->get( 'WBQualityConstraintsCheckReferences' ),
195
-				$this->config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' )
193
+				$this->config->get('WBQualityConstraintsCheckQualifiers'),
194
+				$this->config->get('WBQualityConstraintsCheckReferences'),
195
+				$this->config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers')
196 196
 			);
197 197
 		}
198 198
 
@@ -203,122 +203,122 @@  discard block
 block discarded – undo
203 203
 	 * @return ConstraintChecker[]
204 204
 	 */
205 205
 	private function getConstraintCheckerMap() {
206
-		if ( $this->constraintCheckerMap === null ) {
206
+		if ($this->constraintCheckerMap === null) {
207 207
 			$this->constraintCheckerMap = [
208
-				$this->config->get( 'WBQualityConstraintsConflictsWithConstraintId' )
208
+				$this->config->get('WBQualityConstraintsConflictsWithConstraintId')
209 209
 					=> new ConflictsWithChecker(
210 210
 						$this->lookup,
211 211
 						ConstraintsServices::getConstraintParameterParser(),
212 212
 						ConstraintsServices::getConnectionCheckerHelper()
213 213
 					),
214
-				$this->config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' )
214
+				$this->config->get('WBQualityConstraintsItemRequiresClaimConstraintId')
215 215
 					=> new ItemChecker(
216 216
 						$this->lookup,
217 217
 						ConstraintsServices::getConstraintParameterParser(),
218 218
 						ConstraintsServices::getConnectionCheckerHelper()
219 219
 					),
220
-				$this->config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' )
220
+				$this->config->get('WBQualityConstraintsValueRequiresClaimConstraintId')
221 221
 					=> new TargetRequiredClaimChecker(
222 222
 						$this->lookup,
223 223
 						ConstraintsServices::getConstraintParameterParser(),
224 224
 						ConstraintsServices::getConnectionCheckerHelper()
225 225
 					),
226
-				$this->config->get( 'WBQualityConstraintsSymmetricConstraintId' )
226
+				$this->config->get('WBQualityConstraintsSymmetricConstraintId')
227 227
 					=> new SymmetricChecker(
228 228
 						$this->lookup,
229 229
 						ConstraintsServices::getConnectionCheckerHelper()
230 230
 					),
231
-				$this->config->get( 'WBQualityConstraintsInverseConstraintId' )
231
+				$this->config->get('WBQualityConstraintsInverseConstraintId')
232 232
 					=> new InverseChecker(
233 233
 						$this->lookup,
234 234
 						ConstraintsServices::getConstraintParameterParser(),
235 235
 						ConstraintsServices::getConnectionCheckerHelper()
236 236
 					),
237
-				$this->config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' )
237
+				$this->config->get('WBQualityConstraintsUsedAsQualifierConstraintId')
238 238
 					=> new QualifierChecker(),
239
-				$this->config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' )
239
+				$this->config->get('WBQualityConstraintsAllowedQualifiersConstraintId')
240 240
 					=> new QualifiersChecker(
241 241
 						ConstraintsServices::getConstraintParameterParser()
242 242
 					),
243
-				$this->config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' )
243
+				$this->config->get('WBQualityConstraintsMandatoryQualifierConstraintId')
244 244
 					=> new MandatoryQualifiersChecker(
245 245
 						ConstraintsServices::getConstraintParameterParser()
246 246
 					),
247
-				$this->config->get( 'WBQualityConstraintsRangeConstraintId' )
247
+				$this->config->get('WBQualityConstraintsRangeConstraintId')
248 248
 					=> new RangeChecker(
249 249
 						$this->propertyDataTypeLookup,
250 250
 						ConstraintsServices::getConstraintParameterParser(),
251 251
 						ConstraintsServices::getRangeCheckerHelper()
252 252
 					),
253
-				$this->config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' )
253
+				$this->config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId')
254 254
 					=> new DiffWithinRangeChecker(
255 255
 						ConstraintsServices::getConstraintParameterParser(),
256 256
 						ConstraintsServices::getRangeCheckerHelper(),
257 257
 						$this->config
258 258
 					),
259
-				$this->config->get( 'WBQualityConstraintsTypeConstraintId' )
259
+				$this->config->get('WBQualityConstraintsTypeConstraintId')
260 260
 					=> new TypeChecker(
261 261
 						$this->lookup,
262 262
 						ConstraintsServices::getConstraintParameterParser(),
263 263
 						ConstraintsServices::getTypeCheckerHelper(),
264 264
 						$this->config
265 265
 					),
266
-				$this->config->get( 'WBQualityConstraintsValueTypeConstraintId' )
266
+				$this->config->get('WBQualityConstraintsValueTypeConstraintId')
267 267
 					=> new ValueTypeChecker(
268 268
 						$this->lookup,
269 269
 						ConstraintsServices::getConstraintParameterParser(),
270 270
 						ConstraintsServices::getTypeCheckerHelper(),
271 271
 						$this->config
272 272
 					),
273
-				$this->config->get( 'WBQualityConstraintsSingleValueConstraintId' )
274
-					=> new SingleValueChecker( ConstraintsServices::getConstraintParameterParser() ),
275
-				$this->config->get( 'WBQualityConstraintsMultiValueConstraintId' )
276
-					=> new MultiValueChecker( ConstraintsServices::getConstraintParameterParser() ),
277
-				$this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' )
273
+				$this->config->get('WBQualityConstraintsSingleValueConstraintId')
274
+					=> new SingleValueChecker(ConstraintsServices::getConstraintParameterParser()),
275
+				$this->config->get('WBQualityConstraintsMultiValueConstraintId')
276
+					=> new MultiValueChecker(ConstraintsServices::getConstraintParameterParser()),
277
+				$this->config->get('WBQualityConstraintsDistinctValuesConstraintId')
278 278
 					=> new UniqueValueChecker(
279 279
 						ConstraintsServices::getSparqlHelper()
280 280
 					),
281
-				$this->config->get( 'WBQualityConstraintsFormatConstraintId' )
281
+				$this->config->get('WBQualityConstraintsFormatConstraintId')
282 282
 					=> new FormatChecker(
283 283
 						ConstraintsServices::getConstraintParameterParser(),
284 284
 						$this->config,
285 285
 						ConstraintsServices::getSparqlHelper()
286 286
 					),
287
-				$this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' )
287
+				$this->config->get('WBQualityConstraintsCommonsLinkConstraintId')
288 288
 					=> new CommonsLinkChecker(
289 289
 						ConstraintsServices::getConstraintParameterParser(),
290 290
 						$this->titleParser
291 291
 					),
292
-				$this->config->get( 'WBQualityConstraintsOneOfConstraintId' )
292
+				$this->config->get('WBQualityConstraintsOneOfConstraintId')
293 293
 					=> new OneOfChecker(
294 294
 						ConstraintsServices::getConstraintParameterParser()
295 295
 					),
296
-				$this->config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' )
296
+				$this->config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId')
297 297
 					=> new ValueOnlyChecker(),
298
-				$this->config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' )
298
+				$this->config->get('WBQualityConstraintsUsedAsReferenceConstraintId')
299 299
 					=> new ReferenceChecker(),
300
-				$this->config->get( 'WBQualityConstraintsNoBoundsConstraintId' )
300
+				$this->config->get('WBQualityConstraintsNoBoundsConstraintId')
301 301
 					=> new NoBoundsChecker(),
302
-				$this->config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' )
302
+				$this->config->get('WBQualityConstraintsAllowedUnitsConstraintId')
303 303
 					=> new AllowedUnitsChecker(
304 304
 						ConstraintsServices::getConstraintParameterParser(),
305 305
 						$this->unitConverter
306 306
 					),
307
-				$this->config->get( 'WBQualityConstraintsSingleBestValueConstraintId' )
308
-					=> new SingleBestValueChecker( ConstraintsServices::getConstraintParameterParser() ),
309
-				$this->config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' )
307
+				$this->config->get('WBQualityConstraintsSingleBestValueConstraintId')
308
+					=> new SingleBestValueChecker(ConstraintsServices::getConstraintParameterParser()),
309
+				$this->config->get('WBQualityConstraintsAllowedEntityTypesConstraintId')
310 310
 					=> new EntityTypeChecker(
311 311
 						ConstraintsServices::getConstraintParameterParser()
312 312
 					),
313
-				$this->config->get( 'WBQualityConstraintsNoneOfConstraintId' )
313
+				$this->config->get('WBQualityConstraintsNoneOfConstraintId')
314 314
 					=> new NoneOfChecker(
315 315
 						ConstraintsServices::getConstraintParameterParser()
316 316
 					),
317
-				$this->config->get( 'WBQualityConstraintsIntegerConstraintId' )
317
+				$this->config->get('WBQualityConstraintsIntegerConstraintId')
318 318
 					=> new IntegerChecker(),
319
-				$this->config->get( 'WBQualityConstraintsCitationNeededConstraintId' )
319
+				$this->config->get('WBQualityConstraintsCitationNeededConstraintId')
320 320
 					=> new CitationNeededChecker(),
321
-				$this->config->get( 'WBQualityConstraintsPropertyScopeConstraintId' )
321
+				$this->config->get('WBQualityConstraintsPropertyScopeConstraintId')
322 322
 					=> new PropertyScopeChecker(
323 323
 						ConstraintsServices::getConstraintParameterParser()
324 324
 					),
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @return WikiPageEntityMetaDataAccessor
333 333
 	 */
334 334
 	public function getWikiPageEntityMetaDataAccessor() {
335
-		if ( $this->wikiPageEntityMetaDataAccessor === null ) {
335
+		if ($this->wikiPageEntityMetaDataAccessor === null) {
336 336
 			$this->wikiPageEntityMetaDataAccessor = new WikiPageEntityMetaDataLookup(
337 337
 				$this->entityNamespaceLookup
338 338
 			);
@@ -345,12 +345,12 @@  discard block
 block discarded – undo
345 345
 	 * @return ResultsSource
346 346
 	 */
347 347
 	public function getResultsSource() {
348
-		if ( $this->resultsSource === null ) {
348
+		if ($this->resultsSource === null) {
349 349
 			$this->resultsSource = new CheckingResultsSource(
350 350
 				$this->getConstraintChecker()
351 351
 			);
352 352
 
353
-			if ( $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) {
353
+			if ($this->config->get('WBQualityConstraintsCacheCheckConstraintsResults')) {
354 354
 				$this->resultsSource = new CachingResultsSource(
355 355
 					$this->resultsSource,
356 356
 					ResultsCache::getDefaultInstance(),
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
 					ConstraintsServices::getCheckResultDeserializer(),
359 359
 					$this->getWikiPageEntityMetaDataAccessor(),
360 360
 					$this->entityIdParser,
361
-					$this->config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ),
361
+					$this->config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'),
362 362
 					$this->getPossiblyStaleConstraintTypes(),
363
-					$this->config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ),
363
+					$this->config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'),
364 364
 					ConstraintsServices::getLoggingHelper()
365 365
 				);
366 366
 			}
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 	 */
375 375
 	public function getPossiblyStaleConstraintTypes() {
376 376
 		return [
377
-			$this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ),
378
-			$this->config->get( 'WBQualityConstraintsTypeConstraintId' ),
379
-			$this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ),
380
-			$this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ),
377
+			$this->config->get('WBQualityConstraintsCommonsLinkConstraintId'),
378
+			$this->config->get('WBQualityConstraintsTypeConstraintId'),
379
+			$this->config->get('WBQualityConstraintsValueTypeConstraintId'),
380
+			$this->config->get('WBQualityConstraintsDistinctValuesConstraintId'),
381 381
 		];
382 382
 	}
383 383
 
Please login to merge, or discard this patch.
src/ServiceWiring.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -20,24 +20,24 @@  discard block
 block discarded – undo
20 20
 use WikibaseQuality\ConstraintReport\ConstraintCheck\Result\CheckResultSerializer;
21 21
 
22 22
 return [
23
-	ConstraintsServices::LOGGING_HELPER => function( MediaWikiServices $services ) {
23
+	ConstraintsServices::LOGGING_HELPER => function(MediaWikiServices $services) {
24 24
 		return new LoggingHelper(
25 25
 			$services->getStatsdDataFactory(),
26
-			LoggerFactory::getInstance( 'WikibaseQualityConstraints' ),
26
+			LoggerFactory::getInstance('WikibaseQualityConstraints'),
27 27
 			$services->getMainConfig()
28 28
 		);
29 29
 	},
30 30
 
31
-	ConstraintsServices::CONSTRAINT_REPOSITORY => function( MediaWikiServices $services ) {
31
+	ConstraintsServices::CONSTRAINT_REPOSITORY => function(MediaWikiServices $services) {
32 32
 		return new ConstraintRepository();
33 33
 	},
34 34
 
35
-	ConstraintsServices::CONSTRAINT_LOOKUP => function( MediaWikiServices $services ) {
36
-		$constraintRepository = ConstraintsServices::getConstraintRepository( $services );
37
-		return new CachingConstraintLookup( $constraintRepository );
35
+	ConstraintsServices::CONSTRAINT_LOOKUP => function(MediaWikiServices $services) {
36
+		$constraintRepository = ConstraintsServices::getConstraintRepository($services);
37
+		return new CachingConstraintLookup($constraintRepository);
38 38
 	},
39 39
 
40
-	ConstraintsServices::CHECK_RESULT_SERIALIZER => function( MediaWikiServices $services ) {
40
+	ConstraintsServices::CHECK_RESULT_SERIALIZER => function(MediaWikiServices $services) {
41 41
 		return new CheckResultSerializer(
42 42
 			new ConstraintSerializer(
43 43
 				false // constraint parameters are not exposed
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		);
49 49
 	},
50 50
 
51
-	ConstraintsServices::CHECK_RESULT_DESERIALIZER => function( MediaWikiServices $services ) {
51
+	ConstraintsServices::CHECK_RESULT_DESERIALIZER => function(MediaWikiServices $services) {
52 52
 		// TODO in the future, get EntityIdParser and DataValueFactory from $services?
53 53
 		$repo = WikibaseRepo::getDefaultInstance();
54 54
 		$entityIdParser = $repo->getEntityIdParser();
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 		);
66 66
 	},
67 67
 
68
-	ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function( MediaWikiServices $services ) {
68
+	ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function(MediaWikiServices $services) {
69 69
 		return new ViolationMessageSerializer();
70 70
 	},
71 71
 
72
-	ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function( MediaWikiServices $services ) {
72
+	ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function(MediaWikiServices $services) {
73 73
 		// TODO in the future, get EntityIdParser and DataValueFactory from $services?
74 74
 		$repo = WikibaseRepo::getDefaultInstance();
75 75
 		$entityIdParser = $repo->getEntityIdParser();
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		);
82 82
 	},
83 83
 
84
-	ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function( MediaWikiServices $services ) {
84
+	ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function(MediaWikiServices $services) {
85 85
 		// TODO in the future, get DeserializerFactory and concept base URIs from $services?
86 86
 		$repo = WikibaseRepo::getDefaultInstance();
87 87
 		$deserializerFactory = $repo->getBaseDataModelDeserializerFactory();
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 		);
95 95
 	},
96 96
 
97
-	ConstraintsServices::CONNECTION_CHECKER_HELPER => function( MediaWikiServices $services ) {
97
+	ConstraintsServices::CONNECTION_CHECKER_HELPER => function(MediaWikiServices $services) {
98 98
 		return new ConnectionCheckerHelper();
99 99
 	},
100 100
 
101
-	ConstraintsServices::RANGE_CHECKER_HELPER => function( MediaWikiServices $services ) {
101
+	ConstraintsServices::RANGE_CHECKER_HELPER => function(MediaWikiServices $services) {
102 102
 		// TODO in the future, get UnitConverter from $services?
103 103
 		$repo = WikibaseRepo::getDefaultInstance();
104 104
 		$unitConverter = $repo->getUnitConverter();
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 		);
110 110
 	},
111 111
 
112
-	ConstraintsServices::SPARQL_HELPER => function( MediaWikiServices $services ) {
113
-		$endpoint = $services->getMainConfig()->get( 'WBQualityConstraintsSparqlEndpoint' );
114
-		if ( $endpoint === '' ) {
112
+	ConstraintsServices::SPARQL_HELPER => function(MediaWikiServices $services) {
113
+		$endpoint = $services->getMainConfig()->get('WBQualityConstraintsSparqlEndpoint');
114
+		if ($endpoint === '') {
115 115
 			return new DummySparqlHelper();
116 116
 		}
117 117
 
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 			$entityIdParser,
128 128
 			$propertyDataTypeLookup,
129 129
 			$services->getMainWANObjectCache(),
130
-			ConstraintsServices::getViolationMessageSerializer( $services ),
131
-			ConstraintsServices::getViolationMessageDeserializer( $services ),
130
+			ConstraintsServices::getViolationMessageSerializer($services),
131
+			ConstraintsServices::getViolationMessageDeserializer($services),
132 132
 			$services->getStatsdDataFactory()
133 133
 		);
134 134
 	},
135 135
 
136
-	ConstraintsServices::TYPE_CHECKER_HELPER => function( MediaWikiServices $services ) {
136
+	ConstraintsServices::TYPE_CHECKER_HELPER => function(MediaWikiServices $services) {
137 137
 		// TODO in the future, get EntityLookup from $services?
138 138
 		$repo = WikibaseRepo::getDefaultInstance();
139 139
 		$entityLookup = $repo->getEntityLookup();
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		return new TypeCheckerHelper(
142 142
 			$entityLookup,
143 143
 			$services->getMainConfig(),
144
-			ConstraintsServices::getSparqlHelper( $services ),
144
+			ConstraintsServices::getSparqlHelper($services),
145 145
 			$services->getStatsdDataFactory()
146 146
 		);
147 147
 	},
Please login to merge, or discard this patch.