Completed
Push — master ( e6cdfd...b6f1ea )
by
unknown
05:56
created
src/ConstraintCheck/Context/ReferenceContextCursor.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -92,43 +92,43 @@
 block discarded – undo
92 92
 		return $this->referenceHash;
93 93
 	}
94 94
 
95
-	protected function &getMainArray( array &$container ) {
96
-		$statementArray = &$this->getStatementArray( $container );
95
+	protected function &getMainArray(array &$container) {
96
+		$statementArray = &$this->getStatementArray($container);
97 97
 
98
-		if ( !array_key_exists( 'references', $statementArray ) ) {
98
+		if (!array_key_exists('references', $statementArray)) {
99 99
 			$statementArray['references'] = [];
100 100
 		}
101 101
 		$referencesArray = &$statementArray['references'];
102 102
 
103 103
 		$referenceHash = $this->getReferenceHash();
104
-		foreach ( $referencesArray as &$potentialReferenceArray ) {
105
-			if ( $potentialReferenceArray['hash'] === $referenceHash ) {
104
+		foreach ($referencesArray as &$potentialReferenceArray) {
105
+			if ($potentialReferenceArray['hash'] === $referenceHash) {
106 106
 				$referenceArray = &$potentialReferenceArray;
107 107
 				break;
108 108
 			}
109 109
 		}
110
-		if ( !isset( $referenceArray ) ) {
111
-			$referenceArray = [ 'hash' => $referenceHash, 'snaks' => [] ];
110
+		if (!isset($referenceArray)) {
111
+			$referenceArray = ['hash' => $referenceHash, 'snaks' => []];
112 112
 			$referencesArray[] = &$referenceArray;
113 113
 		}
114 114
 
115 115
 		$snaksArray = &$referenceArray['snaks'];
116 116
 
117 117
 		$snakPropertyId = $this->getSnakPropertyId();
118
-		if ( !array_key_exists( $snakPropertyId, $snaksArray ) ) {
118
+		if (!array_key_exists($snakPropertyId, $snaksArray)) {
119 119
 			$snaksArray[$snakPropertyId] = [];
120 120
 		}
121 121
 		$propertyArray = &$snaksArray[$snakPropertyId];
122 122
 
123 123
 		$snakHash = $this->getSnakHash();
124
-		foreach ( $propertyArray as &$potentialSnakArray ) {
125
-			if ( $potentialSnakArray['hash'] === $snakHash ) {
124
+		foreach ($propertyArray as &$potentialSnakArray) {
125
+			if ($potentialSnakArray['hash'] === $snakHash) {
126 126
 				$snakArray = &$potentialSnakArray;
127 127
 				break;
128 128
 			}
129 129
 		}
130
-		if ( !isset( $snakArray ) ) {
131
-			$snakArray = [ 'hash' => $snakHash ];
130
+		if (!isset($snakArray)) {
131
+			$snakArray = ['hash' => $snakHash];
132 132
 			$propertyArray[] = &$snakArray;
133 133
 		}
134 134
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/QualifierContextCursor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -80,29 +80,29 @@
 block discarded – undo
80 80
 		return $this->snakHash;
81 81
 	}
82 82
 
83
-	protected function &getMainArray( array &$container ) {
84
-		$statementArray = &$this->getStatementArray( $container );
83
+	protected function &getMainArray(array &$container) {
84
+		$statementArray = &$this->getStatementArray($container);
85 85
 
86
-		if ( !array_key_exists( 'qualifiers', $statementArray ) ) {
86
+		if (!array_key_exists('qualifiers', $statementArray)) {
87 87
 			$statementArray['qualifiers'] = [];
88 88
 		}
89 89
 		$qualifiersArray = &$statementArray['qualifiers'];
90 90
 
91 91
 		$snakPropertyId = $this->getSnakPropertyId();
92
-		if ( !array_key_exists( $snakPropertyId, $qualifiersArray ) ) {
92
+		if (!array_key_exists($snakPropertyId, $qualifiersArray)) {
93 93
 			$qualifiersArray[$snakPropertyId] = [];
94 94
 		}
95 95
 		$propertyArray = &$qualifiersArray[$snakPropertyId];
96 96
 
97 97
 		$snakHash = $this->getSnakHash();
98
-		foreach ( $propertyArray as &$potentialQualifierArray ) {
99
-			if ( $potentialQualifierArray['hash'] === $snakHash ) {
98
+		foreach ($propertyArray as &$potentialQualifierArray) {
99
+			if ($potentialQualifierArray['hash'] === $snakHash) {
100 100
 				$qualifierArray = &$potentialQualifierArray;
101 101
 				break;
102 102
 			}
103 103
 		}
104
-		if ( !isset( $qualifierArray ) ) {
105
-			$qualifierArray = [ 'hash' => $snakHash ];
104
+		if (!isset($qualifierArray)) {
105
+			$qualifierArray = ['hash' => $snakHash];
106 106
 			$propertyArray[] = &$qualifierArray;
107 107
 		}
108 108
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/MainSnakContextCursor.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,12 +72,12 @@
 block discarded – undo
72 72
 		return $this->snakHash;
73 73
 	}
74 74
 
75
-	protected function &getMainArray( array &$container ) {
76
-		$statementArray = &$this->getStatementArray( $container );
75
+	protected function &getMainArray(array &$container) {
76
+		$statementArray = &$this->getStatementArray($container);
77 77
 
78
-		if ( !array_key_exists( 'mainsnak', $statementArray ) ) {
78
+		if (!array_key_exists('mainsnak', $statementArray)) {
79 79
 			$snakHash = $this->getSnakHash();
80
-			$statementArray['mainsnak'] = [ 'hash' => $snakHash ];
80
+			$statementArray['mainsnak'] = ['hash' => $snakHash];
81 81
 		}
82 82
 		$mainsnakArray = &$statementArray['mainsnak'];
83 83
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ContextCursorSerializer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	 * @param ContextCursor $cursor
14 14
 	 * @return array
15 15
 	 */
16
-	public function serialize( ContextCursor $cursor ) {
16
+	public function serialize(ContextCursor $cursor) {
17 17
 		$type = $cursor->getType();
18 18
 		$serialization = [
19 19
 			't' => $type,
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 			'h' => $cursor->getSnakHash(),
24 24
 		];
25 25
 
26
-		if ( $type === Context::TYPE_QUALIFIER || $type === Context::TYPE_REFERENCE ) {
26
+		if ($type === Context::TYPE_QUALIFIER || $type === Context::TYPE_REFERENCE) {
27 27
 			$serialization['P'] = $cursor->getSnakPropertyId();
28
-			if ( $type === Context::TYPE_REFERENCE ) {
28
+			if ($type === Context::TYPE_REFERENCE) {
29 29
 				/** @var ReferenceContextCursor $cursor */
30 30
 				$serialization['r'] = $cursor->getReferenceHash();
31 31
 			}
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ContextCursorDeserializer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class ContextCursorDeserializer {
13 13
 
14
-	public function deserialize( array $serialization ) {
15
-		switch ( $serialization['t'] ) {
14
+	public function deserialize(array $serialization) {
15
+		switch ($serialization['t']) {
16 16
 			case Context::TYPE_STATEMENT:
17 17
 				return new MainSnakContextCursor(
18 18
 					$serialization['i'],
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 				);
40 40
 			default:
41 41
 				throw new InvalidArgumentException(
42
-					'Unknown serialization type ' . $serialization['t']
42
+					'Unknown serialization type '.$serialization['t']
43 43
 				);
44 44
 		}
45 45
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Result/CheckResultSerializer.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -72,27 +72,27 @@  discard block
 block discarded – undo
72 72
 	 * @param CheckResult $checkResult
73 73
 	 * @return array
74 74
 	 */
75
-	public function serialize( CheckResult $checkResult ) {
75
+	public function serialize(CheckResult $checkResult) {
76 76
 		$contextCursor = $checkResult->getContextCursor();
77 77
 		$constraint = $checkResult->getConstraint();
78 78
 		$violationMessage = $checkResult->getMessage();
79 79
 		$cachingMetadata = $checkResult->getMetadata()->getCachingMetadata();
80 80
 
81 81
 		$serialization = [
82
-			self::KEY_CONTEXT_CURSOR => $this->contextCursorSerializer->serialize( $contextCursor ),
83
-			self::KEY_CONSTRAINT => $this->constraintSerializer->serialize( $constraint ),
82
+			self::KEY_CONTEXT_CURSOR => $this->contextCursorSerializer->serialize($contextCursor),
83
+			self::KEY_CONSTRAINT => $this->constraintSerializer->serialize($constraint),
84 84
 			self::KEY_CHECK_RESULT_STATUS => $checkResult->getStatus(),
85
-			self::KEY_CACHING_METADATA => $this->serializeCachingMetadata( $cachingMetadata ),
85
+			self::KEY_CACHING_METADATA => $this->serializeCachingMetadata($cachingMetadata),
86 86
 		];
87 87
 
88
-		if ( $violationMessage !== null ) {
88
+		if ($violationMessage !== null) {
89 89
 			$serialization[self::KEY_VIOLATION_MESSAGE] =
90
-				$this->violationMessageSerializer->serialize( $violationMessage );
90
+				$this->violationMessageSerializer->serialize($violationMessage);
91 91
 		}
92 92
 
93
-		if ( $this->serializeDependencyMetadata ) {
93
+		if ($this->serializeDependencyMetadata) {
94 94
 			$serialization[self::KEY_DEPENDENCY_METADATA] =
95
-				$this->serializeDependencyMetadata( $checkResult );
95
+				$this->serializeDependencyMetadata($checkResult);
96 96
 		}
97 97
 
98 98
 		return $serialization;
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 	 * @param CachingMetadata $cachingMetadata
103 103
 	 * @return array
104 104
 	 */
105
-	private function serializeCachingMetadata( CachingMetadata $cachingMetadata ) {
105
+	private function serializeCachingMetadata(CachingMetadata $cachingMetadata) {
106 106
 		$maximumAge = $cachingMetadata->getMaximumAgeInSeconds();
107 107
 
108 108
 		$serialization = [];
109 109
 
110
-		if ( $maximumAge > 0 ) {
110
+		if ($maximumAge > 0) {
111 111
 			$serialization[self::KEY_CACHING_METADATA_MAX_AGE] = $maximumAge;
112 112
 		}
113 113
 
@@ -118,21 +118,21 @@  discard block
 block discarded – undo
118 118
 	 * @param CheckResult $checkResult
119 119
 	 * @return array
120 120
 	 */
121
-	private function serializeDependencyMetadata( CheckResult $checkResult ) {
121
+	private function serializeDependencyMetadata(CheckResult $checkResult) {
122 122
 		$dependencyMetadata = $checkResult->getMetadata()->getDependencyMetadata();
123 123
 		$entityIds = $dependencyMetadata->getEntityIds();
124 124
 		$futureTime = $dependencyMetadata->getFutureTime();
125 125
 
126 126
 		$serialization = [
127 127
 			self::KEY_DEPENDENCY_METADATA_ENTITY_IDS => array_map(
128
-				function ( EntityId $entityId ) {
128
+				function(EntityId $entityId) {
129 129
 					return $entityId->getSerialization();
130 130
 				},
131 131
 				$entityIds
132 132
 			),
133 133
 		];
134 134
 
135
-		if ( $futureTime !== null ) {
135
+		if ($futureTime !== null) {
136 136
 			$serialization[self::KEY_DEPENDENCY_METADATA_FUTURE_TIME] =
137 137
 				$futureTime->getArrayValue();
138 138
 		}
Please login to merge, or discard this patch.
src/ConstraintCheck/Result/CheckResultDeserializer.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @param array $serialization
56 56
 	 * @return CheckResult
57 57
 	 */
58
-	public function deserialize( array $serialization ) {
58
+	public function deserialize(array $serialization) {
59 59
 		$contextCursor = $this->contextCursorDeserializer->deserialize(
60 60
 			$serialization[CheckResultSerializer::KEY_CONTEXT_CURSOR]
61 61
 		);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 		$status = $serialization[CheckResultSerializer::KEY_CHECK_RESULT_STATUS];
70 70
 
71
-		if ( array_key_exists( CheckResultSerializer::KEY_VIOLATION_MESSAGE, $serialization ) ) {
71
+		if (array_key_exists(CheckResultSerializer::KEY_VIOLATION_MESSAGE, $serialization)) {
72 72
 			$violationMessage = $this->violationMessageDeserializer->deserialize(
73 73
 				$serialization[CheckResultSerializer::KEY_VIOLATION_MESSAGE]
74 74
 			);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 			$serialization[CheckResultSerializer::KEY_CACHING_METADATA]
81 81
 		);
82 82
 
83
-		if ( array_key_exists( CheckResultSerializer::KEY_DEPENDENCY_METADATA, $serialization ) ) {
83
+		if (array_key_exists(CheckResultSerializer::KEY_DEPENDENCY_METADATA, $serialization)) {
84 84
 			$dependencyMetadata = $this->deserializeDependencyMetadata(
85 85
 				$serialization[CheckResultSerializer::KEY_DEPENDENCY_METADATA]
86 86
 			);
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
 			$dependencyMetadata = DependencyMetadata::blank();
89 89
 		}
90 90
 
91
-		return ( new CheckResult(
91
+		return (new CheckResult(
92 92
 			$contextCursor,
93 93
 			$constraint,
94 94
 			$parameters,
95 95
 			$status,
96 96
 			$violationMessage
97
-		) )->withMetadata(
98
-			Metadata::merge( [
99
-				Metadata::ofCachingMetadata( $cachingMetadata ),
100
-				Metadata::ofDependencyMetadata( $dependencyMetadata ),
101
-			] )
97
+		))->withMetadata(
98
+			Metadata::merge([
99
+				Metadata::ofCachingMetadata($cachingMetadata),
100
+				Metadata::ofDependencyMetadata($dependencyMetadata),
101
+			])
102 102
 		);
103 103
 	}
104 104
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @param array $serialization
107 107
 	 * @return CachingMetadata
108 108
 	 */
109
-	private function deserializeCachingMetadata( array $serialization ) {
109
+	private function deserializeCachingMetadata(array $serialization) {
110 110
 		if (
111 111
 			array_key_exists(
112 112
 				CheckResultSerializer::KEY_CACHING_METADATA_MAX_AGE,
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @param array $serialization
126 126
 	 * @return DependencyMetadata
127 127
 	 */
128
-	private function deserializeDependencyMetadata( array $serialization ) {
128
+	private function deserializeDependencyMetadata(array $serialization) {
129 129
 		if (
130 130
 			array_key_exists(
131 131
 				CheckResultSerializer::KEY_DEPENDENCY_METADATA_FUTURE_TIME,
@@ -135,20 +135,20 @@  discard block
 block discarded – undo
135 135
 			$futureTime = TimeValue::newFromArray(
136 136
 				$serialization[CheckResultSerializer::KEY_DEPENDENCY_METADATA_FUTURE_TIME]
137 137
 			);
138
-			$futureTimeDependencyMetadata = DependencyMetadata::ofFutureTime( $futureTime );
138
+			$futureTimeDependencyMetadata = DependencyMetadata::ofFutureTime($futureTime);
139 139
 		} else {
140 140
 			$futureTimeDependencyMetadata = DependencyMetadata::blank();
141 141
 		}
142 142
 
143 143
 		$dependencyMetadata = array_reduce(
144 144
 			$serialization[CheckResultSerializer::KEY_DEPENDENCY_METADATA_ENTITY_IDS],
145
-			function ( DependencyMetadata $metadata, $entityIdSerialization ) {
146
-				$entityId = $this->entityIdParser->parse( $entityIdSerialization );
145
+			function(DependencyMetadata $metadata, $entityIdSerialization) {
146
+				$entityId = $this->entityIdParser->parse($entityIdSerialization);
147 147
 
148
-				return DependencyMetadata::merge( [
148
+				return DependencyMetadata::merge([
149 149
 					$metadata,
150
-					DependencyMetadata::ofEntityId( $entityId )
151
-				] );
150
+					DependencyMetadata::ofEntityId($entityId)
151
+				]);
152 152
 			},
153 153
 			$futureTimeDependencyMetadata
154 154
 		);
Please login to merge, or discard this patch.
src/ConstraintCheck/Helper/ConstraintParameterParser.php 1 patch
Spacing   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
 	 * @param array $parameters
78 78
 	 * @throws ConstraintParameterException
79 79
 	 */
80
-	public function checkError( array $parameters ) {
81
-		if ( array_key_exists( '@error', $parameters ) ) {
80
+	public function checkError(array $parameters) {
81
+		if (array_key_exists('@error', $parameters)) {
82 82
 			$error = $parameters['@error'];
83
-			if ( array_key_exists( 'toolong', $error ) && $error['toolong'] ) {
83
+			if (array_key_exists('toolong', $error) && $error['toolong']) {
84 84
 				$msg = 'wbqc-violation-message-parameters-error-toolong';
85 85
 			} else {
86 86
 				$msg = 'wbqc-violation-message-parameters-error-unknown';
87 87
 			}
88
-			throw new ConstraintParameterException( new ViolationMessage( $msg ) );
88
+			throw new ConstraintParameterException(new ViolationMessage($msg));
89 89
 		}
90 90
 	}
91 91
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @param string $parameterId
96 96
 	 * @throws ConstraintParameterException
97 97
 	 */
98
-	private function requireSingleParameter( array $parameters, $parameterId ) {
99
-		if ( count( $parameters[$parameterId] ) !== 1 ) {
98
+	private function requireSingleParameter(array $parameters, $parameterId) {
99
+		if (count($parameters[$parameterId]) !== 1) {
100 100
 			throw new ConstraintParameterException(
101
-				( new ViolationMessage( 'wbqc-violation-message-parameter-single' ) )
102
-					->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
101
+				(new ViolationMessage('wbqc-violation-message-parameter-single'))
102
+					->withEntityId(new PropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
103 103
 			);
104 104
 		}
105 105
 	}
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 	 * @return void
112 112
 	 * @throws ConstraintParameterException
113 113
 	 */
114
-	private function requireValueParameter( Snak $snak, $parameterId ) {
115
-		if ( !( $snak instanceof PropertyValueSnak ) ) {
114
+	private function requireValueParameter(Snak $snak, $parameterId) {
115
+		if (!($snak instanceof PropertyValueSnak)) {
116 116
 			throw new ConstraintParameterException(
117
-				( new ViolationMessage( 'wbqc-violation-message-parameter-value' ) )
118
-					->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
117
+				(new ViolationMessage('wbqc-violation-message-parameter-value'))
118
+					->withEntityId(new PropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
119 119
 			);
120 120
 		}
121 121
 	}
@@ -127,17 +127,17 @@  discard block
 block discarded – undo
127 127
 	 * @throws ConstraintParameterException
128 128
 	 * @return EntityId
129 129
 	 */
130
-	private function parseEntityIdParameter( array $snakSerialization, $parameterId ) {
131
-		$snak = $this->snakDeserializer->deserialize( $snakSerialization );
132
-		$this->requireValueParameter( $snak, $parameterId );
130
+	private function parseEntityIdParameter(array $snakSerialization, $parameterId) {
131
+		$snak = $this->snakDeserializer->deserialize($snakSerialization);
132
+		$this->requireValueParameter($snak, $parameterId);
133 133
 		$value = $snak->getDataValue();
134
-		if ( $value instanceof EntityIdValue ) {
134
+		if ($value instanceof EntityIdValue) {
135 135
 			return $value->getEntityId();
136 136
 		} else {
137 137
 			throw new ConstraintParameterException(
138
-				( new ViolationMessage( 'wbqc-violation-message-parameter-entity' ) )
139
-					->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
140
-					->withDataValue( $value, Role::CONSTRAINT_PARAMETER_VALUE )
138
+				(new ViolationMessage('wbqc-violation-message-parameter-entity'))
139
+					->withEntityId(new PropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
140
+					->withDataValue($value, Role::CONSTRAINT_PARAMETER_VALUE)
141 141
 			);
142 142
 		}
143 143
 	}
@@ -148,20 +148,20 @@  discard block
 block discarded – undo
148 148
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
149 149
 	 * @return string[] class entity ID serializations
150 150
 	 */
151
-	public function parseClassParameter( array $constraintParameters, $constraintTypeItemId ) {
152
-		$this->checkError( $constraintParameters );
153
-		$classId = $this->config->get( 'WBQualityConstraintsClassId' );
154
-		if ( !array_key_exists( $classId, $constraintParameters ) ) {
151
+	public function parseClassParameter(array $constraintParameters, $constraintTypeItemId) {
152
+		$this->checkError($constraintParameters);
153
+		$classId = $this->config->get('WBQualityConstraintsClassId');
154
+		if (!array_key_exists($classId, $constraintParameters)) {
155 155
 			throw new ConstraintParameterException(
156
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
157
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
158
-					->withEntityId( new PropertyId( $classId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
156
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
157
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
158
+					->withEntityId(new PropertyId($classId), Role::CONSTRAINT_PARAMETER_PROPERTY)
159 159
 			);
160 160
 		}
161 161
 
162 162
 		$classes = [];
163
-		foreach ( $constraintParameters[$classId] as $class ) {
164
-			$classes[] = $this->parseEntityIdParameter( $class, $classId )->getSerialization();
163
+		foreach ($constraintParameters[$classId] as $class) {
164
+			$classes[] = $this->parseEntityIdParameter($class, $classId)->getSerialization();
165 165
 		}
166 166
 		return $classes;
167 167
 	}
@@ -172,23 +172,23 @@  discard block
 block discarded – undo
172 172
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
173 173
 	 * @return string 'instance', 'subclass', or 'instanceOrSubclass'
174 174
 	 */
175
-	public function parseRelationParameter( array $constraintParameters, $constraintTypeItemId ) {
176
-		$this->checkError( $constraintParameters );
177
-		$relationId = $this->config->get( 'WBQualityConstraintsRelationId' );
178
-		if ( !array_key_exists( $relationId, $constraintParameters ) ) {
175
+	public function parseRelationParameter(array $constraintParameters, $constraintTypeItemId) {
176
+		$this->checkError($constraintParameters);
177
+		$relationId = $this->config->get('WBQualityConstraintsRelationId');
178
+		if (!array_key_exists($relationId, $constraintParameters)) {
179 179
 			throw new ConstraintParameterException(
180
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
181
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
182
-					->withEntityId( new PropertyId( $relationId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
180
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
181
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
182
+					->withEntityId(new PropertyId($relationId), Role::CONSTRAINT_PARAMETER_PROPERTY)
183 183
 			);
184 184
 		}
185 185
 
186
-		$this->requireSingleParameter( $constraintParameters, $relationId );
187
-		$relationEntityId = $this->parseEntityIdParameter( $constraintParameters[$relationId][0], $relationId );
188
-		$instanceId = $this->config->get( 'WBQualityConstraintsInstanceOfRelationId' );
189
-		$subclassId = $this->config->get( 'WBQualityConstraintsSubclassOfRelationId' );
190
-		$instanceOrSubclassId = $this->config->get( 'WBQualityConstraintsInstanceOrSubclassOfRelationId' );
191
-		switch ( $relationEntityId ) {
186
+		$this->requireSingleParameter($constraintParameters, $relationId);
187
+		$relationEntityId = $this->parseEntityIdParameter($constraintParameters[$relationId][0], $relationId);
188
+		$instanceId = $this->config->get('WBQualityConstraintsInstanceOfRelationId');
189
+		$subclassId = $this->config->get('WBQualityConstraintsSubclassOfRelationId');
190
+		$instanceOrSubclassId = $this->config->get('WBQualityConstraintsInstanceOrSubclassOfRelationId');
191
+		switch ($relationEntityId) {
192 192
 			case $instanceId:
193 193
 				return 'instance';
194 194
 			case $subclassId:
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
 				return 'instanceOrSubclass';
198 198
 			default:
199 199
 				throw new ConstraintParameterException(
200
-					( new ViolationMessage( 'wbqc-violation-message-parameter-oneof' ) )
201
-						->withEntityId( new PropertyId( $relationId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
200
+					(new ViolationMessage('wbqc-violation-message-parameter-oneof'))
201
+						->withEntityId(new PropertyId($relationId), Role::CONSTRAINT_PARAMETER_PROPERTY)
202 202
 						->withEntityIdList(
203 203
 							[
204
-								new ItemId( $instanceId ),
205
-								new ItemId( $subclassId ),
206
-								new ItemId( $instanceOrSubclassId ),
204
+								new ItemId($instanceId),
205
+								new ItemId($subclassId),
206
+								new ItemId($instanceOrSubclassId),
207 207
 							],
208 208
 							Role::CONSTRAINT_PARAMETER_VALUE
209 209
 						)
@@ -218,20 +218,20 @@  discard block
 block discarded – undo
218 218
 	 * @throws ConstraintParameterException
219 219
 	 * @return PropertyId
220 220
 	 */
221
-	private function parsePropertyIdParameter( array $snakSerialization, $parameterId ) {
222
-		$snak = $this->snakDeserializer->deserialize( $snakSerialization );
223
-		$this->requireValueParameter( $snak, $parameterId );
221
+	private function parsePropertyIdParameter(array $snakSerialization, $parameterId) {
222
+		$snak = $this->snakDeserializer->deserialize($snakSerialization);
223
+		$this->requireValueParameter($snak, $parameterId);
224 224
 		$value = $snak->getDataValue();
225
-		if ( $value instanceof EntityIdValue ) {
225
+		if ($value instanceof EntityIdValue) {
226 226
 			$id = $value->getEntityId();
227
-			if ( $id instanceof PropertyId ) {
227
+			if ($id instanceof PropertyId) {
228 228
 				return $id;
229 229
 			}
230 230
 		}
231 231
 		throw new ConstraintParameterException(
232
-			( new ViolationMessage( 'wbqc-violation-message-parameter-property' ) )
233
-				->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
234
-				->withDataValue( $value, Role::CONSTRAINT_PARAMETER_VALUE )
232
+			(new ViolationMessage('wbqc-violation-message-parameter-property'))
233
+				->withEntityId(new PropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
234
+				->withDataValue($value, Role::CONSTRAINT_PARAMETER_VALUE)
235 235
 		);
236 236
 	}
237 237
 
@@ -242,32 +242,32 @@  discard block
 block discarded – undo
242 242
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
243 243
 	 * @return PropertyId
244 244
 	 */
245
-	public function parsePropertyParameter( array $constraintParameters, $constraintTypeItemId ) {
246
-		$this->checkError( $constraintParameters );
247
-		$propertyId = $this->config->get( 'WBQualityConstraintsPropertyId' );
248
-		if ( !array_key_exists( $propertyId, $constraintParameters ) ) {
245
+	public function parsePropertyParameter(array $constraintParameters, $constraintTypeItemId) {
246
+		$this->checkError($constraintParameters);
247
+		$propertyId = $this->config->get('WBQualityConstraintsPropertyId');
248
+		if (!array_key_exists($propertyId, $constraintParameters)) {
249 249
 			throw new ConstraintParameterException(
250
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
251
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
252
-					->withEntityId( new PropertyId( $propertyId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
250
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
251
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
252
+					->withEntityId(new PropertyId($propertyId), Role::CONSTRAINT_PARAMETER_PROPERTY)
253 253
 			);
254 254
 		}
255 255
 
256
-		$this->requireSingleParameter( $constraintParameters, $propertyId );
257
-		return $this->parsePropertyIdParameter( $constraintParameters[$propertyId][0], $propertyId );
256
+		$this->requireSingleParameter($constraintParameters, $propertyId);
257
+		return $this->parsePropertyIdParameter($constraintParameters[$propertyId][0], $propertyId);
258 258
 	}
259 259
 
260
-	private function parseItemIdParameter( PropertyValueSnak $snak, $parameterId ) {
260
+	private function parseItemIdParameter(PropertyValueSnak $snak, $parameterId) {
261 261
 		$dataValue = $snak->getDataValue();
262
-		if ( $dataValue instanceof EntityIdValue &&
262
+		if ($dataValue instanceof EntityIdValue &&
263 263
 			$dataValue->getEntityId() instanceof ItemId
264 264
 		) {
265
-			return ItemIdSnakValue::fromItemId( $dataValue->getEntityId() );
265
+			return ItemIdSnakValue::fromItemId($dataValue->getEntityId());
266 266
 		} else {
267 267
 			throw new ConstraintParameterException(
268
-				( new ViolationMessage( 'wbqc-violation-message-parameter-item' ) )
269
-					->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
270
-					->withDataValue( $dataValue, Role::CONSTRAINT_PARAMETER_VALUE )
268
+				(new ViolationMessage('wbqc-violation-message-parameter-item'))
269
+					->withEntityId(new PropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
270
+					->withDataValue($dataValue, Role::CONSTRAINT_PARAMETER_VALUE)
271 271
 			);
272 272
 		}
273 273
 	}
@@ -279,15 +279,15 @@  discard block
 block discarded – undo
279 279
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
280 280
 	 * @return ItemIdSnakValue[] array of values
281 281
 	 */
282
-	public function parseItemsParameter( array $constraintParameters, $constraintTypeItemId, $required ) {
283
-		$this->checkError( $constraintParameters );
284
-		$qualifierId = $this->config->get( 'WBQualityConstraintsQualifierOfPropertyConstraintId' );
285
-		if ( !array_key_exists( $qualifierId, $constraintParameters ) ) {
286
-			if ( $required ) {
282
+	public function parseItemsParameter(array $constraintParameters, $constraintTypeItemId, $required) {
283
+		$this->checkError($constraintParameters);
284
+		$qualifierId = $this->config->get('WBQualityConstraintsQualifierOfPropertyConstraintId');
285
+		if (!array_key_exists($qualifierId, $constraintParameters)) {
286
+			if ($required) {
287 287
 				throw new ConstraintParameterException(
288
-					( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
289
-						->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
290
-						->withEntityId( new PropertyId( $qualifierId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
288
+					(new ViolationMessage('wbqc-violation-message-parameter-needed'))
289
+						->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
290
+						->withEntityId(new PropertyId($qualifierId), Role::CONSTRAINT_PARAMETER_PROPERTY)
291 291
 				);
292 292
 			} else {
293 293
 				return [];
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 		}
296 296
 
297 297
 		$values = [];
298
-		foreach ( $constraintParameters[$qualifierId] as $parameter ) {
299
-			$snak = $this->snakDeserializer->deserialize( $parameter );
300
-			switch ( true ) {
298
+		foreach ($constraintParameters[$qualifierId] as $parameter) {
299
+			$snak = $this->snakDeserializer->deserialize($parameter);
300
+			switch (true) {
301 301
 				case $snak instanceof PropertyValueSnak:
302
-					$values[] = $this->parseItemIdParameter( $snak, $qualifierId );
302
+					$values[] = $this->parseItemIdParameter($snak, $qualifierId);
303 303
 					break;
304 304
 				case $snak instanceof PropertySomeValueSnak:
305 305
 					$values[] = ItemIdSnakValue::someValue();
@@ -318,27 +318,27 @@  discard block
 block discarded – undo
318 318
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
319 319
 	 * @return PropertyId[]
320 320
 	 */
321
-	public function parsePropertiesParameter( array $constraintParameters, $constraintTypeItemId ) {
322
-		$this->checkError( $constraintParameters );
323
-		$propertyId = $this->config->get( 'WBQualityConstraintsPropertyId' );
324
-		if ( !array_key_exists( $propertyId, $constraintParameters ) ) {
321
+	public function parsePropertiesParameter(array $constraintParameters, $constraintTypeItemId) {
322
+		$this->checkError($constraintParameters);
323
+		$propertyId = $this->config->get('WBQualityConstraintsPropertyId');
324
+		if (!array_key_exists($propertyId, $constraintParameters)) {
325 325
 			throw new ConstraintParameterException(
326
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
327
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
328
-					->withEntityId( new PropertyId( $propertyId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
326
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
327
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
328
+					->withEntityId(new PropertyId($propertyId), Role::CONSTRAINT_PARAMETER_PROPERTY)
329 329
 			);
330 330
 		}
331 331
 
332 332
 		$parameters = $constraintParameters[$propertyId];
333
-		if ( count( $parameters ) === 1 &&
334
-			$this->snakDeserializer->deserialize( $parameters[0] ) instanceof PropertyNoValueSnak
333
+		if (count($parameters) === 1 &&
334
+			$this->snakDeserializer->deserialize($parameters[0]) instanceof PropertyNoValueSnak
335 335
 		) {
336 336
 			return [];
337 337
 		}
338 338
 
339 339
 		$properties = [];
340
-		foreach ( $parameters as $parameter ) {
341
-			$properties[] = $this->parsePropertyIdParameter( $parameter, $propertyId );
340
+		foreach ($parameters as $parameter) {
341
+			$properties[] = $this->parsePropertyIdParameter($parameter, $propertyId);
342 342
 		}
343 343
 		return $properties;
344 344
 	}
@@ -349,16 +349,16 @@  discard block
 block discarded – undo
349 349
 	 * @throws ConstraintParameterException
350 350
 	 * @return DataValue|null
351 351
 	 */
352
-	private function parseValueOrNoValueParameter( array $snakSerialization, $parameterId ) {
353
-		$snak = $this->snakDeserializer->deserialize( $snakSerialization );
354
-		if ( $snak instanceof PropertyValueSnak ) {
352
+	private function parseValueOrNoValueParameter(array $snakSerialization, $parameterId) {
353
+		$snak = $this->snakDeserializer->deserialize($snakSerialization);
354
+		if ($snak instanceof PropertyValueSnak) {
355 355
 			return $snak->getDataValue();
356
-		} elseif ( $snak instanceof PropertyNoValueSnak ) {
356
+		} elseif ($snak instanceof PropertyNoValueSnak) {
357 357
 			return null;
358 358
 		} else {
359 359
 			throw new ConstraintParameterException(
360
-				( new ViolationMessage( 'wbqc-violation-message-parameter-value-or-novalue' ) )
361
-					->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
360
+				(new ViolationMessage('wbqc-violation-message-parameter-value-or-novalue'))
361
+					->withEntityId(new PropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
362 362
 			);
363 363
 		}
364 364
 	}
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 	 * @param string $parameterId
369 369
 	 * @return DataValue|null
370 370
 	 */
371
-	private function parseValueOrNoValueOrNowParameter( array $snakSerialization, $parameterId ) {
371
+	private function parseValueOrNoValueOrNowParameter(array $snakSerialization, $parameterId) {
372 372
 		try {
373
-			return $this->parseValueOrNoValueParameter( $snakSerialization, $parameterId );
374
-		} catch ( ConstraintParameterException $e ) {
373
+			return $this->parseValueOrNoValueParameter($snakSerialization, $parameterId);
374
+		} catch (ConstraintParameterException $e) {
375 375
 			// unknown value means “now”
376 376
 			return new NowValue();
377 377
 		}
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
 	 * @param string $unit
385 385
 	 * @return bool
386 386
 	 */
387
-	private function exactlyOneQuantityWithUnit( DataValue $min = null, DataValue $max = null, $unit ) {
388
-		if ( !( $min instanceof UnboundedQuantityValue ) ||
389
-			!( $max instanceof UnboundedQuantityValue )
387
+	private function exactlyOneQuantityWithUnit(DataValue $min = null, DataValue $max = null, $unit) {
388
+		if (!($min instanceof UnboundedQuantityValue) ||
389
+			!($max instanceof UnboundedQuantityValue)
390 390
 		) {
391 391
 			return false;
392 392
 		}
393 393
 
394
-		return ( $min->getUnit() === $unit ) !== ( $max->getUnit() === $unit );
394
+		return ($min->getUnit() === $unit) !== ($max->getUnit() === $unit);
395 395
 	}
396 396
 
397 397
 	/**
@@ -404,42 +404,42 @@  discard block
 block discarded – undo
404 404
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
405 405
 	 * @return DataValue[] if the parameter is invalid or missing
406 406
 	 */
407
-	private function parseRangeParameter( array $constraintParameters, $minimumId, $maximumId, $constraintTypeItemId, $type ) {
408
-		$this->checkError( $constraintParameters );
409
-		if ( !array_key_exists( $minimumId, $constraintParameters ) ||
410
-			!array_key_exists( $maximumId, $constraintParameters )
407
+	private function parseRangeParameter(array $constraintParameters, $minimumId, $maximumId, $constraintTypeItemId, $type) {
408
+		$this->checkError($constraintParameters);
409
+		if (!array_key_exists($minimumId, $constraintParameters) ||
410
+			!array_key_exists($maximumId, $constraintParameters)
411 411
 		) {
412 412
 			throw new ConstraintParameterException(
413
-				( new ViolationMessage( 'wbqc-violation-message-range-parameters-needed' ) )
414
-					->withDataValueType( $type )
415
-					->withEntityId( new PropertyId( $minimumId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
416
-					->withEntityId( new PropertyId( $maximumId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
417
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
413
+				(new ViolationMessage('wbqc-violation-message-range-parameters-needed'))
414
+					->withDataValueType($type)
415
+					->withEntityId(new PropertyId($minimumId), Role::CONSTRAINT_PARAMETER_PROPERTY)
416
+					->withEntityId(new PropertyId($maximumId), Role::CONSTRAINT_PARAMETER_PROPERTY)
417
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
418 418
 			);
419 419
 		}
420 420
 
421
-		$this->requireSingleParameter( $constraintParameters, $minimumId );
422
-		$this->requireSingleParameter( $constraintParameters, $maximumId );
421
+		$this->requireSingleParameter($constraintParameters, $minimumId);
422
+		$this->requireSingleParameter($constraintParameters, $maximumId);
423 423
 		$parseFunction = $type === 'time' ? 'parseValueOrNoValueOrNowParameter' : 'parseValueOrNoValueParameter';
424
-		$min = $this->$parseFunction( $constraintParameters[$minimumId][0], $minimumId );
425
-		$max = $this->$parseFunction( $constraintParameters[$maximumId][0], $maximumId );
424
+		$min = $this->$parseFunction($constraintParameters[$minimumId][0], $minimumId);
425
+		$max = $this->$parseFunction($constraintParameters[$maximumId][0], $maximumId);
426 426
 
427
-		$yearUnit = $this->config->get( 'WBQualityConstraintsYearUnit' );
428
-		if ( $this->exactlyOneQuantityWithUnit( $min, $max, $yearUnit ) ) {
427
+		$yearUnit = $this->config->get('WBQualityConstraintsYearUnit');
428
+		if ($this->exactlyOneQuantityWithUnit($min, $max, $yearUnit)) {
429 429
 			throw new ConstraintParameterException(
430
-				new ViolationMessage( 'wbqc-violation-message-range-parameters-one-year' )
430
+				new ViolationMessage('wbqc-violation-message-range-parameters-one-year')
431 431
 			);
432 432
 		}
433
-		if ( $min === null && $max === null ||
434
-			$min !== null && $max !== null && $min->equals( $max ) ) {
433
+		if ($min === null && $max === null ||
434
+			$min !== null && $max !== null && $min->equals($max)) {
435 435
 			throw new ConstraintParameterException(
436
-				( new ViolationMessage( 'wbqc-violation-message-range-parameters-same' ) )
437
-					->withEntityId( new PropertyId( $minimumId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
438
-					->withEntityId( new PropertyId( $maximumId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
436
+				(new ViolationMessage('wbqc-violation-message-range-parameters-same'))
437
+					->withEntityId(new PropertyId($minimumId), Role::CONSTRAINT_PARAMETER_PROPERTY)
438
+					->withEntityId(new PropertyId($maximumId), Role::CONSTRAINT_PARAMETER_PROPERTY)
439 439
 			);
440 440
 		}
441 441
 
442
-		return [ $min, $max ];
442
+		return [$min, $max];
443 443
 	}
444 444
 
445 445
 	/**
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
450 450
 	 * @return DataValue[] a pair of two data values, either of which may be null to signify an open range
451 451
 	 */
452
-	public function parseQuantityRangeParameter( array $constraintParameters, $constraintTypeItemId ) {
452
+	public function parseQuantityRangeParameter(array $constraintParameters, $constraintTypeItemId) {
453 453
 		return $this->parseRangeParameter(
454 454
 			$constraintParameters,
455
-			$this->config->get( 'WBQualityConstraintsMinimumQuantityId' ),
456
-			$this->config->get( 'WBQualityConstraintsMaximumQuantityId' ),
455
+			$this->config->get('WBQualityConstraintsMinimumQuantityId'),
456
+			$this->config->get('WBQualityConstraintsMaximumQuantityId'),
457 457
 			$constraintTypeItemId,
458 458
 			'quantity'
459 459
 		);
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
467 467
 	 * @return DataValue[] a pair of two data values, either of which may be null to signify an open range
468 468
 	 */
469
-	public function parseTimeRangeParameter( array $constraintParameters, $constraintTypeItemId ) {
469
+	public function parseTimeRangeParameter(array $constraintParameters, $constraintTypeItemId) {
470 470
 		return $this->parseRangeParameter(
471 471
 			$constraintParameters,
472
-			$this->config->get( 'WBQualityConstraintsMinimumDateId' ),
473
-			$this->config->get( 'WBQualityConstraintsMaximumDateId' ),
472
+			$this->config->get('WBQualityConstraintsMinimumDateId'),
473
+			$this->config->get('WBQualityConstraintsMaximumDateId'),
474 474
 			$constraintTypeItemId,
475 475
 			'time'
476 476
 		);
@@ -483,17 +483,17 @@  discard block
 block discarded – undo
483 483
 	 * @throws ConstraintParameterException
484 484
 	 * @return string
485 485
 	 */
486
-	private function parseStringParameter( array $snakSerialization, $parameterId ) {
487
-		$snak = $this->snakDeserializer->deserialize( $snakSerialization );
488
-		$this->requireValueParameter( $snak, $parameterId );
486
+	private function parseStringParameter(array $snakSerialization, $parameterId) {
487
+		$snak = $this->snakDeserializer->deserialize($snakSerialization);
488
+		$this->requireValueParameter($snak, $parameterId);
489 489
 		$value = $snak->getDataValue();
490
-		if ( $value instanceof StringValue ) {
490
+		if ($value instanceof StringValue) {
491 491
 			return $value->getValue();
492 492
 		} else {
493 493
 			throw new ConstraintParameterException(
494
-				( new ViolationMessage( 'wbqc-violation-message-parameter-string' ) )
495
-					->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
496
-					->withDataValue( $value, Role::CONSTRAINT_PARAMETER_VALUE )
494
+				(new ViolationMessage('wbqc-violation-message-parameter-string'))
495
+					->withEntityId(new PropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
496
+					->withDataValue($value, Role::CONSTRAINT_PARAMETER_VALUE)
497 497
 			);
498 498
 		}
499 499
 	}
@@ -504,15 +504,15 @@  discard block
 block discarded – undo
504 504
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
505 505
 	 * @return string
506 506
 	 */
507
-	public function parseNamespaceParameter( array $constraintParameters, $constraintTypeItemId ) {
508
-		$this->checkError( $constraintParameters );
509
-		$namespaceId = $this->config->get( 'WBQualityConstraintsNamespaceId' );
510
-		if ( !array_key_exists( $namespaceId, $constraintParameters ) ) {
507
+	public function parseNamespaceParameter(array $constraintParameters, $constraintTypeItemId) {
508
+		$this->checkError($constraintParameters);
509
+		$namespaceId = $this->config->get('WBQualityConstraintsNamespaceId');
510
+		if (!array_key_exists($namespaceId, $constraintParameters)) {
511 511
 			return '';
512 512
 		}
513 513
 
514
-		$this->requireSingleParameter( $constraintParameters, $namespaceId );
515
-		return $this->parseStringParameter( $constraintParameters[$namespaceId][0], $namespaceId );
514
+		$this->requireSingleParameter($constraintParameters, $namespaceId);
515
+		return $this->parseStringParameter($constraintParameters[$namespaceId][0], $namespaceId);
516 516
 	}
517 517
 
518 518
 	/**
@@ -521,19 +521,19 @@  discard block
 block discarded – undo
521 521
 	 * @throws ConstraintParameterException if the parameter is invalid or missing
522 522
 	 * @return string
523 523
 	 */
524
-	public function parseFormatParameter( array $constraintParameters, $constraintTypeItemId ) {
525
-		$this->checkError( $constraintParameters );
526
-		$formatId = $this->config->get( 'WBQualityConstraintsFormatAsARegularExpressionId' );
527
-		if ( !array_key_exists( $formatId, $constraintParameters ) ) {
524
+	public function parseFormatParameter(array $constraintParameters, $constraintTypeItemId) {
525
+		$this->checkError($constraintParameters);
526
+		$formatId = $this->config->get('WBQualityConstraintsFormatAsARegularExpressionId');
527
+		if (!array_key_exists($formatId, $constraintParameters)) {
528 528
 			throw new ConstraintParameterException(
529
-				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
530
-					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
531
-					->withEntityId( new PropertyId( $formatId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
529
+				(new ViolationMessage('wbqc-violation-message-parameter-needed'))
530
+					->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
531
+					->withEntityId(new PropertyId($formatId), Role::CONSTRAINT_PARAMETER_PROPERTY)
532 532
 			);
533 533
 		}
534 534
 
535
-		$this->requireSingleParameter( $constraintParameters, $formatId );
536
-		return $this->parseStringParameter( $constraintParameters[$formatId][0], $formatId );
535
+		$this->requireSingleParameter($constraintParameters, $formatId);
536
+		return $this->parseStringParameter($constraintParameters[$formatId][0], $formatId);
537 537
 	}
538 538
 
539 539
 	/**
@@ -541,16 +541,16 @@  discard block
 block discarded – undo
541 541
 	 * @throws ConstraintParameterException if the parameter is invalid
542 542
 	 * @return EntityId[]
543 543
 	 */
544
-	public function parseExceptionParameter( array $constraintParameters ) {
545
-		$this->checkError( $constraintParameters );
546
-		$exceptionId = $this->config->get( 'WBQualityConstraintsExceptionToConstraintId' );
547
-		if ( !array_key_exists( $exceptionId, $constraintParameters ) ) {
544
+	public function parseExceptionParameter(array $constraintParameters) {
545
+		$this->checkError($constraintParameters);
546
+		$exceptionId = $this->config->get('WBQualityConstraintsExceptionToConstraintId');
547
+		if (!array_key_exists($exceptionId, $constraintParameters)) {
548 548
 			return [];
549 549
 		}
550 550
 
551 551
 		return array_map(
552
-			function( $snakSerialization ) use ( $exceptionId ) {
553
-				return $this->parseEntityIdParameter( $snakSerialization, $exceptionId );
552
+			function($snakSerialization) use ($exceptionId) {
553
+				return $this->parseEntityIdParameter($snakSerialization, $exceptionId);
554 554
 			},
555 555
 			$constraintParameters[$exceptionId]
556 556
 		);
@@ -561,26 +561,26 @@  discard block
 block discarded – undo
561 561
 	 * @throws ConstraintParameterException if the parameter is invalid
562 562
 	 * @return string|null 'mandatory' or null
563 563
 	 */
564
-	public function parseConstraintStatusParameter( array $constraintParameters ) {
565
-		$this->checkError( $constraintParameters );
566
-		$constraintStatusId = $this->config->get( 'WBQualityConstraintsConstraintStatusId' );
567
-		if ( !array_key_exists( $constraintStatusId, $constraintParameters ) ) {
564
+	public function parseConstraintStatusParameter(array $constraintParameters) {
565
+		$this->checkError($constraintParameters);
566
+		$constraintStatusId = $this->config->get('WBQualityConstraintsConstraintStatusId');
567
+		if (!array_key_exists($constraintStatusId, $constraintParameters)) {
568 568
 			return null;
569 569
 		}
570 570
 
571
-		$mandatoryId = $this->config->get( 'WBQualityConstraintsMandatoryConstraintId' );
572
-		$this->requireSingleParameter( $constraintParameters, $constraintStatusId );
573
-		$snak = $this->snakDeserializer->deserialize( $constraintParameters[$constraintStatusId][0] );
574
-		$this->requireValueParameter( $snak, $constraintStatusId );
571
+		$mandatoryId = $this->config->get('WBQualityConstraintsMandatoryConstraintId');
572
+		$this->requireSingleParameter($constraintParameters, $constraintStatusId);
573
+		$snak = $this->snakDeserializer->deserialize($constraintParameters[$constraintStatusId][0]);
574
+		$this->requireValueParameter($snak, $constraintStatusId);
575 575
 		$statusId = $snak->getDataValue()->getEntityId()->getSerialization();
576 576
 
577
-		if ( $statusId === $mandatoryId ) {
577
+		if ($statusId === $mandatoryId) {
578 578
 			return 'mandatory';
579 579
 		} else {
580 580
 			throw new ConstraintParameterException(
581
-				( new ViolationMessage( 'wbqc-violation-message-parameter-oneof' ) )
582
-					->withEntityId( new PropertyId( $constraintStatusId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
583
-					->withEntityIdList( [ new ItemId( $mandatoryId ) ], Role::CONSTRAINT_PARAMETER_VALUE )
581
+				(new ViolationMessage('wbqc-violation-message-parameter-oneof'))
582
+					->withEntityId(new PropertyId($constraintStatusId), Role::CONSTRAINT_PARAMETER_PROPERTY)
583
+					->withEntityIdList([new ItemId($mandatoryId)], Role::CONSTRAINT_PARAMETER_VALUE)
584 584
 			);
585 585
 		}
586 586
 	}
@@ -592,12 +592,12 @@  discard block
 block discarded – undo
592 592
 	 * @return void
593 593
 	 * @throws ConstraintParameterException
594 594
 	 */
595
-	private function requireMonolingualTextParameter( DataValue $dataValue, $parameterId ) {
596
-		if ( !( $dataValue instanceof MonolingualTextValue ) ) {
595
+	private function requireMonolingualTextParameter(DataValue $dataValue, $parameterId) {
596
+		if (!($dataValue instanceof MonolingualTextValue)) {
597 597
 			throw new ConstraintParameterException(
598
-				( new ViolationMessage( 'wbqc-violation-message-parameter-monolingualtext' ) )
599
-					->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
600
-					->withDataValue( $dataValue, Role::CONSTRAINT_PARAMETER_VALUE )
598
+				(new ViolationMessage('wbqc-violation-message-parameter-monolingualtext'))
599
+					->withEntityId(new PropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
600
+					->withDataValue($dataValue, Role::CONSTRAINT_PARAMETER_VALUE)
601 601
 			);
602 602
 		}
603 603
 	}
@@ -610,30 +610,30 @@  discard block
 block discarded – undo
610 610
 	 * @throws ConstraintParameterException if invalid snaks are found or a language has multiple texts
611 611
 	 * @return MultilingualTextValue
612 612
 	 */
613
-	private function parseMultilingualTextParameter( array $snakSerializations, $parameterId ) {
613
+	private function parseMultilingualTextParameter(array $snakSerializations, $parameterId) {
614 614
 		$result = [];
615 615
 
616
-		foreach ( $snakSerializations as $snakSerialization ) {
617
-			$snak = $this->snakDeserializer->deserialize( $snakSerialization );
618
-			$this->requireValueParameter( $snak, $parameterId );
616
+		foreach ($snakSerializations as $snakSerialization) {
617
+			$snak = $this->snakDeserializer->deserialize($snakSerialization);
618
+			$this->requireValueParameter($snak, $parameterId);
619 619
 
620 620
 			$value = $snak->getDataValue();
621
-			$this->requireMonolingualTextParameter( $value, $parameterId );
621
+			$this->requireMonolingualTextParameter($value, $parameterId);
622 622
 			/** @var MonolingualTextValue $value */
623 623
 
624 624
 			$code = $value->getLanguageCode();
625
-			if ( array_key_exists( $code, $result ) ) {
625
+			if (array_key_exists($code, $result)) {
626 626
 				throw new ConstraintParameterException(
627
-					( new ViolationMessage( 'wbqc-violation-message-parameter-single-per-language' ) )
628
-						->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
629
-						->withLanguage( $code )
627
+					(new ViolationMessage('wbqc-violation-message-parameter-single-per-language'))
628
+						->withEntityId(new PropertyId($parameterId), Role::CONSTRAINT_PARAMETER_PROPERTY)
629
+						->withLanguage($code)
630 630
 				);
631 631
 			}
632 632
 
633 633
 			$result[$code] = $value;
634 634
 		}
635 635
 
636
-		return new MultilingualTextValue( $result );
636
+		return new MultilingualTextValue($result);
637 637
 	}
638 638
 
639 639
 	/**
@@ -641,11 +641,11 @@  discard block
 block discarded – undo
641 641
 	 * @throws ConstraintParameterException if the parameter is invalid
642 642
 	 * @return MultilingualTextValue
643 643
 	 */
644
-	public function parseSyntaxClarificationParameter( array $constraintParameters ) {
645
-		$syntaxClarificationId = $this->config->get( 'WBQualityConstraintsSyntaxClarificationId' );
644
+	public function parseSyntaxClarificationParameter(array $constraintParameters) {
645
+		$syntaxClarificationId = $this->config->get('WBQualityConstraintsSyntaxClarificationId');
646 646
 
647
-		if ( !array_key_exists( $syntaxClarificationId, $constraintParameters ) ) {
648
-			return new MultilingualTextValue( [] );
647
+		if (!array_key_exists($syntaxClarificationId, $constraintParameters)) {
648
+			return new MultilingualTextValue([]);
649 649
 		}
650 650
 
651 651
 		$syntaxClarifications = $this->parseMultilingualTextParameter(
@@ -664,20 +664,20 @@  discard block
 block discarded – undo
664 664
 	 * @throws ConstraintParameterException if the parameter is invalid
665 665
 	 * @return string[]|null Context::TYPE_* constants
666 666
 	 */
667
-	public function parseConstraintScopeParameter( array $constraintParameters, $constraintTypeItemId, array $validScopes = null ) {
668
-		$constraintScopeId = $this->config->get( 'WBQualityConstraintsConstraintScopeId' );
669
-		$mainSnakId = $this->config->get( 'WBQualityConstraintsConstraintCheckedOnMainValueId' );
670
-		$qualifiersId = $this->config->get( 'WBQualityConstraintsConstraintCheckedOnQualifiersId' );
671
-		$referencesId = $this->config->get( 'WBQualityConstraintsConstraintCheckedOnReferencesId' );
667
+	public function parseConstraintScopeParameter(array $constraintParameters, $constraintTypeItemId, array $validScopes = null) {
668
+		$constraintScopeId = $this->config->get('WBQualityConstraintsConstraintScopeId');
669
+		$mainSnakId = $this->config->get('WBQualityConstraintsConstraintCheckedOnMainValueId');
670
+		$qualifiersId = $this->config->get('WBQualityConstraintsConstraintCheckedOnQualifiersId');
671
+		$referencesId = $this->config->get('WBQualityConstraintsConstraintCheckedOnReferencesId');
672 672
 
673
-		if ( !array_key_exists( $constraintScopeId, $constraintParameters ) ) {
673
+		if (!array_key_exists($constraintScopeId, $constraintParameters)) {
674 674
 			return null;
675 675
 		}
676 676
 
677 677
 		$contextTypes = [];
678
-		foreach ( $constraintParameters[$constraintScopeId] as $snakSerialization ) {
679
-			$scopeEntityId = $this->parseEntityIdParameter( $snakSerialization, $constraintScopeId );
680
-			switch ( $scopeEntityId->getSerialization() ) {
678
+		foreach ($constraintParameters[$constraintScopeId] as $snakSerialization) {
679
+			$scopeEntityId = $this->parseEntityIdParameter($snakSerialization, $constraintScopeId);
680
+			switch ($scopeEntityId->getSerialization()) {
681 681
 				case $mainSnakId:
682 682
 					$contextTypes[] = Context::TYPE_STATEMENT;
683 683
 					break;
@@ -689,13 +689,13 @@  discard block
 block discarded – undo
689 689
 					break;
690 690
 				default:
691 691
 					throw new ConstraintParameterException(
692
-						( new ViolationMessage( 'wbqc-violation-message-parameter-oneof' ) )
693
-							->withEntityId( new PropertyId( $constraintScopeId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
692
+						(new ViolationMessage('wbqc-violation-message-parameter-oneof'))
693
+							->withEntityId(new PropertyId($constraintScopeId), Role::CONSTRAINT_PARAMETER_PROPERTY)
694 694
 							->withEntityIdList(
695 695
 								[
696
-									new ItemId( $mainSnakId ),
697
-									new ItemId( $qualifiersId ),
698
-									new ItemId( $referencesId ),
696
+									new ItemId($mainSnakId),
697
+									new ItemId($qualifiersId),
698
+									new ItemId($referencesId),
699 699
 								],
700 700
 								Role::CONSTRAINT_PARAMETER_VALUE
701 701
 							)
@@ -703,15 +703,15 @@  discard block
 block discarded – undo
703 703
 			}
704 704
 		}
705 705
 
706
-		if ( $validScopes !== null ) {
707
-			$invalidScopes = array_diff( $contextTypes, $validScopes );
708
-			if ( $invalidScopes !== [] ) {
709
-				$invalidScope = array_pop( $invalidScopes );
706
+		if ($validScopes !== null) {
707
+			$invalidScopes = array_diff($contextTypes, $validScopes);
708
+			if ($invalidScopes !== []) {
709
+				$invalidScope = array_pop($invalidScopes);
710 710
 				throw new ConstraintParameterException(
711
-					( new ViolationMessage( 'wbqc-violation-message-invalid-scope' ) )
712
-						->withConstraintScope( $invalidScope, Role::CONSTRAINT_PARAMETER_VALUE )
713
-						->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
714
-						->withConstraintScopeList( $validScopes, Role::CONSTRAINT_PARAMETER_VALUE )
711
+					(new ViolationMessage('wbqc-violation-message-invalid-scope'))
712
+						->withConstraintScope($invalidScope, Role::CONSTRAINT_PARAMETER_VALUE)
713
+						->withEntityId(new ItemId($constraintTypeItemId), Role::CONSTRAINT_TYPE_ITEM)
714
+						->withConstraintScopeList($validScopes, Role::CONSTRAINT_PARAMETER_VALUE)
715 715
 				);
716 716
 			}
717 717
 		}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/DiffWithinRangeChecker.php 1 patch
Spacing   +43 added lines, -44 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @throws ConstraintParameterException
85 85
 	 * @return array [ DataValue|null $min, DataValue|null $max, PropertyId $property, array $parameters ]
86 86
 	 */
87
-	private function parseConstraintParameters( Constraint $constraint ) {
88
-		list( $min, $max ) = $this->constraintParameterParser->parseQuantityRangeParameter(
87
+	private function parseConstraintParameters(Constraint $constraint) {
88
+		list($min, $max) = $this->constraintParameterParser->parseQuantityRangeParameter(
89 89
 			$constraint->getConstraintParameters(),
90 90
 			$constraint->getConstraintTypeItemId()
91 91
 		);
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 			$constraint->getConstraintTypeItemId()
95 95
 		);
96 96
 
97
-		if ( $min !== null ) {
98
-			$parameters['minimum_quantity'] = [ $min ];
97
+		if ($min !== null) {
98
+			$parameters['minimum_quantity'] = [$min];
99 99
 		}
100
-		if ( $max !== null ) {
101
-			$parameters['maximum_quantity'] = [ $max ];
100
+		if ($max !== null) {
101
+			$parameters['maximum_quantity'] = [$max];
102 102
 		}
103
-		$parameters['property'] = [ $property ];
103
+		$parameters['property'] = [$property];
104 104
 
105
-		return [ $min, $max, $property, $parameters ];
105
+		return [$min, $max, $property, $parameters];
106 106
 	}
107 107
 
108 108
 	/**
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return bool
114 114
 	 */
115
-	private function rangeInYears( $min, $max ) {
116
-		$yearUnit = $this->config->get( 'WBQualityConstraintsYearUnit' );
115
+	private function rangeInYears($min, $max) {
116
+		$yearUnit = $this->config->get('WBQualityConstraintsYearUnit');
117 117
 
118
-		if ( $min !== null && $min->getUnit() === $yearUnit ) {
118
+		if ($min !== null && $min->getUnit() === $yearUnit) {
119 119
 			return true;
120 120
 		}
121
-		if ( $max !== null && $max->getUnit() === $yearUnit ) {
121
+		if ($max !== null && $max->getUnit() === $yearUnit) {
122 122
 			return true;
123 123
 		}
124 124
 
@@ -134,59 +134,58 @@  discard block
 block discarded – undo
134 134
 	 * @throws ConstraintParameterException
135 135
 	 * @return CheckResult
136 136
 	 */
137
-	public function checkConstraint( Context $context, Constraint $constraint ) {
138
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
139
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
137
+	public function checkConstraint(Context $context, Constraint $constraint) {
138
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
139
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
140 140
 		}
141 141
 
142 142
 		$parameters = [];
143 143
 
144 144
 		$snak = $context->getSnak();
145 145
 
146
-		if ( !$snak instanceof PropertyValueSnak ) {
146
+		if (!$snak instanceof PropertyValueSnak) {
147 147
 			// nothing to check
148
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
148
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE);
149 149
 		}
150 150
 
151 151
 		$minuend = $snak->getDataValue();
152 152
 
153 153
 		/** @var PropertyId $property */
154
-		list( $min, $max, $property, $parameters ) = $this->parseConstraintParameters( $constraint );
154
+		list($min, $max, $property, $parameters) = $this->parseConstraintParameters($constraint);
155 155
 
156 156
 		// checks only the first occurrence of the referenced property (this constraint implies a single value constraint on that property)
157
-		foreach ( $context->getSnakGroup() as $otherSnak ) {
157
+		foreach ($context->getSnakGroup() as $otherSnak) {
158 158
 			if (
159
-				!$property->equals( $otherSnak->getPropertyId() ) ||
159
+				!$property->equals($otherSnak->getPropertyId()) ||
160 160
 				!$otherSnak instanceof PropertyValueSnak
161 161
 			) {
162 162
 				continue;
163 163
 			}
164 164
 
165 165
 			$subtrahend = $otherSnak->getDataValue();
166
-			if ( $subtrahend->getType() === $minuend->getType() ) {
167
-				$diff = $this->rangeInYears( $min, $max ) && $minuend->getType() === 'time' ?
168
-					$this->rangeCheckerHelper->getDifferenceInYears( $minuend, $subtrahend ) :
169
-					$this->rangeCheckerHelper->getDifference( $minuend, $subtrahend );
166
+			if ($subtrahend->getType() === $minuend->getType()) {
167
+				$diff = $this->rangeInYears($min, $max) && $minuend->getType() === 'time' ?
168
+					$this->rangeCheckerHelper->getDifferenceInYears($minuend, $subtrahend) : $this->rangeCheckerHelper->getDifference($minuend, $subtrahend);
170 169
 
171
-				if ( $this->rangeCheckerHelper->getComparison( $min, $diff ) > 0 ||
172
-					$this->rangeCheckerHelper->getComparison( $diff, $max ) > 0
170
+				if ($this->rangeCheckerHelper->getComparison($min, $diff) > 0 ||
171
+					$this->rangeCheckerHelper->getComparison($diff, $max) > 0
173 172
 				) {
174 173
 					// at least one of $min, $max is set at this point, otherwise there could be no violation
175
-					$openness = $min !== null ? ( $max !== null ? '' : '-rightopen' ) : '-leftopen';
174
+					$openness = $min !== null ? ($max !== null ? '' : '-rightopen') : '-leftopen';
176 175
 					// possible message keys:
177 176
 					// wbqc-violation-message-diff-within-range
178 177
 					// wbqc-violation-message-diff-within-range-leftopen
179 178
 					// wbqc-violation-message-diff-within-range-rightopen
180
-					$message = ( new ViolationMessage( "wbqc-violation-message-diff-within-range$openness" ) )
181
-						->withEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE )
182
-						->withDataValue( $minuend, Role::OBJECT )
183
-						->withEntityId( $otherSnak->getPropertyId(), Role::PREDICATE )
184
-						->withDataValue( $subtrahend, Role::OBJECT );
185
-					if ( $min !== null ) {
186
-						$message = $message->withDataValue( $min, Role::OBJECT );
179
+					$message = (new ViolationMessage("wbqc-violation-message-diff-within-range$openness"))
180
+						->withEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE)
181
+						->withDataValue($minuend, Role::OBJECT)
182
+						->withEntityId($otherSnak->getPropertyId(), Role::PREDICATE)
183
+						->withDataValue($subtrahend, Role::OBJECT);
184
+					if ($min !== null) {
185
+						$message = $message->withDataValue($min, Role::OBJECT);
187 186
 					}
188
-					if ( $max !== null ) {
189
-						$message = $message->withDataValue( $max, Role::OBJECT );
187
+					if ($max !== null) {
188
+						$message = $message->withDataValue($max, Role::OBJECT);
190 189
 					}
191 190
 					$status = CheckResult::STATUS_VIOLATION;
192 191
 				} else {
@@ -194,19 +193,19 @@  discard block
 block discarded – undo
194 193
 					$status = CheckResult::STATUS_COMPLIANCE;
195 194
 				}
196 195
 			} else {
197
-				$message = new ViolationMessage( 'wbqc-violation-message-diff-within-range-must-have-equal-types' );
196
+				$message = new ViolationMessage('wbqc-violation-message-diff-within-range-must-have-equal-types');
198 197
 				$status = CheckResult::STATUS_VIOLATION;
199 198
 			}
200 199
 
201
-			return new CheckResult( $context, $constraint, $parameters, $status, $message );
200
+			return new CheckResult($context, $constraint, $parameters, $status, $message);
202 201
 		}
203 202
 
204
-		$message = new ViolationMessage( 'wbqc-violation-message-diff-within-range-property-must-exist' );
203
+		$message = new ViolationMessage('wbqc-violation-message-diff-within-range-property-must-exist');
205 204
 		$status = CheckResult::STATUS_VIOLATION;
206
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
205
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
207 206
 	}
208 207
 
209
-	public function checkConstraintParameters( Constraint $constraint ) {
208
+	public function checkConstraintParameters(Constraint $constraint) {
210 209
 		$constraintParameters = $constraint->getConstraintParameters();
211 210
 		$exceptions = [];
212 211
 		try {
@@ -214,12 +213,12 @@  discard block
 block discarded – undo
214 213
 				$constraintParameters,
215 214
 				$constraint->getConstraintTypeItemId()
216 215
 			);
217
-		} catch ( ConstraintParameterException $e ) {
216
+		} catch (ConstraintParameterException $e) {
218 217
 			$exceptions[] = $e;
219 218
 		}
220 219
 		try {
221
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
222
-		} catch ( ConstraintParameterException $e ) {
220
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
221
+		} catch (ConstraintParameterException $e) {
223 222
 			$exceptions[] = $e;
224 223
 		}
225 224
 		return $exceptions;
Please login to merge, or discard this patch.