Completed
Push — master ( 32936a...86defd )
by
unknown
02:03
created
includes/ConstraintCheck/ConstraintChecker.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * @throws ConstraintParameterException if the constraint parameters are invalid
23 23
 	 * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs
24 24
 	 */
25
-	public function checkConstraint( Context $context, Constraint $constraint );
25
+	public function checkConstraint(Context $context, Constraint $constraint);
26 26
 
27 27
 	/**
28 28
 	 * Check if the constraint parameters of $constraint are valid.
@@ -33,6 +33,6 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @return ConstraintParameterException[]
35 35
 	 */
36
-	public function checkConstraintParameters( Constraint $constraint );
36
+	public function checkConstraintParameters(Constraint $constraint);
37 37
 
38 38
 }
Please login to merge, or discard this patch.
includes/ConstraintCheck/Context/QualifierContext.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		Statement $statement,
22 22
 		Snak $snak
23 23
 	) {
24
-		parent::__construct( $entity, $snak );
24
+		parent::__construct($entity, $snak);
25 25
 		$this->statement = $statement;
26 26
 	}
27 27
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		return self::TYPE_QUALIFIER;
30 30
 	}
31 31
 
32
-	protected function &getMainArray( array &$container ) {
32
+	protected function &getMainArray(array &$container) {
33 33
 		$statementArray = &$this->getStatementArray(
34 34
 			$container,
35 35
 			$this->entity->getId()->getSerialization(),
@@ -37,25 +37,25 @@  discard block
 block discarded – undo
37 37
 			$this->statement->getGuid()
38 38
 		);
39 39
 
40
-		if ( !array_key_exists( 'qualifiers', $statementArray ) ) {
40
+		if (!array_key_exists('qualifiers', $statementArray)) {
41 41
 			$statementArray['qualifiers'] = [];
42 42
 		}
43 43
 		$qualifiersArray = &$statementArray['qualifiers'];
44 44
 
45 45
 		$propertyId = $this->getSnak()->getPropertyId()->getSerialization();
46
-		if ( !array_key_exists( $propertyId, $qualifiersArray ) ) {
46
+		if (!array_key_exists($propertyId, $qualifiersArray)) {
47 47
 			$qualifiersArray[$propertyId] = [];
48 48
 		}
49 49
 		$propertyArray = &$qualifiersArray[$propertyId];
50 50
 
51
-		foreach ( $propertyArray as &$potentialQualifierArray ) {
52
-			if ( $potentialQualifierArray['hash'] === $this->getSnak()->getHash() ) {
51
+		foreach ($propertyArray as &$potentialQualifierArray) {
52
+			if ($potentialQualifierArray['hash'] === $this->getSnak()->getHash()) {
53 53
 				$qualifierArray = &$potentialQualifierArray;
54 54
 				break;
55 55
 			}
56 56
 		}
57
-		if ( !isset( $qualifierArray ) ) {
58
-			$qualifierArray = [ 'hash' => $this->getSnak()->getHash() ];
57
+		if (!isset($qualifierArray)) {
58
+			$qualifierArray = ['hash' => $this->getSnak()->getHash()];
59 59
 			$propertyArray[] = &$qualifierArray;
60 60
 		}
61 61
 
Please login to merge, or discard this patch.
includes/ConstraintCheck/Context/ReferenceContext.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		Reference $reference,
29 29
 		Snak $snak
30 30
 	) {
31
-		parent::__construct( $entity, $snak );
31
+		parent::__construct($entity, $snak);
32 32
 		$this->statement = $statement;
33 33
 		$this->reference = $reference;
34 34
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		return self::TYPE_REFERENCE;
38 38
 	}
39 39
 
40
-	protected function &getMainArray( array &$container ) {
40
+	protected function &getMainArray(array &$container) {
41 41
 		$statementArray = &$this->getStatementArray(
42 42
 			$container,
43 43
 			$this->entity->getId()->getSerialization(),
@@ -45,38 +45,38 @@  discard block
 block discarded – undo
45 45
 			$this->statement->getGuid()
46 46
 		);
47 47
 
48
-		if ( !array_key_exists( 'references', $statementArray ) ) {
48
+		if (!array_key_exists('references', $statementArray)) {
49 49
 			$statementArray['references'] = [];
50 50
 		}
51 51
 		$referencesArray = &$statementArray['references'];
52 52
 
53
-		foreach ( $referencesArray as &$potentialReferenceArray ) {
54
-			if ( $potentialReferenceArray['hash'] === $this->reference->getHash() ) {
53
+		foreach ($referencesArray as &$potentialReferenceArray) {
54
+			if ($potentialReferenceArray['hash'] === $this->reference->getHash()) {
55 55
 				$referenceArray = &$potentialReferenceArray;
56 56
 				break;
57 57
 			}
58 58
 		}
59
-		if ( !isset( $referenceArray ) ) {
60
-			$referenceArray = [ 'hash' => $this->reference->getHash(), 'snaks' => [] ];
59
+		if (!isset($referenceArray)) {
60
+			$referenceArray = ['hash' => $this->reference->getHash(), 'snaks' => []];
61 61
 			$referencesArray[] = &$referenceArray;
62 62
 		}
63 63
 
64 64
 		$snaksArray = &$referenceArray['snaks'];
65 65
 
66 66
 		$propertyId = $this->getSnak()->getPropertyId()->getSerialization();
67
-		if ( !array_key_exists( $propertyId, $snaksArray ) ) {
67
+		if (!array_key_exists($propertyId, $snaksArray)) {
68 68
 			$snaksArray[$propertyId] = [];
69 69
 		}
70 70
 		$propertyArray = &$snaksArray[$propertyId];
71 71
 
72
-		foreach ( $propertyArray as &$potentialSnakArray ) {
73
-			if ( $potentialSnakArray['hash'] === $this->getSnak()->getHash() ) {
72
+		foreach ($propertyArray as &$potentialSnakArray) {
73
+			if ($potentialSnakArray['hash'] === $this->getSnak()->getHash()) {
74 74
 				$snakArray = &$potentialSnakArray;
75 75
 				break;
76 76
 			}
77 77
 		}
78
-		if ( !isset( $snakArray ) ) {
79
-			$snakArray = [ 'hash' => $this->getSnak()->getHash() ];
78
+		if (!isset($snakArray)) {
79
+			$snakArray = ['hash' => $this->getSnak()->getHash()];
80 80
 			$propertyArray[] = &$snakArray;
81 81
 		}
82 82
 
Please login to merge, or discard this patch.
includes/ConstraintCheck/Context/MainSnakContext.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 		EntityDocument $entity,
24 24
 		Statement $statement
25 25
 	) {
26
-		parent::__construct( $entity, $statement->getMainSnak() );
26
+		parent::__construct($entity, $statement->getMainSnak());
27 27
 		$this->statement = $statement;
28 28
 	}
29 29
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		return $this->statement;
40 40
 	}
41 41
 
42
-	protected function &getMainArray( array &$container ) {
42
+	protected function &getMainArray(array &$container) {
43 43
 		$statementArray = &$this->getStatementArray(
44 44
 			$container,
45 45
 			$this->entity->getId()->getSerialization(),
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 			$this->statement->getGuid()
48 48
 		);
49 49
 
50
-		if ( !array_key_exists( 'mainsnak', $statementArray ) ) {
51
-			$statementArray['mainsnak'] = [ 'hash' => $this->statement->getMainSnak()->getHash() ];
50
+		if (!array_key_exists('mainsnak', $statementArray)) {
51
+			$statementArray['mainsnak'] = ['hash' => $this->statement->getMainSnak()->getHash()];
52 52
 		}
53 53
 		$mainsnakArray = &$statementArray['mainsnak'];
54 54
 
Please login to merge, or discard this patch.
includes/ConstraintCheck/Checker/FormatChecker.php 1 patch
Spacing   +30 added lines, -31 removed lines patch added patch discarded remove patch
@@ -73,26 +73,26 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return CheckResult
75 75
 	 */
76
-	public function checkConstraint( Context $context, Constraint $constraint ) {
76
+	public function checkConstraint(Context $context, Constraint $constraint) {
77 77
 		$parameters = [];
78 78
 		$constraintParameters = $constraint->getConstraintParameters();
79 79
 
80
-		$format = $this->constraintParameterParser->parseFormatParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
81
-		$parameters['pattern'] = [ $format ];
80
+		$format = $this->constraintParameterParser->parseFormatParameter($constraintParameters, $constraint->getConstraintTypeItemId());
81
+		$parameters['pattern'] = [$format];
82 82
 
83 83
 		$syntaxClarification = $this->constraintParameterParser->parseSyntaxClarificationParameter(
84 84
 			$constraintParameters,
85 85
 			WikibaseRepo::getDefaultInstance()->getUserLanguage() // TODO make this part of the Context?
86 86
 		);
87
-		if ( $syntaxClarification !== null ) {
88
-			$parameters['clarification'] = [ $syntaxClarification ];
87
+		if ($syntaxClarification !== null) {
88
+			$parameters['clarification'] = [$syntaxClarification];
89 89
 		}
90 90
 
91 91
 		$snak = $context->getSnak();
92 92
 
93
-		if ( !$snak instanceof PropertyValueSnak ) {
93
+		if (!$snak instanceof PropertyValueSnak) {
94 94
 			// nothing to check
95
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE, '' );
95
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE, '');
96 96
 		}
97 97
 
98 98
 		$dataValue = $snak->getDataValue();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		 * error handling:
102 102
 		 *   type of $dataValue for properties with 'Format' constraint has to be 'string' or 'monolingualtext'
103 103
 		 */
104
-		switch ( $dataValue->getType() ) {
104
+		switch ($dataValue->getType()) {
105 105
 			case 'string':
106 106
 				$text = $dataValue->getValue();
107 107
 				break;
@@ -109,60 +109,59 @@  discard block
 block discarded – undo
109 109
 				$text = $dataValue->getText();
110 110
 				break;
111 111
 			default:
112
-				$message = wfMessage( "wbqc-violation-message-value-needed-of-type" )
112
+				$message = wfMessage("wbqc-violation-message-value-needed-of-type")
113 113
 						 ->rawParams(
114
-							 $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ),
115
-							 wfMessage( 'datatypes-type-string' )->escaped(),
116
-							 wfMessage( 'datatypes-type-monolingualtext' )->escaped()
114
+							 $this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM),
115
+							 wfMessage('datatypes-type-string')->escaped(),
116
+							 wfMessage('datatypes-type-monolingualtext')->escaped()
117 117
 						 )
118 118
 						 ->escaped();
119
-				return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
119
+				return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
120 120
 		}
121 121
 
122
-		if ( $this->sparqlHelper !== null && $this->config->get( 'WBQualityConstraintsCheckFormatConstraint' ) ) {
123
-			if ( $this->sparqlHelper->matchesRegularExpression( $text, $format ) ) {
122
+		if ($this->sparqlHelper !== null && $this->config->get('WBQualityConstraintsCheckFormatConstraint')) {
123
+			if ($this->sparqlHelper->matchesRegularExpression($text, $format)) {
124 124
 				$message = '';
125 125
 				$status = CheckResult::STATUS_COMPLIANCE;
126 126
 			} else {
127 127
 				$message = wfMessage(
128 128
 					$syntaxClarification !== null ?
129
-						'wbqc-violation-message-format-clarification' :
130
-						'wbqc-violation-message-format'
129
+						'wbqc-violation-message-format-clarification' : 'wbqc-violation-message-format'
131 130
 				)->rawParams(
132
-					$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
133
-					$this->constraintParameterRenderer->formatDataValue( new StringValue( $text ), Role::OBJECT ),
134
-					$this->constraintParameterRenderer->formatByRole( Role::CONSTRAINT_PARAMETER_VALUE,
135
-						'<code><nowiki>' . htmlspecialchars( $format ) . '</nowiki></code>' )
131
+					$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
132
+					$this->constraintParameterRenderer->formatDataValue(new StringValue($text), Role::OBJECT),
133
+					$this->constraintParameterRenderer->formatByRole(Role::CONSTRAINT_PARAMETER_VALUE,
134
+						'<code><nowiki>'.htmlspecialchars($format).'</nowiki></code>')
136 135
 				);
137
-				if ( $syntaxClarification !== null ) {
138
-					$message->params( $syntaxClarification );
136
+				if ($syntaxClarification !== null) {
137
+					$message->params($syntaxClarification);
139 138
 				}
140 139
 				$message = $message->escaped();
141 140
 				$status = CheckResult::STATUS_VIOLATION;
142 141
 			}
143 142
 		} else {
144
-			$message = wfMessage( "wbqc-violation-message-security-reason" )
145
-					 ->rawParams( $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ) )
143
+			$message = wfMessage("wbqc-violation-message-security-reason")
144
+					 ->rawParams($this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM))
146 145
 					 ->escaped();
147 146
 			$status = CheckResult::STATUS_TODO;
148 147
 		}
149
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
148
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
150 149
 	}
151 150
 
152
-	public function checkConstraintParameters( Constraint $constraint ) {
151
+	public function checkConstraintParameters(Constraint $constraint) {
153 152
 		$constraintParameters = $constraint->getConstraintParameters();
154 153
 		$exceptions = [];
155 154
 		try {
156
-			$this->constraintParameterParser->parseFormatParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
157
-		} catch ( ConstraintParameterException $e ) {
155
+			$this->constraintParameterParser->parseFormatParameter($constraintParameters, $constraint->getConstraintTypeItemId());
156
+		} catch (ConstraintParameterException $e) {
158 157
 			$exceptions[] = $e;
159 158
 		}
160 159
 		try {
161 160
 			$this->constraintParameterParser->parseSyntaxClarificationParameter(
162 161
 				$constraintParameters,
163
-				Language::factory( 'en' ) // errors are reported independent of language requested
162
+				Language::factory('en') // errors are reported independent of language requested
164 163
 			);
165
-		} catch ( ConstraintParameterException $e ) {
164
+		} catch (ConstraintParameterException $e) {
166 165
 			$exceptions[] = $e;
167 166
 		}
168 167
 		return $exceptions;
Please login to merge, or discard this patch.
includes/ConstraintCheck/Checker/OneOfChecker.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -51,43 +51,43 @@
 block discarded – undo
51 51
 	 *
52 52
 	 * @return CheckResult
53 53
 	 */
54
-	public function checkConstraint( Context $context, Constraint $constraint ) {
55
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
56
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
54
+	public function checkConstraint(Context $context, Constraint $constraint) {
55
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
56
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
57 57
 		}
58 58
 
59 59
 		$parameters = [];
60 60
 		$constraintParameters = $constraint->getConstraintParameters();
61 61
 
62
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), true );
62
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), true);
63 63
 		$parameters['item'] = $items;
64 64
 
65 65
 		$snak = $context->getSnak();
66 66
 
67
-		$message = wfMessage( 'wbqc-violation-message-one-of' );
68
-		$message->rawParams( $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE ) );
69
-		$message->numParams( count( $items ) );
70
-		$message->rawParams( $this->constraintParameterRenderer->formatItemIdSnakValueList( $items, Role::OBJECT ) );
67
+		$message = wfMessage('wbqc-violation-message-one-of');
68
+		$message->rawParams($this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE));
69
+		$message->numParams(count($items));
70
+		$message->rawParams($this->constraintParameterRenderer->formatItemIdSnakValueList($items, Role::OBJECT));
71 71
 		$message = $message->escaped();
72 72
 		$status = CheckResult::STATUS_VIOLATION;
73 73
 
74
-		foreach ( $items as $item ) {
75
-			if ( $item->matchesSnak( $snak ) ) {
74
+		foreach ($items as $item) {
75
+			if ($item->matchesSnak($snak)) {
76 76
 				$message = '';
77 77
 				$status = CheckResult::STATUS_COMPLIANCE;
78 78
 				break;
79 79
 			}
80 80
 		}
81 81
 
82
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
82
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
83 83
 	}
84 84
 
85
-	public function checkConstraintParameters( Constraint $constraint ) {
85
+	public function checkConstraintParameters(Constraint $constraint) {
86 86
 		$constraintParameters = $constraint->getConstraintParameters();
87 87
 		$exceptions = [];
88 88
 		try {
89
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), true );
90
-		} catch ( ConstraintParameterException $e ) {
89
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), true);
90
+		} catch (ConstraintParameterException $e) {
91 91
 			$exceptions[] = $e;
92 92
 		}
93 93
 		return $exceptions;
Please login to merge, or discard this patch.
includes/ConstraintCheck/Checker/RangeChecker.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return CheckResult
72 72
 	 */
73
-	public function checkConstraint( Context $context, Constraint $constraint ) {
74
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
75
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
73
+	public function checkConstraint(Context $context, Constraint $constraint) {
74
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
75
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
76 76
 		}
77 77
 
78 78
 		$parameters = [];
@@ -80,42 +80,42 @@  discard block
 block discarded – undo
80 80
 
81 81
 		$snak = $context->getSnak();
82 82
 
83
-		if ( !$snak instanceof PropertyValueSnak ) {
83
+		if (!$snak instanceof PropertyValueSnak) {
84 84
 			// nothing to check
85
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE, '' );
85
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE, '');
86 86
 		}
87 87
 
88 88
 		$dataValue = $snak->getDataValue();
89 89
 
90
-		list( $min, $max ) = $this->constraintParameterParser->parseRangeParameter(
90
+		list($min, $max) = $this->constraintParameterParser->parseRangeParameter(
91 91
 			$constraintParameters,
92 92
 			$constraint->getConstraintTypeItemId(),
93 93
 			$dataValue->getType()
94 94
 		);
95 95
 		$parameterKey = $dataValue->getType() === 'quantity' ? 'quantity' : 'date';
96
-		if ( $min !== null ) {
97
-			$parameters['minimum_' . $parameterKey] = [ $min ];
96
+		if ($min !== null) {
97
+			$parameters['minimum_'.$parameterKey] = [$min];
98 98
 		}
99
-		if ( $max !== null ) {
100
-			$parameters['maximum_' . $parameterKey] = [ $max ];
99
+		if ($max !== null) {
100
+			$parameters['maximum_'.$parameterKey] = [$max];
101 101
 		}
102 102
 
103
-		if ( $this->rangeCheckerHelper->getComparison( $min, $dataValue ) > 0 ||
104
-			 $this->rangeCheckerHelper->getComparison( $dataValue, $max ) > 0
103
+		if ($this->rangeCheckerHelper->getComparison($min, $dataValue) > 0 ||
104
+			 $this->rangeCheckerHelper->getComparison($dataValue, $max) > 0
105 105
 		) {
106 106
 			// at least one of $min, $max is set at this point, otherwise there could be no violation
107 107
 			$type = $dataValue->getType();
108
-			$openness = $min !== null ? ( $max !== null ? 'closed' : 'rightopen' ) : 'leftopen';
109
-			$message = wfMessage( "wbqc-violation-message-range-$type-$openness" );
108
+			$openness = $min !== null ? ($max !== null ? 'closed' : 'rightopen') : 'leftopen';
109
+			$message = wfMessage("wbqc-violation-message-range-$type-$openness");
110 110
 			$message->rawParams(
111
-				$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE ),
112
-				$this->constraintParameterRenderer->formatDataValue( $dataValue, Role::OBJECT )
111
+				$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE),
112
+				$this->constraintParameterRenderer->formatDataValue($dataValue, Role::OBJECT)
113 113
 			);
114
-			if ( $min !== null ) {
115
-				$message->rawParams( $this->constraintParameterRenderer->formatDataValue( $min, Role::OBJECT ) );
114
+			if ($min !== null) {
115
+				$message->rawParams($this->constraintParameterRenderer->formatDataValue($min, Role::OBJECT));
116 116
 			}
117
-			if ( $max !== null ) {
118
-				$message->rawParams( $this->constraintParameterRenderer->formatDataValue( $max, Role::OBJECT ) );
117
+			if ($max !== null) {
118
+				$message->rawParams($this->constraintParameterRenderer->formatDataValue($max, Role::OBJECT));
119 119
 			}
120 120
 			$message = $message->escaped();
121 121
 			$status = CheckResult::STATUS_VIOLATION;
@@ -124,22 +124,22 @@  discard block
 block discarded – undo
124 124
 			$status = CheckResult::STATUS_COMPLIANCE;
125 125
 		}
126 126
 
127
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
127
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
128 128
 	}
129 129
 
130
-	public function checkConstraintParameters( Constraint $constraint ) {
130
+	public function checkConstraintParameters(Constraint $constraint) {
131 131
 		$constraintParameters = $constraint->getConstraintParameters();
132 132
 		$exceptions = [];
133 133
 		try {
134 134
 			// we don’t have a data value here, so get the type from the property instead
135 135
 			// (the distinction between data type and data value type is irrelevant for 'quantity' and 'time')
136
-			$type = $this->propertyDataTypeLookup->getDataTypeIdForProperty( $constraint->getPropertyId() );
136
+			$type = $this->propertyDataTypeLookup->getDataTypeIdForProperty($constraint->getPropertyId());
137 137
 			$this->constraintParameterParser->parseRangeParameter(
138 138
 				$constraintParameters,
139 139
 				$constraint->getConstraintTypeItemId(),
140 140
 				$type
141 141
 			);
142
-		} catch ( ConstraintParameterException $e ) {
142
+		} catch (ConstraintParameterException $e) {
143 143
 			$exceptions[] = $e;
144 144
 		}
145 145
 		return $exceptions;
Please login to merge, or discard this patch.
includes/ConstraintCheck/Helper/LoggingHelper.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		$this->dataFactory = $dataFactory;
49 49
 		$this->logger = $logger;
50 50
 		$this->constraintCheckDurationLimits = [
51
-			'info' => $config->get( 'WBQualityConstraintsCheckDurationInfoSeconds' ),
52
-			'warning' => $config->get( 'WBQualityConstraintsCheckDurationWarningSeconds' ),
51
+			'info' => $config->get('WBQualityConstraintsCheckDurationInfoSeconds'),
52
+			'warning' => $config->get('WBQualityConstraintsCheckDurationWarningSeconds'),
53 53
 		];
54 54
 	}
55 55
 
@@ -75,41 +75,41 @@  discard block
 block discarded – undo
75 75
 		$durationSeconds,
76 76
 		$method
77 77
 	) {
78
-		$constraintCheckerClassShortName = substr( strrchr( $constraintCheckerClass, '\\' ), 1 );
78
+		$constraintCheckerClassShortName = substr(strrchr($constraintCheckerClass, '\\'), 1);
79 79
 		$constraintTypeItemId = $constraint->getConstraintTypeItemId();
80 80
 
81 81
 		$this->dataFactory->timing(
82
-			'wikibase.quality.constraints.check.timing.' .
83
-				$constraintTypeItemId . '-' .
82
+			'wikibase.quality.constraints.check.timing.'.
83
+				$constraintTypeItemId.'-'.
84 84
 				$constraintCheckerClassShortName,
85 85
 			$durationSeconds * 1000
86 86
 		);
87 87
 
88 88
 		// find the longest limit (and associated log level) that the duration exceeds
89
-		foreach ( $this->constraintCheckDurationLimits as $level => $limit ) {
89
+		foreach ($this->constraintCheckDurationLimits as $level => $limit) {
90 90
 			if (
91 91
 				// duration exceeds this limit
92
-				isset( $limit ) && $durationSeconds > $limit &&
92
+				isset($limit) && $durationSeconds > $limit &&
93 93
 				// this limit is longer than previous longest limit
94
-				( !isset( $limitSeconds ) || $limit > $limitSeconds )
94
+				(!isset($limitSeconds) || $limit > $limitSeconds)
95 95
 			) {
96 96
 				$limitSeconds = $limit;
97 97
 				$logLevel = $level;
98 98
 			}
99 99
 		}
100 100
 
101
-		if ( !isset( $limitSeconds ) ) {
101
+		if (!isset($limitSeconds)) {
102 102
 			return;
103 103
 		}
104
-		if ( $context->getType() !== Context::TYPE_STATEMENT ) {
104
+		if ($context->getType() !== Context::TYPE_STATEMENT) {
105 105
 			// TODO log less details but still log something
106 106
 			return;
107 107
 		}
108 108
 
109 109
 		$this->logger->log(
110 110
 			$logLevel,
111
-			'Constraint check with {constraintCheckerClassShortName} ' .
112
-			'took longer than {limitSeconds} second(s) ' .
111
+			'Constraint check with {constraintCheckerClassShortName} '.
112
+			'took longer than {limitSeconds} second(s) '.
113 113
 			'(duration: {durationSeconds} seconds).',
114 114
 			[
115 115
 				'method' => $method,
Please login to merge, or discard this patch.
includes/Role.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 	 * @codeCoverageIgnore
73 73
 	 */
74 74
 	private function __construct() {
75
-		throw new LogicException( 'This class should never be instantiated.' );
75
+		throw new LogicException('This class should never be instantiated.');
76 76
 	}
77 77
 
78 78
 }
Please login to merge, or discard this patch.