Passed
Pull Request — master (#1497)
by Asmir
06:08 queued 03:25
created
src/Handler/LazyHandlerRegistry.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function __construct($container, array $handlers = [])
28 28
     {
29
-        if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) {
29
+        if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) {
30 30
             throw new InvalidArgumentException(sprintf('The container must be an instance of %s or %s (%s given).', PsrContainerInterface::class, ContainerInterface::class, \is_object($container) ? \get_class($container) : \gettype($container)));
31 31
         }
32 32
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             return $this->initializedHandlers[$direction][$typeName][$format];
53 53
         }
54 54
 
55
-        if (!isset($this->handlers[$direction][$typeName][$format])) {
55
+        if ( ! isset($this->handlers[$direction][$typeName][$format])) {
56 56
             return null;
57 57
         }
58 58
 
Please login to merge, or discard this patch.
src/Metadata/PropertyMetadata.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -157,22 +157,22 @@  discard block
 block discarded – undo
157 157
             $class = $this->getReflection()->getDeclaringClass();
158 158
 
159 159
             if (empty($getter)) {
160
-                if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) {
161
-                    $getter = 'get' . $this->name;
162
-                } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) {
163
-                    $getter = 'is' . $this->name;
164
-                } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) {
165
-                    $getter = 'has' . $this->name;
160
+                if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) {
161
+                    $getter = 'get'.$this->name;
162
+                } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) {
163
+                    $getter = 'is'.$this->name;
164
+                } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) {
165
+                    $getter = 'has'.$this->name;
166 166
                 } else {
167
-                    throw new InvalidMetadataException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get' . ucfirst($this->name), 'is' . ucfirst($this->name), 'has' . ucfirst($this->name), $this->class, $this->name));
167
+                    throw new InvalidMetadataException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get'.ucfirst($this->name), 'is'.ucfirst($this->name), 'has'.ucfirst($this->name), $this->class, $this->name));
168 168
                 }
169 169
             }
170 170
 
171
-            if (empty($setter) && !$this->readOnly) {
172
-                if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) {
173
-                    $setter = 'set' . $this->name;
171
+            if (empty($setter) && ! $this->readOnly) {
172
+                if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) {
173
+                    $setter = 'set'.$this->name;
174 174
                 } else {
175
-                    throw new InvalidMetadataException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set' . ucfirst($this->name), $this->class, $this->name));
175
+                    throw new InvalidMetadataException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set'.ucfirst($this->name), $this->class, $this->name));
176 176
                 }
177 177
             }
178 178
         }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         return is_array($type)
192 192
             && 'array' === $type['name']
193 193
             && isset($type['params'][0])
194
-            && !isset($type['params'][1]);
194
+            && ! isset($type['params'][1]);
195 195
     }
196 196
 
197 197
     public static function isCollectionMap(?array $type = null): bool
Please login to merge, or discard this patch.
src/Serializer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
     private function getNavigator(int $direction): GraphNavigatorInterface
