Completed
Push — master ( 1d7888...0497b4 )
by
unknown
03:57 queued 01:15
created
src/ConstraintCheck/Checker/TypeChecker.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -89,32 +89,32 @@  discard block
 block discarded – undo
89 89
 	 * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs
90 90
 	 * @return CheckResult
91 91
 	 */
92
-	public function checkConstraint( Context $context, Constraint $constraint ) {
93
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
94
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
92
+	public function checkConstraint(Context $context, Constraint $constraint) {
93
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
94
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
95 95
 		}
96
-		if ( $context->getType() === Context::TYPE_REFERENCE ) {
97
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE );
96
+		if ($context->getType() === Context::TYPE_REFERENCE) {
97
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE);
98 98
 		}
99 99
 
100 100
 		$parameters = [];
101 101
 		$constraintParameters = $constraint->getConstraintParameters();
102 102
 
103
-		$classes = $this->constraintParameterParser->parseClassParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
103
+		$classes = $this->constraintParameterParser->parseClassParameter($constraintParameters, $constraint->getConstraintTypeItemId());
104 104
 		$parameters['class'] = array_map(
105
-			function( $id ) {
106
-				return new ItemId( $id );
105
+			function($id) {
106
+				return new ItemId($id);
107 107
 			},
108 108
 			$classes
109 109
 		);
110 110
 
111
-		$relation = $this->constraintParameterParser->parseRelationParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
112
-		if ( $relation === 'instance' ) {
113
-			$relationId = $this->config->get( 'WBQualityConstraintsInstanceOfId' );
114
-		} elseif ( $relation === 'subclass' ) {
115
-			$relationId = $this->config->get( 'WBQualityConstraintsSubclassOfId' );
111
+		$relation = $this->constraintParameterParser->parseRelationParameter($constraintParameters, $constraint->getConstraintTypeItemId());
112
+		if ($relation === 'instance') {
113
+			$relationId = $this->config->get('WBQualityConstraintsInstanceOfId');
114
+		} elseif ($relation === 'subclass') {
115
+			$relationId = $this->config->get('WBQualityConstraintsSubclassOfId');
116 116
 		}
117
-		$parameters['relation'] = [ $relation ];
117
+		$parameters['relation'] = [$relation];
118 118
 
119 119
 		$result = $this->typeCheckerHelper->hasClassInRelation(
120 120
 			$context->getEntity()->getStatements(),
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			$classes
123 123
 		);
124 124
 
125
-		if ( $result->getBool() ) {
125
+		if ($result->getBool()) {
126 126
 			$message = '';
127 127
 			$status = CheckResult::STATUS_COMPLIANCE;
128 128
 		} else {
@@ -136,21 +136,21 @@  discard block
 block discarded – undo
136 136
 			$status = CheckResult::STATUS_VIOLATION;
137 137
 		}
138 138
 
139
-		return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) )
140
-			->withMetadata( $result->getMetadata() );
139
+		return (new CheckResult($context, $constraint, $parameters, $status, $message))
140
+			->withMetadata($result->getMetadata());
141 141
 	}
142 142
 
143
-	public function checkConstraintParameters( Constraint $constraint ) {
143
+	public function checkConstraintParameters(Constraint $constraint) {
144 144
 		$constraintParameters = $constraint->getConstraintParameters();
145 145
 		$exceptions = [];
146 146
 		try {
147
-			$this->constraintParameterParser->parseClassParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
148
-		} catch ( ConstraintParameterException $e ) {
147
+			$this->constraintParameterParser->parseClassParameter($constraintParameters, $constraint->getConstraintTypeItemId());
148
+		} catch (ConstraintParameterException $e) {
149 149
 			$exceptions[] = $e;
150 150
 		}
151 151
 		try {
152
-			$this->constraintParameterParser->parseRelationParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
153
-		} catch ( ConstraintParameterException $e ) {
152
+			$this->constraintParameterParser->parseRelationParameter($constraintParameters, $constraint->getConstraintTypeItemId());
153
+		} catch (ConstraintParameterException $e) {
154 154
 			$exceptions[] = $e;
155 155
 		}
156 156
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ValueOnlyChecker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 		];
36 36
 	}
37 37
 
38
-	public function checkConstraint( Context $context, Constraint $constraint ) {
39
-		if ( $context->getType() === Context::TYPE_STATEMENT ) {
40
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '' );
38
+	public function checkConstraint(Context $context, Constraint $constraint) {
39
+		if ($context->getType() === Context::TYPE_STATEMENT) {
40
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '');
41 41
 		} else {
42
-			$message = wfMessage( 'wbqc-violation-message-valueOnly' )->escaped();
43
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
42
+			$message = wfMessage('wbqc-violation-message-valueOnly')->escaped();
43
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
44 44
 		}
45 45
 	}
46 46
 
47
-	public function checkConstraintParameters( Constraint $constraint ) {
47
+	public function checkConstraintParameters(Constraint $constraint) {
48 48
 		// no parameters
49 49
 		return [];
50 50
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ReferenceChecker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 		];
36 36
 	}
37 37
 
38
-	public function checkConstraint( Context $context, Constraint $constraint ) {
39
-		if ( $context->getType() === Context::TYPE_REFERENCE ) {
40
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '' );
38
+	public function checkConstraint(Context $context, Constraint $constraint) {
39
+		if ($context->getType() === Context::TYPE_REFERENCE) {
40
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '');
41 41
 		} else {
42
-			$message = wfMessage( 'wbqc-violation-message-reference' )->escaped();
43
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
42
+			$message = wfMessage('wbqc-violation-message-reference')->escaped();
43
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
44 44
 		}
45 45
 	}
46 46
 
47
-	public function checkConstraintParameters( Constraint $constraint ) {
47
+	public function checkConstraintParameters(Constraint $constraint) {
48 48
 		// no parameters
49 49
 		return [];
50 50
 	}
Please login to merge, or discard this patch.