Completed
Push — master ( b128fc...8dbc5b )
by
unknown
21s
created
src/ConstraintCheck/Helper/TimeValueComparer.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,27 +16,27 @@
 block discarded – undo
16 16
 	 */
17 17
 	private $timeValueCalculator;
18 18
 
19
-	public function __construct( ?TimeValueCalculator $timeValueCalculator = null ) {
19
+	public function __construct(?TimeValueCalculator $timeValueCalculator = null) {
20 20
 		$this->timeValueCalculator = $timeValueCalculator ?: new TimeValueCalculator();
21 21
 	}
22 22
 
23
-	public function getComparison( TimeValue $lhs, TimeValue $rhs ): int {
24
-		$lhsTimestamp = $this->timeValueCalculator->getTimestamp( $lhs );
25
-		$rhsTimestamp = $this->timeValueCalculator->getTimestamp( $rhs );
23
+	public function getComparison(TimeValue $lhs, TimeValue $rhs): int {
24
+		$lhsTimestamp = $this->timeValueCalculator->getTimestamp($lhs);
25
+		$rhsTimestamp = $this->timeValueCalculator->getTimestamp($rhs);
26 26
 
27
-		if ( $lhsTimestamp === $rhsTimestamp ) {
27
+		if ($lhsTimestamp === $rhsTimestamp) {
28 28
 			return 0;
29 29
 		}
30 30
 
31 31
 		return $lhsTimestamp < $rhsTimestamp ? -1 : 1;
32 32
 	}
33 33
 
34
-	public function getMinimum( TimeValue $timeValue1, TimeValue $timeValue2 ): TimeValue {
35
-		return $this->getComparison( $timeValue1, $timeValue2 ) <= 0 ? $timeValue1 : $timeValue2;
34
+	public function getMinimum(TimeValue $timeValue1, TimeValue $timeValue2): TimeValue {
35
+		return $this->getComparison($timeValue1, $timeValue2) <= 0 ? $timeValue1 : $timeValue2;
36 36
 	}
37 37
 
38
-	public function isFutureTime( TimeValue $timeValue ): bool {
39
-		return $this->getComparison( $timeValue, new NowValue() ) >= 0;
38
+	public function isFutureTime(TimeValue $timeValue): bool {
39
+		return $this->getComparison($timeValue, new NowValue()) >= 0;
40 40
 	}
41 41
 
42 42
 }
Please login to merge, or discard this patch.
src/ConstraintDeserializer.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,14 +10,13 @@
 block discarded – undo
10 10
  */
11 11
 class ConstraintDeserializer {
12 12
 
13
-	public function deserialize( array $serialization ): Constraint {
13
+	public function deserialize(array $serialization): Constraint {
14 14
 		return new Constraint(
15 15
 			$serialization['id'],
16
-			new NumericPropertyId( $serialization['pid'] ),
16
+			new NumericPropertyId($serialization['pid']),
17 17
 			$serialization['qid'],
18
-			array_key_exists( 'params', $serialization ) ?
19
-			$serialization['params'] :
20
-		[]
18
+			array_key_exists('params', $serialization) ?
19
+			$serialization['params'] : []
21 20
 			);
22 21
 	}
23 22
 
Please login to merge, or discard this patch.
src/ConstraintsServices.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -40,91 +40,91 @@
 block discarded – undo
40 40
 	public const EXPIRY_LOCK = 'WBQC_ExpiryLock';
41 41
 	public const VIOLATION_MESSAGE_RENDERER_FACTORY = 'WBQC_ViolationMessageRendererFactory';
42 42
 
43
-	private static function getService( ?MediaWikiServices $services, string $name ) {
43
+	private static function getService(?MediaWikiServices $services, string $name) {
44 44
 		$services ??= MediaWikiServices::getInstance();
45
-		return $services->getService( $name );
45
+		return $services->getService($name);
46 46
 	}
47 47
 
48
-	public static function getLoggingHelper( ?MediaWikiServices $services = null ): LoggingHelper {
49
-		return self::getService( $services, self::LOGGING_HELPER );
48
+	public static function getLoggingHelper(?MediaWikiServices $services = null): LoggingHelper {
49
+		return self::getService($services, self::LOGGING_HELPER);
50 50
 	}
51 51
 
52 52
 	public static function getConstraintStore(
53 53
 		?MediaWikiServices $services = null
54 54
 	): ConstraintStore {
55
-		return self::getService( $services, self::CONSTRAINT_STORE );
55
+		return self::getService($services, self::CONSTRAINT_STORE);
56 56
 	}
57 57
 
58
-	public static function getConstraintLookup( ?MediaWikiServices $services = null ): ConstraintLookup {
59
-		return self::getService( $services, self::CONSTRAINT_LOOKUP );
58
+	public static function getConstraintLookup(?MediaWikiServices $services = null): ConstraintLookup {
59
+		return self::getService($services, self::CONSTRAINT_LOOKUP);
60 60
 	}
61 61
 
62 62
 	public static function getCheckResultSerializer(
63 63
 		?MediaWikiServices $services = null
64 64
 	): CheckResultSerializer {
65
-		return self::getService( $services, self::CHECK_RESULT_SERIALIZER );
65
+		return self::getService($services, self::CHECK_RESULT_SERIALIZER);
66 66
 	}
67 67
 
68 68
 	public static function getCheckResultDeserializer(
69 69
 		?MediaWikiServices $services = null
70 70
 	): CheckResultDeserializer {
71
-		return self::getService( $services, self::CHECK_RESULT_DESERIALIZER );
71
+		return self::getService($services, self::CHECK_RESULT_DESERIALIZER);
72 72
 	}
73 73
 
74 74
 	public static function getViolationMessageSerializer(
75 75
 		?MediaWikiServices $services = null
76 76
 	): ViolationMessageSerializer {
77
-		return self::getService( $services, self::VIOLATION_MESSAGE_SERIALIZER );
77
+		return self::getService($services, self::VIOLATION_MESSAGE_SERIALIZER);
78 78
 	}
79 79
 
80 80
 	public static function getViolationMessageDeserializer(
81 81
 		?MediaWikiServices $services = null
82 82
 	): ViolationMessageDeserializer {
83
-		return self::getService( $services, self::VIOLATION_MESSAGE_DESERIALIZER );
83
+		return self::getService($services, self::VIOLATION_MESSAGE_DESERIALIZER);
84 84
 	}
85 85
 
86 86
 	public static function getConstraintParameterParser(
87 87
 		?MediaWikiServices $services = null
88 88
 	): ConstraintParameterParser {
89
-		return self::getService( $services, self::CONSTRAINT_PARAMETER_PARSER );
89
+		return self::getService($services, self::CONSTRAINT_PARAMETER_PARSER);
90 90
 	}
91 91
 
92 92
 	public static function getConnectionCheckerHelper(
93 93
 		?MediaWikiServices $services = null
94 94
 	): ConnectionCheckerHelper {
95
-		return self::getService( $services, self::CONNECTION_CHECKER_HELPER );
95
+		return self::getService($services, self::CONNECTION_CHECKER_HELPER);
96 96
 	}
97 97
 
98
-	public static function getRangeCheckerHelper( ?MediaWikiServices $services = null ): RangeCheckerHelper {
99
-		return self::getService( $services, self::RANGE_CHECKER_HELPER );
98
+	public static function getRangeCheckerHelper(?MediaWikiServices $services = null): RangeCheckerHelper {
99
+		return self::getService($services, self::RANGE_CHECKER_HELPER);
100 100
 	}
101 101
 
102
-	public static function getSparqlHelper( ?MediaWikiServices $services = null ): SparqlHelper {
103
-		return self::getService( $services, self::SPARQL_HELPER );
102
+	public static function getSparqlHelper(?MediaWikiServices $services = null): SparqlHelper {
103
+		return self::getService($services, self::SPARQL_HELPER);
104 104
 	}
105 105
 
106
-	public static function getTypeCheckerHelper( ?MediaWikiServices $services = null ): TypeCheckerHelper {
107
-		return self::getService( $services, self::TYPE_CHECKER_HELPER );
106
+	public static function getTypeCheckerHelper(?MediaWikiServices $services = null): TypeCheckerHelper {
107
+		return self::getService($services, self::TYPE_CHECKER_HELPER);
108 108
 	}
109 109
 
110 110
 	public static function getDelegatingConstraintChecker(
111 111
 		?MediaWikiServices $services = null
112 112
 	): DelegatingConstraintChecker {
113
-		return self::getService( $services, self::DELEGATING_CONSTRAINT_CHECKER );
113
+		return self::getService($services, self::DELEGATING_CONSTRAINT_CHECKER);
114 114
 	}
115 115
 
116
-	public static function getResultsSource( ?MediaWikiServices $services = null ): ResultsSource {
117
-		return self::getService( $services, self::RESULTS_SOURCE );
116
+	public static function getResultsSource(?MediaWikiServices $services = null): ResultsSource {
117
+		return self::getService($services, self::RESULTS_SOURCE);
118 118
 	}
119 119
 
120
-	public static function getExpiryLock( ?MediaWikiServices $services = null ): ExpiryLock {
121
-		return self::getService( $services, self::EXPIRY_LOCK );
120
+	public static function getExpiryLock(?MediaWikiServices $services = null): ExpiryLock {
121
+		return self::getService($services, self::EXPIRY_LOCK);
122 122
 	}
123 123
 
124 124
 	public static function getViolationMessageRendererFactory(
125 125
 		?MediaWikiServices $services = null
126 126
 	): ViolationMessageRendererFactory {
127
-		return self::getService( $services, self::VIOLATION_MESSAGE_RENDERER_FACTORY );
127
+		return self::getService($services, self::VIOLATION_MESSAGE_RENDERER_FACTORY);
128 128
 	}
129 129
 
130 130
 }
Please login to merge, or discard this patch.
src/Api/CheckingResultsSource.php 1 patch
Spacing   +20 added lines, -21 removed lines patch added patch discarded remove patch
@@ -44,57 +44,56 @@
 block discarded – undo
44 44
 	) {
45 45
 		$results = [];
46 46
 		$metadatas = [];
47
-		$statusesFlipped = array_flip( $statuses );
48
-		foreach ( $entityIds as $entityId ) {
47
+		$statusesFlipped = array_flip($statuses);
48
+		foreach ($entityIds as $entityId) {
49 49
 			$entityResults = $this->delegatingConstraintChecker->checkAgainstConstraintsOnEntityId(
50 50
 				$entityId,
51 51
 				$constraintIds,
52
-				[ $this, 'defaultResultsPerContext' ],
53
-				[ $this, 'defaultResultsPerEntity' ]
52
+				[$this, 'defaultResultsPerContext'],
53
+				[$this, 'defaultResultsPerEntity']
54 54
 			);
55
-			foreach ( $entityResults as $result ) {
55
+			foreach ($entityResults as $result) {
56 56
 				$metadatas[] = $result->getMetadata();
57
-				if ( $this->statusSelected( $statusesFlipped, $result ) ) {
57
+				if ($this->statusSelected($statusesFlipped, $result)) {
58 58
 					$results[] = $result;
59 59
 				}
60 60
 			}
61 61
 		}
62
-		foreach ( $claimIds as $claimId ) {
62
+		foreach ($claimIds as $claimId) {
63 63
 			$claimResults = $this->delegatingConstraintChecker->checkAgainstConstraintsOnClaimId(
64 64
 				$claimId,
65 65
 				$constraintIds,
66
-				[ $this, 'defaultResultsPerContext' ]
66
+				[$this, 'defaultResultsPerContext']
67 67
 			);
68
-			foreach ( $claimResults as $result ) {
68
+			foreach ($claimResults as $result) {
69 69
 				$metadatas[] = $result->getMetadata();
70
-				if ( $this->statusSelected( $statusesFlipped, $result ) ) {
70
+				if ($this->statusSelected($statusesFlipped, $result)) {
71 71
 					$results[] = $result;
72 72
 				}
73 73
 			}
74 74
 		}
75 75
 		return new CachedCheckResults(
76 76
 			$results,
77
-			Metadata::merge( $metadatas )
77
+			Metadata::merge($metadatas)
78 78
 		);
79 79
 	}
80 80
 
81
-	public function defaultResultsPerContext( Context $context ): array {
81
+	public function defaultResultsPerContext(Context $context): array {
82 82
 		return $context->getType() === Context::TYPE_STATEMENT ?
83
-			[ new NullResult( $context->getCursor() ) ] :
84
-			[];
83
+			[new NullResult($context->getCursor())] : [];
85 84
 	}
86 85
 
87
-	public function defaultResultsPerEntity( EntityId $entityId ): array {
86
+	public function defaultResultsPerEntity(EntityId $entityId): array {
88 87
 		return [
89
-			( new NullResult( new EntityContextCursor( $entityId->getSerialization() ) ) )
90
-				->withMetadata( Metadata::ofDependencyMetadata(
91
-					DependencyMetadata::ofEntityId( $entityId )
92
-				) ),
88
+			(new NullResult(new EntityContextCursor($entityId->getSerialization())))
89
+				->withMetadata(Metadata::ofDependencyMetadata(
90
+					DependencyMetadata::ofEntityId($entityId)
91
+				)),
93 92
 		];
94 93
 	}
95 94
 
96
-	public function statusSelected( array $statusesFlipped, CheckResult $result ): bool {
97
-		return array_key_exists( $result->getStatus(), $statusesFlipped ) ||
95
+	public function statusSelected(array $statusesFlipped, CheckResult $result): bool {
96
+		return array_key_exists($result->getStatus(), $statusesFlipped) ||
98 97
 			$result instanceof NullResult;
99 98
 	}
100 99
 
Please login to merge, or discard this patch.