116 116
     {
117
-        if (!isset($this->graphNavigators[$direction])) {
117
+        if ( ! isset($this->graphNavigators[$direction])) {
118 118
             throw new RuntimeException(
119 119
                 sprintf(
120 120
                     'Can not find a graph navigator for the direction "%s".',
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             ? $this->serializationVisitors
133 133
             : $this->deserializationVisitors;
134 134
 
135
-        if (!isset($factories[$format])) {
135
+        if ( ! isset($factories[$format])) {
136 136
             throw new UnsupportedFormatException(
137 137
                 sprintf(
138 138
                     'The format "%s" is not supported for %s.',
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         $result = $this->visit($navigator, $visitor, $context, $data, 'json', $type);
197 197
         $result = $this->convertArrayObjects($result);
198 198
 
199
-        if (!\is_array($result)) {
199
+        if ( ! \is_array($result)) {
200 200
             throw new RuntimeException(sprintf(
201 201
                 'The input data of type "%s" did not convert to an array, but got a result of type "%s".',
202 202
                 \is_object($data) ? \get_class($data) : \gettype($data),
Please login to merge, or discard this patch.
src/Context.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version']));
80 80
         }
81 81
 
82
-        if (!empty($this->attributes['max_depth_checks'])) {
82
+        if ( ! empty($this->attributes['max_depth_checks'])) {
83 83
             $this->addExclusionStrategy(new DepthExclusionStrategy());
84 84
         }
85 85
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     final protected function assertMutable(): void
134 134
     {
135
-        if (!$this->initialized) {
135
+        if ( ! $this->initialized) {
136 136
             return;
137 137
         }
138 138
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $metadata = $this->metadataStack->pop();
210 210
 
211
-        if (!$metadata instanceof PropertyMetadata) {
211
+        if ( ! $metadata instanceof PropertyMetadata) {
212 212
             throw new RuntimeException('Context metadataStack not working well');
213 213
         }
214 214
     }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     {
218 218
         $metadata = $this->metadataStack->pop();
219 219
 
220
-        if (!$metadata instanceof ClassMetadata) {
220
+        if ( ! $metadata instanceof ClassMetadata) {
221 221
             throw new RuntimeException('Context metadataStack not working well');
222 222
         }
223 223
     }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function getCurrentPath(): array
234 234
     {
235
-        if (!$this->metadataStack) {
235
+        if ( ! $this->metadataStack) {
236 236
             return [];
237 237
         }
238 238
 
Please login to merge, or discard this patch.
src/AbstractVisitor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             throw new NonStringCastableTypeException($value);
57 57
         }
58 58
 
59
-        if (is_object($value) && !method_exists($value, '__toString')) {
59
+        if (is_object($value) && ! method_exists($value, '__toString')) {
60 60
             throw new NonStringCastableTypeException($value);
61 61
         }
62 62
     }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     protected function assertValueCanBeCastToInt($value): void
71 71
     {
72
-        if (is_object($value) && !$value instanceof \SimpleXMLElement) {
72
+        if (is_object($value) && ! $value instanceof \SimpleXMLElement) {
73 73
             throw new NonIntCastableTypeException($value);
74 74
         }
75 75
     }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     protected function assertValueCanCastToFloat($value): void
84 84
     {
85
-        if (is_object($value) && !$value instanceof \SimpleXMLElement) {
85
+        if (is_object($value) && ! $value instanceof \SimpleXMLElement) {
86 86
             throw new NonFloatCastableTypeException($value);
87 87
         }
88 88
     }
Please login to merge, or discard this patch.
src/GraphNavigator/DeserializationGraphNavigator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
                 $metadata = $this->metadataFactory->getMetadataForClass($type['name']);
172 172
                 \assert($metadata instanceof ClassMetadata);
173 173
 
174
-                if ($metadata->usingExpression && !$this->expressionExclusionStrategy) {
174
+                if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) {
175 175
                     throw new ExpressionLanguageRequiredException(sprintf('To use conditional exclude/expose in %s you must configure the expression language.', $metadata->name));
176 176
                 }
177 177
 
178
-                if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
178
+                if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
179 179
                     $metadata = $this->resolveMetadata($data, $metadata);
180 180
                 }
181 181
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     {
235 235
         $typeValue = $this->visitor->visitDiscriminatorMapProperty($data, $metadata);
236 236
 
237
-        if (!isset($metadata->discriminatorMap[$typeValue])) {
237
+        if ( ! isset($metadata->discriminatorMap[$typeValue])) {
238 238
             throw new LogicException(sprintf(
239 239
                 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s',
240 240
                 $typeValue,
Please login to merge, or discard this patch.
src/Metadata/ClassMetadata.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function setAccessorOrder(string $order, array $customOrder = []): void
167 167
     {
168
-        if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) {
168
+        if ( ! in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) {
169 169
             throw new InvalidMetadataException(sprintf('The accessor order "%s" is invalid.', $order));
170 170
         }
171 171
 
172 172
         foreach ($customOrder as $name) {
173
-            if (!\is_string($name)) {
173
+            if ( ! \is_string($name)) {
174 174
                 throw new InvalidMetadataException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name)));
175 175
             }
176 176
         }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
     public function merge(MergeableInterface $object): void
208 208
     {
209
-        if (!$object instanceof ClassMetadata) {
209
+        if ( ! $object instanceof ClassMetadata) {
210 210
             throw new InvalidMetadataException('$object must be an instance of ClassMetadata.');
211 211
         }
212 212
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                 $this->discriminatorBaseClass,
236 236
                 $this->discriminatorBaseClass
237 237
             ));
238
-        } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) {
238
+        } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) {
239 239
             $this->discriminatorFieldName = $object->discriminatorFieldName;
240 240
             $this->discriminatorMap = $object->discriminatorMap;
241 241
         }
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 
259 259
     public function registerNamespace(string $uri, ?string $prefix = null): void
260 260
     {
261
-        if (!\is_string($uri)) {
261
+        if ( ! \is_string($uri)) {
262 262
             throw new InvalidMetadataException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri)));
263 263
         }
264 264
 
265 265
         if (null !== $prefix) {
266
-            if (!\is_string($prefix)) {
266
+            if ( ! \is_string($prefix)) {
267 267
                 throw new InvalidMetadataException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix)));
268 268
             }
269 269
         } else {
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
     {
384 384
         if (
385 385
             $this->discriminatorMap
386
-            && !$this->getReflection()->isAbstract()
387
-            && !$this->getReflection()->isInterface()
386
+            && ! $this->getReflection()->isAbstract()
387
+            && ! $this->getReflection()->isInterface()
388 388
         ) {
389 389
             if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) {
390 390
                 throw new InvalidMetadataException(sprintf(
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 
399 399
             if (
400 400
                 isset($this->propertyMetadata[$this->discriminatorFieldName])
401
-                && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
401
+                && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
402 402
             ) {
403 403
                 throw new InvalidMetadataException(sprintf(
404 404
                     'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".',
Please login to merge, or discard this patch.
src/Metadata/Driver/DoctrinePHPCRTypeDriver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             && ($fieldType = $this->normalizeFieldType($typeOfFiled))
30 30
         ) {
31 31
             $field = $doctrineMetadata->getFieldMapping($propertyName);
32
-            if (!empty($field['multivalue'])) {
32
+            if ( ! empty($field['multivalue'])) {
33 33
                 $fieldType = 'array';
34 34
             }
35 35
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                 return;
46 46
             }
47 47
 
48
-            if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) {
48
+            if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) {
49 49
                 $targetEntity = sprintf('ArrayCollection<%s>', $targetEntity);
50 50
             }
51 51
 
Please login to merge, or discard this patch.
src/Metadata/Driver/XmlDriver.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
         }
55 55
 
56 56
         $metadata = new ClassMetadata($name = $class->name);
57
-        if (!$elems = $elem->xpath("./class[@name = '" . $name . "']")) {
57
+        if ( ! $elems = $elem->xpath("./class[@name = '".$name."']")) {
58 58
             throw new InvalidMetadataException(sprintf('Could not find class %s inside XML element.', $name));
59 59
         }
60 60
 
61 61
         $elem = reset($elems);
62 62
 
63 63
         $metadata->fileResources[] = $path;
64
-        $fileResource =  $class->getFilename();
64
+        $fileResource = $class->getFilename();
65 65
         if (false !== $fileResource) {
66 66
             $metadata->fileResources[] = $fileResource;
67 67
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'};
101 101
         $discriminatorMap = [];
102 102
         foreach ($elem->xpath('./discriminator-class') as $entry) {
103
-            if (!isset($entry->attributes()->value)) {
103
+            if ( ! isset($entry->attributes()->value)) {
104 104
                 throw new InvalidMetadataException('Each discriminator-class element must have a "value" attribute.');
105 105
             }
106 106
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
         if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) {
111 111
             $metadata->discriminatorDisabled = true;
112
-        } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) {
112
+        } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) {
113 113
             $discriminatorGroups = [];
114 114
             foreach ($elem->xpath('./discriminator-groups/group') as $entry) {
115 115
                 $discriminatorGroups[] = (string) $entry;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         }
120 120
 
121 121
         foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) {
122
-            if (!isset($xmlNamespace->attributes()->uri)) {
122
+            if ( ! isset($xmlNamespace->attributes()->uri)) {
123 123
                 throw new InvalidMetadataException('The prefix attribute must be set for all xml-namespace elements.');
124 124
             }
125 125
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                     $this->parseExpression((string) $method->attributes()->expression)
155 155
                 );
156 156
             } else {
157
-                if (!isset($method->attributes()->method)) {
157
+                if ( ! isset($method->attributes()->method)) {
158 158
                     throw new InvalidMetadataException('The method attribute must be set for all virtual-property elements.');
159 159
                 }
160 160
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             $propertiesNodes[] = $method;
166 166
         }
167 167
 
168
-        if (!$excludeAll) {
168
+        if ( ! $excludeAll) {
169 169
             foreach ($class->getProperties() as $property) {
170 170
                 if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
171 171
                     continue;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                 $pName = $property->getName();
175 175
                 $propertiesMetadata[] = new PropertyMetadata($name, $pName);
176 176
 
177
-                $pElems = $elem->xpath("./property[@name = '" . $pName . "']");
177
+                $pElems = $elem->xpath("./property[@name = '".$pName."']");
178 178
                 $propertiesNodes[] = $pElems ? reset($pElems) : null;
179 179
             }
180 180
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                     || isset($propertiesNodes[$propertyKey]);
186 186
 
187 187
                 $pElem = $propertiesNodes[$propertyKey];
188
-                if (!empty($pElem)) {
188
+                if ( ! empty($pElem)) {
189 189
                     if (null !== $exclude = $pElem->attributes()->exclude) {
190 190
                         $isExclude = 'true' === strtolower((string) $exclude);
191 191
                     }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                     }
208 208
 
209 209
                     if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) {
210
-                        $pMetadata->excludeIf = $this->parseExpression('!(' . (string) $excludeIf . ')');
210
+                        $pMetadata->excludeIf = $this->parseExpression('!('.(string) $excludeIf.')');
211 211
                         $isExpose = true;
212 212
                     }
213 213
 
@@ -335,16 +335,16 @@  discard block
 block discarded – undo
335 335
                     $metadata->isMap = $metadata->isMap || PropertyMetadata::isCollectionMap($pMetadata->type);
336 336
                 }
337 337
 
338
-                if (!$pMetadata->serializedName) {
338
+                if ( ! $pMetadata->serializedName) {
339 339
                     $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata);
340 340
                 }
341 341
 
342
-                if (!empty($pElem) && null !== $name = $pElem->attributes()->name) {
342
+                if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) {
343 343
                     $pMetadata->name = (string) $name;
344 344
                 }
345 345
 
346 346
                 if (
347
-                    (ExclusionPolicy::NONE === (string) $exclusionPolicy && !$isExclude)
347
+                    (ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude)
348 348
                     || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose)
349 349
                 ) {
350 350
                     $metadata->addPropertyMetadata($pMetadata);
@@ -353,11 +353,11 @@  discard block
 block discarded – undo
353 353
         }
354 354
 
355 355
         foreach ($elem->xpath('./callback-method') as $method) {
356
-            if (!isset($method->attributes()->type)) {
356
+            if ( ! isset($method->attributes()->type)) {
357 357
                 throw new InvalidMetadataException('The type attribute must be set for all callback-method elements.');
358 358
             }
359 359
 
360
-            if (!isset($method->attributes()->name)) {
360
+            if ( ! isset($method->attributes()->name)) {
361 361
                 throw new InvalidMetadataException('The name attribute must be set for all callback-method elements.');
362 362
             }
363 363
 
@@ -375,11 +375,11 @@  discard block
 block discarded – undo
375 375
                     break;
376 376
 
377 377
                 case 'handler':
378
-                    if (!isset($method->attributes()->format)) {
378
+                    if ( ! isset($method->attributes()->format)) {
379 379
                         throw new InvalidMetadataException('The format attribute must be set for "handler" callback methods.');
380 380
                     }
381 381
 
382
-                    if (!isset($method->attributes()->direction)) {
382
+                    if ( ! isset($method->attributes()->direction)) {
383 383
                         throw new InvalidMetadataException('The direction attribute must be set for "handler" callback methods.');
384 384
                     }
385 385
 
Please login to merge, or discard this patch.