Passed
Branch master (bf85d9)
by Johannes
05:40
created
src/SerializationGraphNavigator.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@
 block discarded – undo
57 57
         HandlerRegistryInterface $handlerRegistry,
58 58
         EventDispatcherInterface $dispatcher = null,
59 59
         ExpressionEvaluatorInterface $expressionEvaluator = null
60
-    )
61
-    {
60
+    ) {
62 61
         $this->dispatcher = $dispatcher ?: new EventDispatcher();
63 62
         $this->metadataFactory = $metadataFactory;
64 63
         $this->handlerRegistry = $handlerRegistry;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
             case 'resource':
129 129
                 $msg = 'Resources are not supported in serialized data.';
130 130
                 if (null !== $path = $context->getPath()) {
131
-                    $msg .= ' Path: ' . $path;
131
+                    $msg .= ' Path: '.$path;
132 132
                 }
133 133
 
134 134
                 throw new RuntimeException($msg);
Please login to merge, or discard this patch.
src/Metadata/PropertyMetadata.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     public function __construct($class, $name)
60 60
     {
61 61
         parent::__construct($class, $name);
62
-        $this->closureAccessor = \Closure::bind(function ($o, $name) {
62
+        $this->closureAccessor = \Closure::bind(function($o, $name) {
63 63
             return $o->$name;
64 64
         }, null, $class);
65 65
     }
@@ -69,22 +69,22 @@  discard block
 block discarded – undo
69 69
             $class = $this->reflection->getDeclaringClass();
70 70
 
71 71
             if (empty($getter)) {
72
-                if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) {
73
-                    $getter = 'get' . $this->name;
74
-                } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) {
75
-                    $getter = 'is' . $this->name;
76
-                } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) {
77
-                    $getter = 'has' . $this->name;
72
+                if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) {
73
+                    $getter = 'get'.$this->name;
74
+                } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) {
75
+                    $getter = 'is'.$this->name;
76
+                } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) {
77
+                    $getter = 'has'.$this->name;
78 78
                 } else {
79
-                    throw new RuntimeException(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));
79
+                    throw new RuntimeException(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));
80 80
                 }
81 81
             }
82 82
 
83
-            if (empty($setter) && !$this->readOnly) {
84
-                if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) {
85
-                    $setter = 'set' . $this->name;
83
+            if (empty($setter) && ! $this->readOnly) {
84
+                if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) {
85
+                    $setter = 'set'.$this->name;
86 86
                 } else {
87
-                    throw new RuntimeException(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));
87
+                    throw new RuntimeException(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));
88 88
                 }
89 89
             }
90 90
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
         parent::unserialize($parentStr);
201 201
 
