Passed
Branch master (bf85d9)
by Johannes
05:40
created
src/Handler/HandlerRegistry.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 
36 36
         switch ($direction) {
37 37
             case GraphNavigatorInterface::DIRECTION_DESERIALIZATION:
38
-                return 'deserialize' . $type . 'From' . $format;
38
+                return 'deserialize'.$type.'From'.$format;
39 39
 
40 40
             case GraphNavigatorInterface::DIRECTION_SERIALIZATION:
41
-                return 'serialize' . $type . 'To' . $format;
41
+                return 'serialize'.$type.'To'.$format;
42 42
 
43 43
             default:
44 44
                 throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigatorInterface::DIRECTION_??? constants.', json_encode($direction)));
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function registerSubscribingHandler(SubscribingHandlerInterface $handler):void
54 54
     {
55 55
         foreach ($handler->getSubscribingMethods() as $methodData) {
56
-            if (!isset($methodData['type'], $methodData['format'])) {
56
+            if ( ! isset($methodData['type'], $methodData['format'])) {
57 57
                 throw new RuntimeException(sprintf('For each subscribing method a "type" and "format" attribute must be given, but only got "%s" for %s.', implode('" and "', array_keys($methodData)), \get_class($handler)));
58 58
             }
59 59
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     public function getHandler(int $direction, string $typeName, string $format)
82 82
     {
83
-        if (!isset($this->handlers[$direction][$typeName][$format])) {
83
+        if ( ! isset($this->handlers[$direction][$typeName][$format])) {
84 84
             return null;
85 85
         }
86 86
 
Please login to merge, or discard this patch.
src/JsonDeserializationVisitor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -50,32 +50,32 @@  discard block
 block discarded – undo
50 50
 
51 51
     public function visitString($data, array $type): string
52 52
     {
53
-        return (string)$data;
53
+        return (string) $data;
54 54
     }
55 55
 
56 56
     public function visitBoolean($data, array $type): bool
57 57
     {
58
-        return (bool)$data;
58
+        return (bool) $data;
59 59
     }
60 60
 
61 61
     public function visitInteger($data, array $type): int
62 62
     {
63
-        return (int)$data;
63
+        return (int) $data;
64 64
     }
65 65
 
66 66
     public function visitDouble($data, array $type): float
67 67
     {
68
-        return (double)$data;
68
+        return (double) $data;
69 69
     }
70 70
 
71 71
     public function visitArray($data, array $type): array
72 72
     {
73
-        if (!\is_array($data)) {
73
+        if ( ! \is_array($data)) {
74 74
             throw new RuntimeException(sprintf('Expected array, but got %s: %s', \gettype($data), json_encode($data)));
75 75
         }
76 76
 
77 77
         // If no further parameters were given, keys/values are just passed as is.
78
-        if (!$type['params']) {
78
+        if ( ! $type['params']) {
79 79
             return $data;
80 80
         }
81 81
 
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
             return;
121 121
         }
122 122
 
123
-        if (!\is_array($data)) {
123
+        if ( ! \is_array($data)) {
124 124
             throw new RuntimeException(sprintf('Invalid data "%s"(%s), expected "%s".', $data, $metadata->type['name'], $metadata->reflection->class));
125 125
         }
126 126
 
127
-        if (!array_key_exists($name, $data)) {
127
+        if ( ! array_key_exists($name, $data)) {
128 128
             return;
129 129
         }
130 130
 
131
-        if (!$metadata->type) {
131
+        if ( ! $metadata->type) {
132 132
             throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name));
133 133
         }
134 134
 
Please login to merge, or discard this patch.
src/JsonSerializationVisitor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
         $rs = isset($type['params'][1]) ? new \ArrayObject() : array();
87 87
 
88
-        $isList = isset($type['params'][0]) && !isset($type['params'][1]);
88
+        $isList = isset($type['params'][0]) && ! isset($type['params'][1]);
89 89
 
90 90
         $elType = $this->getElementType($type);
91 91
         foreach ($data as $k => $v) {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
         if ($metadata->inline) {
152 152
             if (\is_array($v) || ($v instanceof \ArrayObject)) {
153
-                $this->data = array_merge($this->data, (array)$v);
153
+                $this->data = array_merge($this->data, (array) $v);
154 154
             }
155 155
         } else {
156 156
             $this->data[$metadata->serializedName] = $v;
Please login to merge, or discard this patch.
src/SerializerBuilder.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
     private function getAccessorStrategy()
117 117
     {
118
-        if (!$this->accessorStrategy) {
118
+        if ( ! $this->accessorStrategy) {
119 119
             $this->accessorStrategy = new DefaultAccessorStrategy();
120 120
 
121 121
             if ($this->expressionEvaluator) {
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
 
149 149
     public function setDebug($bool)
150 150
     {
151
-        $this->debug = (boolean)$bool;
151
+        $this->debug = (boolean) $bool;
152 152
 
153 153
         return $this;
154 154
     }
155 155
 
156 156
     public function setCacheDir($dir)
157 157
     {
158
-        if (!is_dir($dir)) {
158
+        if ( ! is_dir($dir)) {
159 159
             $this->createDir($dir);
160 160
         }
161
-        if (!is_writable($dir)) {
161
+        if ( ! is_writable($dir)) {
162 162
             throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir));
163 163
         }
164 164
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function includeInterfaceMetadata($include)
262 262
     {
263
-        $this->includeInterfaceMetadata = (Boolean)$include;
263
+        $this->includeInterfaceMetadata = (Boolean) $include;
264 264
 
265 265
         return $this;
266 266
     }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     public function setMetadataDirs(array $namespacePrefixToDirMap)
280 280
     {
281 281
         foreach ($namespacePrefixToDirMap as $dir) {
282
-            if (!is_dir($dir)) {
282
+            if ( ! is_dir($dir)) {
283 283
                 throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir));
284 284
             }
285 285
         }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
      */
318 318
     public function addMetadataDir($dir, $namespacePrefix = '')
319 319
     {
320
-        if (!is_dir($dir)) {
320
+        if ( ! is_dir($dir)) {
321 321
             throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir));
322 322
         }
323 323
 
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
      */
360 360
     public function replaceMetadataDir($dir, $namespacePrefix = '')
361 361
     {
362
-        if (!is_dir($dir)) {
362
+        if ( ! is_dir($dir)) {
363 363
             throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir));
364 364
         }
365 365
 
366
-        if (!isset($this->metadataDirs[$namespacePrefix])) {
366
+        if ( ! isset($this->metadataDirs[$namespacePrefix])) {
367 367
             throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix));
368 368
         }
369 369
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
             $annotationReader = new AnnotationReader();
427 427
 
428 428
             if (null !== $this->cacheDir) {
429
-                $this->createDir($this->cacheDir . '/annotations');
430
-                $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations');
429
+                $this->createDir($this->cacheDir.'/annotations');
430
+                $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations');
431 431
                 $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug);
432 432
             }
433 433
         }
@@ -443,19 +443,19 @@  discard block
 block discarded – undo
443 443
         $metadataFactory->setIncludeInterfaces($this->includeInterfaceMetadata);
444 444
 
445 445
         if (null !== $this->cacheDir) {
446
-            $this->createDir($this->cacheDir . '/metadata');
447
-            $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata'));
446
+            $this->createDir($this->cacheDir.'/metadata');
447
+            $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata'));
448 448
         }
449 449
 
450
-        if (!$this->handlersConfigured) {
450
+        if ( ! $this->handlersConfigured) {
451 451
             $this->addDefaultHandlers();
452 452
         }
453 453
 
454
-        if (!$this->listenersConfigured) {
454
+        if ( ! $this->listenersConfigured) {
455 455
             $this->addDefaultListeners();
456 456
         }
457 457
 
458
-        if (!$this->visitorsAdded) {
458
+        if ( ! $this->visitorsAdded) {
459 459
             $this->addDefaultSerializationVisitors();
460 460
             $this->addDefaultDeserializationVisitors();
461 461
         }
Please login to merge, or discard this patch.
src/XmlDeserializationVisitor.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         if (false !== stripos($data, '<!doctype')) {
63 63
             $internalSubset = $this->getDomDocumentTypeEntitySubset($data);
64
-            if (!in_array($internalSubset, $this->doctypeWhitelist, true)) {
64
+            if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) {
65 65
                 throw new InvalidArgumentException(sprintf(
66 66
                     'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.',
67 67
                     $internalSubset
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
     private function emptyStringToSpaceCharacter($data)
85 85
     {
86
-        return $data === '' ? ' ' : (string)$data;
86
+        return $data === '' ? ' ' : (string) $data;
87 87
     }
88 88
 
89 89
     public function visitNull($data, array $type): void
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
 
94 94
     public function visitString($data, array $type): string
95 95
     {
96
-        return (string)$data;
96
+        return (string) $data;
97 97
     }
98 98
 
99 99
     public function visitBoolean($data, array $type): bool
100 100
     {
101
-        $data = (string)$data;
101
+        $data = (string) $data;
102 102
 
103 103
         if ('true' === $data || '1' === $data) {
104 104
             return true;
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 
112 112
     public function visitInteger($data, array $type): int
113 113
     {
114
-        return (integer)$data;
114
+        return (integer) $data;
115 115
     }
116 116
 
117 117
     public function visitDouble($data, array $type): float
118 118
     {
119
-        return (double)$data;
119
+        return (double) $data;
120 120
     }
121 121
 
122 122
     public function visitArray($data, array $type): array
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             $nodes = $data->xpath($entryName);
162 162
         }
163 163
 
164
-        if (!\count($nodes)) {
164
+        if ( ! \count($nodes)) {
165 165
             return array();
166 166
         }
167 167
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                 $nodes = $data->children($namespace)->$entryName;
190 190
                 foreach ($nodes as $v) {
191 191
                     $attrs = $v->attributes();
192
-                    if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
192
+                    if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
193 193
                         throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute));
194 194
                     }
195 195
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     {
215 215
         $name = $metadata->serializedName;
216 216
 
217
-        if (!$metadata->type) {
217
+        if ( ! $metadata->type) {
218 218
             throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name));
219 219
         }
220 220
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
         if ($metadata->xmlCollection) {
240 240
             $enclosingElem = $data;
241
-            if (!$metadata->xmlCollectionInline) {
241
+            if ( ! $metadata->xmlCollectionInline) {
242 242
                 $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
243 243
             }
244 244
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
         if ($metadata->xmlNamespace) {
254 254
             $node = $data->children($metadata->xmlNamespace)->$name;
255
-            if (!$node->count()) {
255
+            if ( ! $node->count()) {
256 256
                 return;
257 257
             }
258 258
         } else {
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
             if (isset($namespaces[''])) {
263 263
                 $prefix = uniqid('ns-');
264 264
                 $data->registerXPathNamespace($prefix, $namespaces['']);
265
-                $nodes = $data->xpath('./' . $prefix . ':' . $name);
265
+                $nodes = $data->xpath('./'.$prefix.':'.$name);
266 266
             } else {
267
-                $nodes = $data->xpath('./' . $name);
267
+                $nodes = $data->xpath('./'.$name);
268 268
             }
269 269
             if (empty($nodes)) {
270 270
                 return;
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 
380 380
             $xsiAttributes = $value->attributes('http://www.w3.org/2001/XMLSchema-instance');
381 381
             if (isset($xsiAttributes['nil'])
382
-                && ((string)$xsiAttributes['nil'] === 'true' || (string)$xsiAttributes['nil'] === '1')
382
+                && ((string) $xsiAttributes['nil'] === 'true' || (string) $xsiAttributes['nil'] === '1')
383 383
             ) {
384 384
                 return true;
385 385
             }
Please login to merge, or discard this patch.