Completed
Pull Request — master (#888)
by Robert
02:57
created
src/JMS/Serializer/SerializerBuilder.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
     protected function getAccessorStrategy()
112 112
     {
113
-        if (!$this->accessorStrategy) {
113
+        if ( ! $this->accessorStrategy) {
114 114
             $this->accessorStrategy = new DefaultAccessorStrategy();
115 115
 
116 116
             if ($this->expressionEvaluator) {
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 
135 135
     public function setDebug($bool)
136 136
     {
137
-        $this->debug = (boolean)$bool;
137
+        $this->debug = (boolean) $bool;
138 138
 
139 139
         return $this;
140 140
     }
141 141
 
142 142
     public function setCacheDir($dir)
143 143
     {
144
-        if (!is_dir($dir)) {
144
+        if ( ! is_dir($dir)) {
145 145
             $this->createDir($dir);
146 146
         }
147
-        if (!is_writable($dir)) {
147
+        if ( ! is_writable($dir)) {
148 148
             throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir));
149 149
         }
150 150
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      */
252 252
     public function includeInterfaceMetadata($include)
253 253
     {
254
-        $this->includeInterfaceMetadata = (Boolean)$include;
254
+        $this->includeInterfaceMetadata = (Boolean) $include;
255 255
 
256 256
         return $this;
257 257
     }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     public function setMetadataDirs(array $namespacePrefixToDirMap)
271 271
     {
272 272
         foreach ($namespacePrefixToDirMap as $dir) {
273
-            if (!is_dir($dir)) {
273
+            if ( ! is_dir($dir)) {
274 274
                 throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir));
275 275
             }
276 276
         }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function addMetadataDir($dir, $namespacePrefix = '')
310 310
     {
311
-        if (!is_dir($dir)) {
311
+        if ( ! is_dir($dir)) {
312 312
             throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir));
313 313
         }
314 314
 
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
      */
351 351
     public function replaceMetadataDir($dir, $namespacePrefix = '')
352 352
     {
353
-        if (!is_dir($dir)) {
353
+        if ( ! is_dir($dir)) {
354 354
             throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir));
355 355
         }
356 356
 
357
-        if (!isset($this->metadataDirs[$namespacePrefix])) {
357
+        if ( ! isset($this->metadataDirs[$namespacePrefix])) {
358 358
             throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix));
359 359
         }
360 360
 
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
             $annotationReader = new AnnotationReader();
418 418
 
419 419
             if (null !== $this->cacheDir) {
420
-                $this->createDir($this->cacheDir . '/annotations');
421
-                $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations');
420
+                $this->createDir($this->cacheDir.'/annotations');
421
+                $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations');
422 422
                 $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug);
423 423
             }
424 424
         }
@@ -429,19 +429,19 @@  discard block
 block discarded – undo
429 429
         $metadataFactory->setIncludeInterfaces($this->includeInterfaceMetadata);
430 430
 
431 431
         if (null !== $this->cacheDir) {
432
-            $this->createDir($this->cacheDir . '/metadata');
433
-            $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata'));
432
+            $this->createDir($this->cacheDir.'/metadata');
433
+            $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata'));
434 434
         }
435 435
 
436
-        if (!$this->handlersConfigured) {
436
+        if ( ! $this->handlersConfigured) {
437 437
             $this->addDefaultHandlers();
438 438
         }
439 439
 
440
-        if (!$this->listenersConfigured) {
440
+        if ( ! $this->listenersConfigured) {
441 441
             $this->addDefaultListeners();
442 442
         }
443 443
 
444
-        if (!$this->visitorsAdded) {
444
+        if ( ! $this->visitorsAdded) {
445 445
             $this->addDefaultSerializationVisitors();
446 446
             $this->addDefaultDeserializationVisitors();
447 447
         }
Please login to merge, or discard this patch.
src/JMS/Serializer/Exclusion/GroupsExclusionStrategy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $groups = $this->getGroupsFor($navigatorContext);
54 54
 
55
-        if (!$property->groups) {
56
-            return !in_array(self::DEFAULT_GROUP, $groups);
55
+        if ( ! $property->groups) {
56
+            return ! in_array(self::DEFAULT_GROUP, $groups);
57 57
         }
58 58
 
59 59
         return $this->shouldSkipUsingGroups($property, $groups);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
         $groups = $this->groups;
78 78
         foreach ($paths as $index => $path) {
79
-            if (!array_key_exists($path, $groups)) {
79
+            if ( ! array_key_exists($path, $groups)) {
80 80
                 if ($index > 0) {
81 81
                     $groups = array(self::DEFAULT_GROUP);
82 82
                 }
Please login to merge, or discard this patch.
src/JMS/Serializer/Exclusion/DisjunctExclusionStrategy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     public function __construct($delegates)
43 43
     {
44
-        if (!$delegates instanceof SequenceInterface) {
44
+        if ( ! $delegates instanceof SequenceInterface) {
45 45
             $delegates = new Sequence($delegates);
46 46
         }
47 47
 
Please login to merge, or discard this patch.
src/JMS/Serializer/JsonSerializationVisitor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             $this->root = $data;
58 58
         }
59 59
 
60
-        return (string)$data;
60
+        return (string) $data;
61 61
     }
62 62
 
63 63
     public function visitBoolean($data, array $type, Context $context)
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             $this->root = $data;
67 67
         }
68 68
 
69
-        return (boolean)$data;
69
+        return (boolean) $data;
70 70
     }
71 71
 
72 72
     public function visitInteger($data, array $type, Context $context)
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             $this->root = $data;
76 76
         }
77 77
 
78
-        return (int)$data;
78
+        return (int) $data;
79 79
     }
80 80
 
81 81
     public function visitDouble($data, array $type, Context $context)
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             $this->root = $data;
85 85
         }
86 86
 
87
-        return (float)$data;
87
+        return (float) $data;
88 88
     }
89 89
 
90 90
     /**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             $rs = $isHash ? new \ArrayObject() : array();
107 107
         }
108 108
 
109
-        $isList = isset($type['params'][0]) && !isset($type['params'][1]);
109
+        $isList = isset($type['params'][0]) && ! isset($type['params'][1]);
110 110
 
111 111
         foreach ($data as $k => $v) {
112 112
             $v = $this->navigator->accept($v, $this->getElementType($type), $context);
@@ -251,6 +251,6 @@  discard block
 block discarded – undo
251 251
 
252 252
     public function setOptions($options)
253 253
     {
254
-        $this->options = (integer)$options;
254
+        $this->options = (integer) $options;
255 255
     }
256 256
 }
Please login to merge, or discard this patch.
src/JMS/Serializer/Naming/CamelCaseNamingStrategy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     public function translateName(PropertyMetadata $property)
43 43
     {
44
-        $name = preg_replace('/[A-Z]/', $this->separator . '\\0', $property->name);
44
+        $name = preg_replace('/[A-Z]/', $this->separator.'\\0', $property->name);
45 45
 
46 46
         if ($this->lowerCase) {
47 47
             return strtolower($name);
Please login to merge, or discard this patch.
src/JMS/Serializer/Context.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
     private function assertMutable()
116 116
     {
117
-        if (!$this->initialized) {
117
+        if ( ! $this->initialized) {
118 118
             return;
119 119
         }
120 120
 
@@ -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->set('groups', (array)$groups);
173
-        $this->addExclusionStrategy(new GroupsExclusionStrategy((array)$groups));
172
+        $this->attributes->set('groups', (array) $groups);
173
+        $this->addExclusionStrategy(new GroupsExclusionStrategy((array) $groups));
174 174
 
175 175
         return $this;
176 176
     }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      */
191 191
     public function setSerializeNull($bool)
192 192
     {
193
-        $this->serializeNull = (boolean)$bool;
193
+        $this->serializeNull = (boolean) $bool;
194 194
 
195 195
         return $this;
196 196
     }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     {
231 231
         $metadata = $this->metadataStack->pop();
232 232
 
233
-        if (!$metadata instanceof PropertyMetadata) {
233
+        if ( ! $metadata instanceof PropertyMetadata) {
234 234
             throw new RuntimeException('Context metadataStack not working well');
235 235
         }
236 236
     }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     {
240 240
         $metadata = $this->metadataStack->pop();
241 241
 
242
-        if (!$metadata instanceof ClassMetadata) {
242
+        if ( ! $metadata instanceof ClassMetadata) {
243 243
             throw new RuntimeException('Context metadataStack not working well');
244 244
         }
245 245
     }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      */
255 255
     public function getCurrentPath()
256 256
     {
257
-        if (!$this->metadataStack) {
257
+        if ( ! $this->metadataStack) {
258 258
             return array();
259 259
         }
260 260
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Handler/FormErrorHandler.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
     private function getErrorMessage(FormError $error)
123 123
     {
124 124
 
125
-        if ($this->translator === null){
125
+        if ($this->translator === null) {
126 126
             return $error->getMessage();
127 127
         }
128 128
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
     private function getErrorMessage(FormError $error)
123 123
     {
124 124
 
125
-        if ($this->translator === null){
125
+        if ($this->translator === null) {
126 126
             return $error->getMessage();
127 127
         }
128 128
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Metadata/ClassMetadata.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function setAccessorOrder($order, array $customOrder = array())
92 92
     {
93
-        if (!in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) {
93
+        if ( ! in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) {
94 94
             throw new InvalidArgumentException(sprintf('The accessor order "%s" is invalid.', $order));
95 95
         }
96 96
 
97 97
         foreach ($customOrder as $name) {
98
-            if (!\is_string($name)) {
98
+            if ( ! \is_string($name)) {
99 99
                 throw new InvalidArgumentException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name)));
100 100
             }
101 101
         }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
     public function merge(MergeableInterface $object)
143 143
     {
144
-        if (!$object instanceof ClassMetadata) {
144
+        if ( ! $object instanceof ClassMetadata) {
145 145
             throw new InvalidArgumentException('$object must be an instance of ClassMetadata.');
146 146
         }
147 147
         parent::merge($object);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                 $this->discriminatorBaseClass,
169 169
                 $this->discriminatorBaseClass
170 170
             ));
171
-        } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) {
171
+        } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) {
172 172
             $this->discriminatorFieldName = $object->discriminatorFieldName;
173 173
             $this->discriminatorMap = $object->discriminatorMap;
174 174
         }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             $this->discriminatorBaseClass = $object->discriminatorBaseClass;
184 184
         }
185 185
 
186
-        if ($this->discriminatorMap && !$this->reflection->isAbstract()) {
186
+        if ($this->discriminatorMap && ! $this->reflection->isAbstract()) {
187 187
             if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) {
188 188
                 throw new \LogicException(sprintf(
189 189
                     'The sub-class "%s" is not listed in the discriminator of the base class "%s".',
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $this->discriminatorValue = $typeValue;
196 196
 
197 197
             if (isset($this->propertyMetadata[$this->discriminatorFieldName])
198
-                && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
198
+                && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata
199 199
             ) {
200 200
                 throw new \LogicException(sprintf(
201 201
                     'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".',
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
 
224 224
     public function registerNamespace($uri, $prefix = null)
225 225
     {
226
-        if (!\is_string($uri)) {
226
+        if ( ! \is_string($uri)) {
227 227
             throw new InvalidArgumentException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri)));
228 228
         }
229 229
 
230 230
         if ($prefix !== null) {
231
-            if (!\is_string($prefix)) {
231
+            if ( ! \is_string($prefix)) {
232 232
                 throw new InvalidArgumentException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix)));
233 233
             }
234 234
         } else {
@@ -323,19 +323,19 @@  discard block
 block discarded – undo
323 323
             case self::ACCESSOR_ORDER_CUSTOM:
324 324
                 $order = $this->customOrder;
325 325
                 $currentSorting = $this->propertyMetadata ? array_combine(array_keys($this->propertyMetadata), range(1, \count($this->propertyMetadata))) : [];
326
-                uksort($this->propertyMetadata, function ($a, $b) use ($order, $currentSorting) {
326
+                uksort($this->propertyMetadata, function($a, $b) use ($order, $currentSorting) {
327 327
                     $existsA = isset($order[$a]);
328 328
                     $existsB = isset($order[$b]);
329 329
 
330
-                    if (!$existsA && !$existsB) {
330
+                    if ( ! $existsA && ! $existsB) {
331 331
                         return $currentSorting[$a] - $currentSorting[$b];
332 332
                     }
333 333
 
334
-                    if (!$existsA) {
334
+                    if ( ! $existsA) {
335 335
                         return 1;
336 336
                     }
337 337
 
338
-                    if (!$existsB) {
338
+                    if ( ! $existsB) {
339 339
                         return -1;
340 340
                     }
341 341
 
Please login to merge, or discard this patch.
src/JMS/Serializer/EventDispatcher/LazyEventDispatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function __construct($container)
29 29
     {
30
-        if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) {
30
+        if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) {
31 31
             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)));
32 32
         }
33 33
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
         $listeners = parent::initializeListeners($eventName, $loweredClass, $format);
43 43
 
44 44
         foreach ($listeners as &$listener) {
45
-            if (!\is_array($listener) || !\is_string($listener[0])) {
45
+            if ( ! \is_array($listener) || ! \is_string($listener[0])) {
46 46
                 continue;
47 47
             }
48 48
 
49
-            if (!$this->container->has($listener[0])) {
49
+            if ( ! $this->container->has($listener[0])) {
50 50
                 continue;
51 51
             }
52 52
 
Please login to merge, or discard this patch.