202
-        $this->closureAccessor = \Closure::bind(function ($o, $name) {
202
+        $this->closureAccessor = \Closure::bind(function($o, $name) {
203 203
             return $o->$name;
204 204
         }, null, $this->class);
205 205
     }
Please login to merge, or discard this patch.
src/Builder/DefaultDriverFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 
23 23
     public function createDriver(array $metadataDirs, Reader $annotationReader)
24 24
     {
25
-        if (!empty($metadataDirs)) {
25
+        if ( ! empty($metadataDirs)) {
26 26
             $fileLocator = new FileLocator($metadataDirs);
27 27
 
28 28
             return new DriverChain(array(
Please login to merge, or discard this patch.
src/DeserializationGraphNavigator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
                 /** @var $metadata ClassMetadata */
148 148
                 $metadata = $this->metadataFactory->getMetadataForClass($type['name']);
149 149
 
150
-                if ($metadata->usingExpression && !$this->expressionExclusionStrategy) {
150
+                if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) {
151 151
                     throw new ExpressionLanguageRequiredException("To use conditional exclude/expose in {$metadata->name} you must configure the expression language.");
152 152
                 }
153 153
 
154
-                if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
154
+                if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
155 155
                     $metadata = $this->resolveMetadata($data, $metadata);
156 156
                 }
157 157
 
@@ -195,22 +195,22 @@  discard block
 block discarded – undo
195 195
     {
196 196
         switch (true) {
197 197
             case \is_array($data) && isset($data[$metadata->discriminatorFieldName]):
198
-                $typeValue = (string)$data[$metadata->discriminatorFieldName];
198
+                $typeValue = (string) $data[$metadata->discriminatorFieldName];
199 199
                 break;
200 200
 
201 201
             // Check XML attribute for discriminatorFieldName
202 202
             case \is_object($data) && $metadata->xmlDiscriminatorAttribute && isset($data[$metadata->discriminatorFieldName]):
203
-                $typeValue = (string)$data[$metadata->discriminatorFieldName];
203
+                $typeValue = (string) $data[$metadata->discriminatorFieldName];
204 204
                 break;
205 205
 
206 206
             // Check XML element with namespace for discriminatorFieldName
207
-            case \is_object($data) && !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
208
-                $typeValue = (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
207
+            case \is_object($data) && ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}):
208
+                $typeValue = (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName};
209 209
                 break;
210 210
 
211 211
             // Check XML element for discriminatorFieldName
212 212
             case \is_object($data) && isset($data->{$metadata->discriminatorFieldName}):
213
-                $typeValue = (string)$data->{$metadata->discriminatorFieldName};
213
+                $typeValue = (string) $data->{$metadata->discriminatorFieldName};
214 214
                 break;
215 215
 
216 216
             default:
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                 ));
222 222
         }
223 223
 
224
-        if (!isset($metadata->discriminatorMap[$typeValue])) {
224
+        if ( ! isset($metadata->discriminatorMap[$typeValue])) {
225 225
             throw new LogicException(sprintf(
226 226
                 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s',
227 227
                 $typeValue,
Please login to merge, or discard this patch.
src/EventDispatcher/LazyEventDispatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function __construct($container)
30 30
     {
31
-        if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) {
31
+        if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) {
32 32
             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)));
33 33
         }
34 34
 
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
         $listeners = parent::initializeListeners($eventName, $loweredClass, $format);
44 44
 
45 45
         foreach ($listeners as &$listener) {
46
-            if (!\is_array($listener) || !\is_string($listener[0])) {
46
+            if ( ! \is_array($listener) || ! \is_string($listener[0])) {
47 47
                 continue;
48 48
             }
49 49
 
50
-            if (!$this->container->has($listener[0])) {
50
+            if ( ! $this->container->has($listener[0])) {
51 51
                 continue;
52 52
             }
53 53
 
Please login to merge, or discard this patch.
src/Metadata/ClassMetadata.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function setAccessorOrder($order, array $customOrder = array())
93 93
     {
94
-        if (!in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) {
94
+        if ( ! in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) {
95 95
             throw new InvalidArgumentException(sprintf('The accessor order "%s" is invalid.', $order));
96 96
         }
97 97
 
98 98
         foreach ($customOrder as $name) {
99
-            if (!\is_string($name)) {
99
+            if ( ! \is_string($name)) {
100 100
                 throw new InvalidArgumentException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name)));
101 101
             }
102 102
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     public function merge(MergeableInterface $object)
134 134
     {
135
-        if (!$object instanceof ClassMetadata) {
135
+        if ( ! $object instanceof ClassMetadata) {
136 136
             throw new InvalidArgumentException('$object must be an instance of ClassMetadata.');
137 137
         }
138 138
         parent::merge($object);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
                 $this->discriminatorBaseClass,
157 157
                 $this->discriminatorBaseClass
158 158
             ));
159
-        } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) {
159
+        } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) {
160 160
             $this->discriminatorFieldName = $object->discriminatorFieldName;
161 161
             $this->discriminatorMap = $object->discriminatorMap;
162 162
         }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             $this->discriminatorBaseClass = $object->discriminatorBaseClass;
172 172
         }
173 173
 
174
-        if ($this->discriminatorMap && !$this->reflection->isAbstract()) {
174
+        if ($this->discriminatorMap && ! $this->reflection->isAbstract()) {
175 175
             if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) {
176 176
                 throw new LogicException(sprintf(
177 177
                     'The sub-class "%s" is not listed in the discriminator of the base class "%s".',
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             $this->discriminatorValue = $typeValue;
184 184
 
185 185
             if (isset($this->propertyMetadata[$this->discriminatorFieldName])
186
-                && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
186
+                && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
187 187
             ) {
188 188
                 throw new LogicException(sprintf(
189 189
                     'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".',
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 
212 212
     public function registerNamespace($uri, $prefix = null)
213 213
     {
214
-        if (!\is_string($uri)) {
214
+        if ( ! \is_string($uri)) {
215 215
             throw new InvalidArgumentException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri)));
216 216
         }
217 217
 
218 218
         if ($prefix !== null) {
219
-            if (!\is_string($prefix)) {
219
+            if ( ! \is_string($prefix)) {
220 220
                 throw new InvalidArgumentException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix)));
221 221
             }
222 222
         } else {
@@ -309,19 +309,19 @@  discard block
 block discarded – undo
309 309
             case self::ACCESSOR_ORDER_CUSTOM:
310 310
                 $order = $this->customOrder;
311 311
                 $currentSorting = $this->propertyMetadata ? array_combine(array_keys($this->propertyMetadata), range(1, \count($this->propertyMetadata))) : [];
312
-                uksort($this->propertyMetadata, function ($a, $b) use ($order, $currentSorting) {
312
+                uksort($this->propertyMetadata, function($a, $b) use ($order, $currentSorting) {
313 313
                     $existsA = isset($order[$a]);
314 314
                     $existsB = isset($order[$b]);
315 315
 
316
-                    if (!$existsA && !$existsB) {
316
+                    if ( ! $existsA && ! $existsB) {
317 317
                         return $currentSorting[$a] - $currentSorting[$b];
318 318
                     }
319 319
 
320
-                    if (!$existsA) {
320
+                    if ( ! $existsA) {
321 321
                         return 1;
322 322
                     }
323 323
 
324
-                    if (!$existsB) {
324
+                    if ( ! $existsB) {
325 325
                         return -1;
326 326
                     }
327 327
 
Please login to merge, or discard this patch.
src/Handler/LazyHandlerRegistry.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
 
30 30
     public function __construct($container, array $handlers = array())
31 31
     {
32
-        if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) {
32
+        if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) {
33 33
             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)));
34 34
         }
35 35
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             return $this->initializedHandlers[$direction][$typeName][$format];
50 50
         }
51 51
 
52
-        if (!isset($this->handlers[$direction][$typeName][$format])) {
52
+        if ( ! isset($this->handlers[$direction][$typeName][$format])) {
53 53
             return null;
54 54
         }
55 55
 
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
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     private function assertMutable(): void
134 134
     {
135
-        if (!$this->initialized) {
135
+        if ( ! $this->initialized) {
136 136
             return;
137 137
         }
138 138
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
             throw new LogicException('The groups must not be empty.');
170 170
         }
171 171
 
172
-        $this->attributes['groups'] = (array)$groups;
173
-        $this->addExclusionStrategy(new GroupsExclusionStrategy((array)$groups));
172
+        $this->attributes['groups'] = (array) $groups;
173
+        $this->addExclusionStrategy(new GroupsExclusionStrategy((array) $groups));
174 174
 
175 175
         return $this;
176 176
     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $metadata = $this->metadataStack->pop();
229 229
 
230
-        if (!$metadata instanceof PropertyMetadata) {
230
+        if ( ! $metadata instanceof PropertyMetadata) {
231 231
             throw new RuntimeException('Context metadataStack not working well');
232 232
         }
233 233
     }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     {
237 237
         $metadata = $this->metadataStack->pop();
238 238
 
239
-        if (!$metadata instanceof ClassMetadata) {
239
+        if ( ! $metadata instanceof ClassMetadata) {
240 240
             throw new RuntimeException('Context metadataStack not working well');
241 241
         }
242 242
     }
Please login to merge, or discard this patch.
src/VisitorFactory/JsonSerializationVisitorFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 
43 43
     public function setOptions(int $options): self
44 44
     {
45
-        $this->options = (integer)$options;
45
+        $this->options = (integer) $options;
46 46
         return $this;
47 47
     }
48 48
 }
Please login to merge, or discard this patch.