@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return string |
29 | 29 | */ |
30 | 30 | public function getTime() { |
31 | - return gmdate( '+Y-m-d\TH:i:s\Z' ); |
|
31 | + return gmdate('+Y-m-d\TH:i:s\Z'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** @inheritDoc */ |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | |
44 | 44 | /** @inheritDoc */ |
45 | 45 | public function getArrayValue() { |
46 | - throw new LogicException( 'NowValue should never be serialized' ); |
|
46 | + throw new LogicException('NowValue should never be serialized'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** @inheritDoc */ |
50 | - public function equals( $value ) { |
|
51 | - return get_class( $value ) === self::class; |
|
50 | + public function equals($value) { |
|
51 | + return get_class($value) === self::class; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | } |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | return $ret; |
33 | 33 | } |
34 | 34 | |
35 | - public static function ofCachingMetadata( CachingMetadata $cachingMetadata ): self { |
|
35 | + public static function ofCachingMetadata(CachingMetadata $cachingMetadata): self { |
|
36 | 36 | $ret = new self; |
37 | 37 | $ret->cachingMetadata = $cachingMetadata; |
38 | 38 | $ret->dependencyMetadata = DependencyMetadata::blank(); |
39 | 39 | return $ret; |
40 | 40 | } |
41 | 41 | |
42 | - public static function ofDependencyMetadata( DependencyMetadata $dependencyMetadata ): self { |
|
42 | + public static function ofDependencyMetadata(DependencyMetadata $dependencyMetadata): self { |
|
43 | 43 | $ret = new self; |
44 | 44 | $ret->cachingMetadata = CachingMetadata::fresh(); |
45 | 45 | $ret->dependencyMetadata = $dependencyMetadata; |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | * @param self[] $metadatas |
51 | 51 | * @return self |
52 | 52 | */ |
53 | - public static function merge( array $metadatas ) { |
|
54 | - Assert::parameterElementType( self::class, $metadatas, '$metadatas' ); |
|
53 | + public static function merge(array $metadatas) { |
|
54 | + Assert::parameterElementType(self::class, $metadatas, '$metadatas'); |
|
55 | 55 | $cachingMetadatas = []; |
56 | 56 | $dependencyMetadatas = []; |
57 | - foreach ( $metadatas as $metadata ) { |
|
57 | + foreach ($metadatas as $metadata) { |
|
58 | 58 | $cachingMetadatas[] = $metadata->cachingMetadata; |
59 | 59 | $dependencyMetadatas[] = $metadata->dependencyMetadata; |
60 | 60 | } |
61 | 61 | $ret = new self; |
62 | - $ret->cachingMetadata = CachingMetadata::merge( $cachingMetadatas ); |
|
63 | - $ret->dependencyMetadata = DependencyMetadata::merge( $dependencyMetadatas ); |
|
62 | + $ret->cachingMetadata = CachingMetadata::merge($cachingMetadatas); |
|
63 | + $ret->dependencyMetadata = DependencyMetadata::merge($dependencyMetadatas); |
|
64 | 64 | return $ret; |
65 | 65 | } |
66 | 66 |
@@ -43,95 +43,95 @@ |
||
43 | 43 | public const VIOLATION_MESSAGE_RENDERER_FACTORY = 'WBQC_ViolationMessageRendererFactory'; |
44 | 44 | |
45 | 45 | /** @return mixed */ |
46 | - private static function getService( ?MediaWikiServices $services, string $name ) { |
|
46 | + private static function getService(?MediaWikiServices $services, string $name) { |
|
47 | 47 | $services ??= MediaWikiServices::getInstance(); |
48 | - return $services->getService( $name ); |
|
48 | + return $services->getService($name); |
|
49 | 49 | } |
50 | 50 | |
51 | - public static function getLogger( ?MediaWikiServices $services = null ): LoggerInterface { |
|
52 | - return self::getService( $services, self::LOGGER ); |
|
51 | + public static function getLogger(?MediaWikiServices $services = null): LoggerInterface { |
|
52 | + return self::getService($services, self::LOGGER); |
|
53 | 53 | } |
54 | 54 | |
55 | - public static function getLoggingHelper( ?MediaWikiServices $services = null ): LoggingHelper { |
|
56 | - return self::getService( $services, self::LOGGING_HELPER ); |
|
55 | + public static function getLoggingHelper(?MediaWikiServices $services = null): LoggingHelper { |
|
56 | + return self::getService($services, self::LOGGING_HELPER); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public static function getConstraintStore( |
60 | 60 | ?MediaWikiServices $services = null |
61 | 61 | ): ConstraintStore { |
62 | - return self::getService( $services, self::CONSTRAINT_STORE ); |
|
62 | + return self::getService($services, self::CONSTRAINT_STORE); |
|
63 | 63 | } |
64 | 64 | |
65 | - public static function getConstraintLookup( ?MediaWikiServices $services = null ): ConstraintLookup { |
|
66 | - return self::getService( $services, self::CONSTRAINT_LOOKUP ); |
|
65 | + public static function getConstraintLookup(?MediaWikiServices $services = null): ConstraintLookup { |
|
66 | + return self::getService($services, self::CONSTRAINT_LOOKUP); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public static function getCheckResultSerializer( |
70 | 70 | ?MediaWikiServices $services = null |
71 | 71 | ): CheckResultSerializer { |
72 | - return self::getService( $services, self::CHECK_RESULT_SERIALIZER ); |
|
72 | + return self::getService($services, self::CHECK_RESULT_SERIALIZER); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public static function getCheckResultDeserializer( |
76 | 76 | ?MediaWikiServices $services = null |
77 | 77 | ): CheckResultDeserializer { |
78 | - return self::getService( $services, self::CHECK_RESULT_DESERIALIZER ); |
|
78 | + return self::getService($services, self::CHECK_RESULT_DESERIALIZER); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public static function getViolationMessageSerializer( |
82 | 82 | ?MediaWikiServices $services = null |
83 | 83 | ): ViolationMessageSerializer { |
84 | - return self::getService( $services, self::VIOLATION_MESSAGE_SERIALIZER ); |
|
84 | + return self::getService($services, self::VIOLATION_MESSAGE_SERIALIZER); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public static function getViolationMessageDeserializer( |
88 | 88 | ?MediaWikiServices $services = null |
89 | 89 | ): ViolationMessageDeserializer { |
90 | - return self::getService( $services, self::VIOLATION_MESSAGE_DESERIALIZER ); |
|
90 | + return self::getService($services, self::VIOLATION_MESSAGE_DESERIALIZER); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | public static function getConstraintParameterParser( |
94 | 94 | ?MediaWikiServices $services = null |
95 | 95 | ): ConstraintParameterParser { |
96 | - return self::getService( $services, self::CONSTRAINT_PARAMETER_PARSER ); |
|
96 | + return self::getService($services, self::CONSTRAINT_PARAMETER_PARSER); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | public static function getConnectionCheckerHelper( |
100 | 100 | ?MediaWikiServices $services = null |
101 | 101 | ): ConnectionCheckerHelper { |
102 | - return self::getService( $services, self::CONNECTION_CHECKER_HELPER ); |
|
102 | + return self::getService($services, self::CONNECTION_CHECKER_HELPER); |
|
103 | 103 | } |
104 | 104 | |
105 | - public static function getRangeCheckerHelper( ?MediaWikiServices $services = null ): RangeCheckerHelper { |
|
106 | - return self::getService( $services, self::RANGE_CHECKER_HELPER ); |
|
105 | + public static function getRangeCheckerHelper(?MediaWikiServices $services = null): RangeCheckerHelper { |
|
106 | + return self::getService($services, self::RANGE_CHECKER_HELPER); |
|
107 | 107 | } |
108 | 108 | |
109 | - public static function getSparqlHelper( ?MediaWikiServices $services = null ): SparqlHelper { |
|
110 | - return self::getService( $services, self::SPARQL_HELPER ); |
|
109 | + public static function getSparqlHelper(?MediaWikiServices $services = null): SparqlHelper { |
|
110 | + return self::getService($services, self::SPARQL_HELPER); |
|
111 | 111 | } |
112 | 112 | |
113 | - public static function getTypeCheckerHelper( ?MediaWikiServices $services = null ): TypeCheckerHelper { |
|
114 | - return self::getService( $services, self::TYPE_CHECKER_HELPER ); |
|
113 | + public static function getTypeCheckerHelper(?MediaWikiServices $services = null): TypeCheckerHelper { |
|
114 | + return self::getService($services, self::TYPE_CHECKER_HELPER); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | public static function getDelegatingConstraintChecker( |
118 | 118 | ?MediaWikiServices $services = null |
119 | 119 | ): DelegatingConstraintChecker { |
120 | - return self::getService( $services, self::DELEGATING_CONSTRAINT_CHECKER ); |
|
120 | + return self::getService($services, self::DELEGATING_CONSTRAINT_CHECKER); |
|
121 | 121 | } |
122 | 122 | |
123 | - public static function getResultsSource( ?MediaWikiServices $services = null ): ResultsSource { |
|
124 | - return self::getService( $services, self::RESULTS_SOURCE ); |
|
123 | + public static function getResultsSource(?MediaWikiServices $services = null): ResultsSource { |
|
124 | + return self::getService($services, self::RESULTS_SOURCE); |
|
125 | 125 | } |
126 | 126 | |
127 | - public static function getExpiryLock( ?MediaWikiServices $services = null ): ExpiryLock { |
|
128 | - return self::getService( $services, self::EXPIRY_LOCK ); |
|
127 | + public static function getExpiryLock(?MediaWikiServices $services = null): ExpiryLock { |
|
128 | + return self::getService($services, self::EXPIRY_LOCK); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | public static function getViolationMessageRendererFactory( |
132 | 132 | ?MediaWikiServices $services = null |
133 | 133 | ): ViolationMessageRendererFactory { |
134 | - return self::getService( $services, self::VIOLATION_MESSAGE_RENDERER_FACTORY ); |
|
134 | + return self::getService($services, self::VIOLATION_MESSAGE_RENDERER_FACTORY); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | } |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | * then using the main DBLoadBalancer service may be incorrect. |
25 | 25 | * @param string|false $dbName Database name ($domain for ILoadBalancer methods). |
26 | 26 | */ |
27 | - public function __construct( ILoadBalancer $lb, $dbName ) { |
|
27 | + public function __construct(ILoadBalancer $lb, $dbName) { |
|
28 | 28 | $this->lb = $lb; |
29 | 29 | $this->dbName = $dbName; |
30 | 30 | } |
31 | 31 | |
32 | - private function encodeConstraintParameters( array $constraintParameters ): string { |
|
33 | - $json = json_encode( $constraintParameters, JSON_FORCE_OBJECT ); |
|
32 | + private function encodeConstraintParameters(array $constraintParameters): string { |
|
33 | + $json = json_encode($constraintParameters, JSON_FORCE_OBJECT); |
|
34 | 34 | |
35 | - if ( strlen( $json ) > 50000 ) { |
|
36 | - $json = json_encode( [ '@error' => [ 'toolong' => true ] ] ); |
|
35 | + if (strlen($json) > 50000) { |
|
36 | + $json = json_encode(['@error' => ['toolong' => true]]); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $json; |
@@ -44,28 +44,28 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @throws DBUnexpectedError |
46 | 46 | */ |
47 | - public function insertBatch( array $constraints ) { |
|
48 | - if ( !$constraints ) { |
|
47 | + public function insertBatch(array $constraints) { |
|
48 | + if (!$constraints) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
52 | 52 | $accumulator = array_map( |
53 | - function ( Constraint $constraint ) { |
|
53 | + function(Constraint $constraint) { |
|
54 | 54 | return [ |
55 | 55 | 'constraint_guid' => $constraint->getConstraintId(), |
56 | 56 | 'pid' => $constraint->getPropertyId()->getNumericId(), |
57 | 57 | 'constraint_type_qid' => $constraint->getConstraintTypeItemId(), |
58 | - 'constraint_parameters' => $this->encodeConstraintParameters( $constraint->getConstraintParameters() ), |
|
58 | + 'constraint_parameters' => $this->encodeConstraintParameters($constraint->getConstraintParameters()), |
|
59 | 59 | ]; |
60 | 60 | }, |
61 | 61 | $constraints |
62 | 62 | ); |
63 | 63 | |
64 | - $dbw = $this->lb->getConnection( ILoadBalancer::DB_PRIMARY, [], $this->dbName ); |
|
64 | + $dbw = $this->lb->getConnection(ILoadBalancer::DB_PRIMARY, [], $this->dbName); |
|
65 | 65 | $dbw->newInsertQueryBuilder() |
66 | - ->insertInto( 'wbqc_constraints' ) |
|
67 | - ->rows( $accumulator ) |
|
68 | - ->caller( __METHOD__ ) |
|
66 | + ->insertInto('wbqc_constraints') |
|
67 | + ->rows($accumulator) |
|
68 | + ->caller(__METHOD__) |
|
69 | 69 | ->execute(); |
70 | 70 | } |
71 | 71 | |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @throws DBUnexpectedError |
78 | 78 | */ |
79 | - public function deleteForProperty( NumericPropertyId $propertyId ) { |
|
80 | - $dbw = $this->lb->getConnection( ILoadBalancer::DB_PRIMARY, [], $this->dbName ); |
|
79 | + public function deleteForProperty(NumericPropertyId $propertyId) { |
|
80 | + $dbw = $this->lb->getConnection(ILoadBalancer::DB_PRIMARY, [], $this->dbName); |
|
81 | 81 | $dbw->newDeleteQueryBuilder() |
82 | - ->deleteFrom( 'wbqc_constraints' ) |
|
83 | - ->where( [ |
|
82 | + ->deleteFrom('wbqc_constraints') |
|
83 | + ->where([ |
|
84 | 84 | 'pid' => $propertyId->getNumericId(), |
85 | - ] ) |
|
86 | - ->caller( __METHOD__ ) |
|
85 | + ]) |
|
86 | + ->caller(__METHOD__) |
|
87 | 87 | ->execute(); |
88 | 88 | } |
89 | 89 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace WikibaseQuality\ConstraintReport\ConstraintCheck\Context; |
6 | 6 | |
@@ -61,6 +61,6 @@ discard block |
||
61 | 61 | * @param ?array $result |
62 | 62 | * @param array[] &$container |
63 | 63 | */ |
64 | - public function storeCheckResultInArray( ?array $result, array &$container ): void; |
|
64 | + public function storeCheckResultInArray(?array $result, array &$container): void; |
|
65 | 65 | |
66 | 66 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace WikibaseQuality\ConstraintReport\ConstraintCheck\Context; |
6 | 6 | |
@@ -60,29 +60,29 @@ discard block |
||
60 | 60 | return $this->snakHash; |
61 | 61 | } |
62 | 62 | |
63 | - protected function &getMainArray( array &$container ): array { |
|
64 | - $statementArray = &$this->getStatementArray( $container ); |
|
63 | + protected function &getMainArray(array &$container): array { |
|
64 | + $statementArray = &$this->getStatementArray($container); |
|
65 | 65 | |
66 | - if ( !array_key_exists( 'qualifiers', $statementArray ) ) { |
|
66 | + if (!array_key_exists('qualifiers', $statementArray)) { |
|
67 | 67 | $statementArray['qualifiers'] = []; |
68 | 68 | } |
69 | 69 | $qualifiersArray = &$statementArray['qualifiers']; |
70 | 70 | |
71 | 71 | $snakPropertyId = $this->getSnakPropertyId(); |
72 | - if ( !array_key_exists( $snakPropertyId, $qualifiersArray ) ) { |
|
72 | + if (!array_key_exists($snakPropertyId, $qualifiersArray)) { |
|
73 | 73 | $qualifiersArray[$snakPropertyId] = []; |
74 | 74 | } |
75 | 75 | $propertyArray = &$qualifiersArray[$snakPropertyId]; |
76 | 76 | |
77 | 77 | $snakHash = $this->getSnakHash(); |
78 | - foreach ( $propertyArray as &$potentialQualifierArray ) { |
|
79 | - if ( $potentialQualifierArray['hash'] === $snakHash ) { |
|
78 | + foreach ($propertyArray as &$potentialQualifierArray) { |
|
79 | + if ($potentialQualifierArray['hash'] === $snakHash) { |
|
80 | 80 | $qualifierArray = &$potentialQualifierArray; |
81 | 81 | break; |
82 | 82 | } |
83 | 83 | } |
84 | - if ( !isset( $qualifierArray ) ) { |
|
85 | - $qualifierArray = [ 'hash' => $snakHash ]; |
|
84 | + if (!isset($qualifierArray)) { |
|
85 | + $qualifierArray = ['hash' => $snakHash]; |
|
86 | 86 | $propertyArray[] = &$qualifierArray; |
87 | 87 | } |
88 | 88 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace WikibaseQuality\ConstraintReport\ConstraintCheck\Context; |
6 | 6 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @codeCoverageIgnore This method is not supported. |
33 | 33 | */ |
34 | 34 | public function getType(): string { |
35 | - throw new LogicException( 'EntityContextCursor has no full associated context' ); |
|
35 | + throw new LogicException('EntityContextCursor has no full associated context'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function getEntityId(): string { |
@@ -43,35 +43,35 @@ discard block |
||
43 | 43 | * @codeCoverageIgnore This method is not supported. |
44 | 44 | */ |
45 | 45 | public function getStatementPropertyId(): string { |
46 | - throw new LogicException( 'EntityContextCursor has no full associated context' ); |
|
46 | + throw new LogicException('EntityContextCursor has no full associated context'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @codeCoverageIgnore This method is not supported. |
51 | 51 | */ |
52 | 52 | public function getStatementGuid(): string { |
53 | - throw new LogicException( 'EntityContextCursor has no full associated context' ); |
|
53 | + throw new LogicException('EntityContextCursor has no full associated context'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @codeCoverageIgnore This method is not supported. |
58 | 58 | */ |
59 | 59 | public function getSnakPropertyId(): string { |
60 | - throw new LogicException( 'EntityContextCursor has no full associated context' ); |
|
60 | + throw new LogicException('EntityContextCursor has no full associated context'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @codeCoverageIgnore This method is not supported. |
65 | 65 | */ |
66 | 66 | public function getSnakHash(): string { |
67 | - throw new LogicException( 'EntityContextCursor has no full associated context' ); |
|
67 | + throw new LogicException('EntityContextCursor has no full associated context'); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | 71 | * @codeCoverageIgnore This method is not supported. |
72 | 72 | */ |
73 | - public function &getMainArray( array &$container ): array { |
|
74 | - throw new LogicException( 'EntityContextCursor cannot store check results' ); |
|
73 | + public function &getMainArray(array &$container): array { |
|
74 | + throw new LogicException('EntityContextCursor cannot store check results'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * @param ?array $result must be null |
81 | 81 | * @param array[] &$container |
82 | 82 | */ |
83 | - public function storeCheckResultInArray( ?array $result, array &$container ): void { |
|
84 | - if ( $result !== null ) { |
|
85 | - throw new LogicException( 'EntityContextCursor cannot store check results' ); |
|
83 | + public function storeCheckResultInArray(?array $result, array &$container): void { |
|
84 | + if ($result !== null) { |
|
85 | + throw new LogicException('EntityContextCursor cannot store check results'); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // this ensures that the claims array is present in the $container, |
89 | 89 | // populating it if necessary, even though we ignore the return value |
90 | - $this->getClaimsArray( $container ); |
|
90 | + $this->getClaimsArray($container); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace WikibaseQuality\ConstraintReport\ConstraintCheck\Context; |
6 | 6 | |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | * @param array[] &$container |
30 | 30 | * @return array |
31 | 31 | */ |
32 | - protected function &getClaimsArray( array &$container ): array { |
|
32 | + protected function &getClaimsArray(array &$container): array { |
|
33 | 33 | $entityId = $this->getEntityId(); |
34 | 34 | |
35 | - if ( !array_key_exists( $entityId, $container ) ) { |
|
35 | + if (!array_key_exists($entityId, $container)) { |
|
36 | 36 | $container[$entityId] = []; |
37 | 37 | } |
38 | 38 | $entityContainer = &$container[$entityId]; |
39 | 39 | |
40 | - if ( !array_key_exists( 'claims', $entityContainer ) ) { |
|
40 | + if (!array_key_exists('claims', $entityContainer)) { |
|
41 | 41 | $entityContainer['claims'] = []; |
42 | 42 | } |
43 | 43 | $claimsArray = &$entityContainer['claims']; |
@@ -51,25 +51,25 @@ discard block |
||
51 | 51 | * @param array[] &$container |
52 | 52 | * @return array |
53 | 53 | */ |
54 | - protected function &getStatementArray( array &$container ): array { |
|
54 | + protected function &getStatementArray(array &$container): array { |
|
55 | 55 | $statementPropertyId = $this->getStatementPropertyId(); |
56 | 56 | $statementGuid = $this->getStatementGuid(); |
57 | 57 | |
58 | - $claimsContainer = &$this->getClaimsArray( $container ); |
|
58 | + $claimsContainer = &$this->getClaimsArray($container); |
|
59 | 59 | |
60 | - if ( !array_key_exists( $statementPropertyId, $claimsContainer ) ) { |
|
60 | + if (!array_key_exists($statementPropertyId, $claimsContainer)) { |
|
61 | 61 | $claimsContainer[$statementPropertyId] = []; |
62 | 62 | } |
63 | 63 | $propertyContainer = &$claimsContainer[$statementPropertyId]; |
64 | 64 | |
65 | - foreach ( $propertyContainer as &$statement ) { |
|
66 | - if ( $statement['id'] === $statementGuid ) { |
|
65 | + foreach ($propertyContainer as &$statement) { |
|
66 | + if ($statement['id'] === $statementGuid) { |
|
67 | 67 | $statementArray = &$statement; |
68 | 68 | break; |
69 | 69 | } |
70 | 70 | } |
71 | - if ( !isset( $statementArray ) ) { |
|
72 | - $statementArray = [ 'id' => $statementGuid ]; |
|
71 | + if (!isset($statementArray)) { |
|
72 | + $statementArray = ['id' => $statementGuid]; |
|
73 | 73 | $propertyContainer[] = &$statementArray; |
74 | 74 | } |
75 | 75 | |
@@ -84,19 +84,19 @@ discard block |
||
84 | 84 | * @param array[] &$container |
85 | 85 | * @return array |
86 | 86 | */ |
87 | - abstract protected function &getMainArray( array &$container ): array; |
|
87 | + abstract protected function &getMainArray(array &$container): array; |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * @param ?array $result |
91 | 91 | * @param array[] &$container |
92 | 92 | */ |
93 | - public function storeCheckResultInArray( ?array $result, array &$container ): void { |
|
94 | - $mainArray = &$this->getMainArray( $container ); |
|
95 | - if ( !array_key_exists( 'results', $mainArray ) ) { |
|
93 | + public function storeCheckResultInArray(?array $result, array &$container): void { |
|
94 | + $mainArray = &$this->getMainArray($container); |
|
95 | + if (!array_key_exists('results', $mainArray)) { |
|
96 | 96 | $mainArray['results'] = []; |
97 | 97 | } |
98 | 98 | |
99 | - if ( $result !== null ) { |
|
99 | + if ($result !== null) { |
|
100 | 100 | $mainArray['results'][] = $result; |
101 | 101 | } |
102 | 102 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types = 1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace WikibaseQuality\ConstraintReport\ConstraintCheck\Context; |
6 | 6 | |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | return $this->snakHash; |
57 | 57 | } |
58 | 58 | |
59 | - protected function &getMainArray( array &$container ): array { |
|
60 | - $statementArray = &$this->getStatementArray( $container ); |
|
59 | + protected function &getMainArray(array &$container): array { |
|
60 | + $statementArray = &$this->getStatementArray($container); |
|
61 | 61 | |
62 | - if ( !array_key_exists( 'mainsnak', $statementArray ) ) { |
|
62 | + if (!array_key_exists('mainsnak', $statementArray)) { |
|
63 | 63 | $snakHash = $this->getSnakHash(); |
64 | - $statementArray['mainsnak'] = [ 'hash' => $snakHash ]; |
|
64 | + $statementArray['mainsnak'] = ['hash' => $snakHash]; |
|
65 | 65 | } |
66 | 66 | $mainsnakArray = &$statementArray['mainsnak']; |
67 | 67 |