@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | // Locate possible ObjectManager |
64 | 64 | $objectManager = $this->managerRegistry->getManagerForClass($metadata->name); |
65 | 65 | |
66 | - if (!$objectManager) { |
|
66 | + if ( ! $objectManager) { |
|
67 | 67 | // No ObjectManager found, proceed with normal deserialization |
68 | 68 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
69 | 69 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | // Managed entity, check for proxy load |
80 | - if (!\is_array($data)) { |
|
80 | + if ( ! \is_array($data)) { |
|
81 | 81 | // Single identifier, load proxy |
82 | 82 | return $objectManager->getReference($metadata->name, $data); |
83 | 83 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $identifierList = array(); |
88 | 88 | |
89 | 89 | foreach ($classMetadata->getIdentifierFieldNames() as $name) { |
90 | - if (!array_key_exists($name, $data)) { |
|
90 | + if ( ! array_key_exists($name, $data)) { |
|
91 | 91 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
92 | 92 | } |
93 | 93 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | public function __construct(array $values) |
32 | 32 | { |
33 | - if (!isset($values['value']) || !\is_string($values['value'])) { |
|
33 | + if ( ! isset($values['value']) || ! \is_string($values['value'])) { |
|
34 | 34 | throw new RuntimeException(sprintf('"value" must be a string.')); |
35 | 35 | } |
36 | 36 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | public function __construct(array $values) |
35 | 35 | { |
36 | - if (!\is_string($values['value'])) { |
|
36 | + if ( ! \is_string($values['value'])) { |
|
37 | 37 | throw new RuntimeException('"value" must be a string.'); |
38 | 38 | } |
39 | 39 |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | |
35 | 35 | switch ($direction) { |
36 | 36 | case GraphNavigator::DIRECTION_DESERIALIZATION: |
37 | - return 'deserialize' . $type . 'From' . $format; |
|
37 | + return 'deserialize'.$type.'From'.$format; |
|
38 | 38 | |
39 | 39 | case GraphNavigator::DIRECTION_SERIALIZATION: |
40 | - return 'serialize' . $type . 'To' . $format; |
|
40 | + return 'serialize'.$type.'To'.$format; |
|
41 | 41 | |
42 | 42 | default: |
43 | 43 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigator::DIRECTION_??? constants.', json_encode($direction))); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler) |
53 | 53 | { |
54 | 54 | foreach ($handler->getSubscribingMethods() as $methodData) { |
55 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
55 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
56 | 56 | 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))); |
57 | 57 | } |
58 | 58 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function getHandler($direction, $typeName, $format) |
81 | 81 | { |
82 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
82 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
83 | 83 | return null; |
84 | 84 | } |
85 | 85 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function __construct($container, array $handlers = array()) |
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 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | return $this->initializedHandlers[$direction][$typeName][$format]; |
49 | 49 | } |
50 | 50 | |
51 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
51 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
52 | 52 | return null; |
53 | 53 | } |
54 | 54 |
@@ -64,13 +64,13 @@ |
||
64 | 64 | */ |
65 | 65 | public function evaluate($expression, array $data = array()) |
66 | 66 | { |
67 | - if (!\is_string($expression)) { |
|
67 | + if ( ! \is_string($expression)) { |
|
68 | 68 | return $expression; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $context = $data + $this->context; |
72 | 72 | |
73 | - if (!array_key_exists($expression, $this->cache)) { |
|
73 | + if ( ! array_key_exists($expression, $this->cache)) { |
|
74 | 74 | $this->cache[$expression] = $this->expressionLanguage->parse($expression, array_keys($context)); |
75 | 75 | } |
76 | 76 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function visitString($data, array $type, Context $context) |
60 | 60 | { |
61 | - $data = (string)$data; |
|
61 | + $data = (string) $data; |
|
62 | 62 | |
63 | 63 | if (null === $this->result) { |
64 | 64 | $this->result = $data; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | public function visitBoolean($data, array $type, Context $context) |
71 | 71 | { |
72 | - $data = (Boolean)$data; |
|
72 | + $data = (Boolean) $data; |
|
73 | 73 | |
74 | 74 | if (null === $this->result) { |
75 | 75 | $this->result = $data; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function visitInteger($data, array $type, Context $context) |
82 | 82 | { |
83 | - $data = (integer)$data; |
|
83 | + $data = (integer) $data; |
|
84 | 84 | |
85 | 85 | if (null === $this->result) { |
86 | 86 | $this->result = $data; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | public function visitDouble($data, array $type, Context $context) |
93 | 93 | { |
94 | - $data = (double)$data; |
|
94 | + $data = (double) $data; |
|
95 | 95 | |
96 | 96 | if (null === $this->result) { |
97 | 97 | $this->result = $data; |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | |
103 | 103 | public function visitArray($data, array $type, Context $context) |
104 | 104 | { |
105 | - if (!\is_array($data)) { |
|
105 | + if ( ! \is_array($data)) { |
|
106 | 106 | throw new RuntimeException(sprintf('Expected array, but got %s: %s', \gettype($data), json_encode($data))); |
107 | 107 | } |
108 | 108 | |
109 | 109 | // If no further parameters were given, keys/values are just passed as is. |
110 | - if (!$type['params']) { |
|
110 | + if ( ! $type['params']) { |
|
111 | 111 | if (null === $this->result) { |
112 | 112 | $this->result = $data; |
113 | 113 | } |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | - if (!\is_array($data)) { |
|
169 | + if ( ! \is_array($data)) { |
|
170 | 170 | throw new RuntimeException(sprintf('Invalid data "%s"(%s), expected "%s".', $data, $metadata->type['name'], $metadata->reflection->class)); |
171 | 171 | } |
172 | 172 | |
173 | - if (!array_key_exists($name, $data)) { |
|
173 | + if ( ! array_key_exists($name, $data)) { |
|
174 | 174 | return; |
175 | 175 | } |
176 | 176 | |
177 | - if (!$metadata->type) { |
|
177 | + if ( ! $metadata->type) { |
|
178 | 178 | throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name)); |
179 | 179 | } |
180 | 180 |
@@ -22,7 +22,6 @@ |
||
22 | 22 | use JMS\Serializer\Metadata\ClassMetadata; |
23 | 23 | use JMS\Serializer\Metadata\PropertyMetadata; |
24 | 24 | use JMS\Serializer\Naming\AdvancedNamingStrategyInterface; |
25 | -use JMS\Serializer\Naming\PropertyNamingStrategyInterface; |
|
26 | 25 | |
27 | 26 | /** |
28 | 27 | * Generic Deserialization Visitor. |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function writeln($content) |
63 | 63 | { |
64 | - $this->write($content . "\n"); |
|
64 | + $this->write($content."\n"); |
|
65 | 65 | |
66 | 66 | return $this; |
67 | 67 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $lines = explode("\n", $content); |
86 | 86 | for ($i = 0, $c = \count($lines); $i < $c; $i++) { |
87 | 87 | if ($this->indentationLevel > 0 |
88 | - && !empty($lines[$i]) |
|
88 | + && ! empty($lines[$i]) |
|
89 | 89 | && ((empty($addition) && "\n" === substr($this->content, -1)) || "\n" === substr($addition, -1)) |
90 | 90 | ) { |
91 | 91 | $addition .= str_repeat(' ', $this->indentationLevel * $this->indentationSpaces); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function rtrim($preserveNewLines = true) |
109 | 109 | { |
110 | - if (!$preserveNewLines) { |
|
110 | + if ( ! $preserveNewLines) { |
|
111 | 111 | $this->content = rtrim($this->content); |
112 | 112 | |
113 | 113 | return $this; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $isHash = isset($type['params'][1]); |
86 | 86 | |
87 | 87 | $count = $this->writer->changeCount; |
88 | - $isList = (isset($type['params'][0]) && !isset($type['params'][1])) |
|
88 | + $isList = (isset($type['params'][0]) && ! isset($type['params'][1])) |
|
89 | 89 | || array_keys($data) === range(0, \count($data) - 1); |
90 | 90 | |
91 | 91 | foreach ($data as $k => $v) { |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | continue; |
94 | 94 | } |
95 | 95 | |
96 | - if ($isList && !$isHash) { |
|
96 | + if ($isList && ! $isHash) { |
|
97 | 97 | $this->writer->writeln('-'); |
98 | 98 | } else { |
99 | - $this->writer->writeln(Inline::dump($k) . ':'); |
|
99 | + $this->writer->writeln(Inline::dump($k).':'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $this->writer->indent(); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if (null !== $v = $this->navigator->accept($v, $this->getElementType($type), $context)) { |
105 | 105 | $this->writer |
106 | 106 | ->rtrim(false) |
107 | - ->writeln(' ' . $v); |
|
107 | + ->writeln(' '.$v); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $this->writer->outdent(); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | public function visitDouble($data, array $type, Context $context) |
136 | 136 | { |
137 | - $v = (string)$data; |
|
137 | + $v = (string) $data; |
|
138 | 138 | |
139 | 139 | if ('' === $this->writer->content) { |
140 | 140 | $this->writer->writeln($v); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | public function visitInteger($data, array $type, Context $context) |
147 | 147 | { |
148 | - $v = (string)$data; |
|
148 | + $v = (string) $data; |
|
149 | 149 | |
150 | 150 | if ('' === $this->writer->content) { |
151 | 151 | $this->writer->writeln($v); |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | $name = $this->namingStrategy->translateName($metadata); |
173 | 173 | } |
174 | 174 | |
175 | - if (!$metadata->inline) { |
|
175 | + if ( ! $metadata->inline) { |
|
176 | 176 | $this->writer |
177 | - ->writeln(Inline::dump($name) . ':') |
|
177 | + ->writeln(Inline::dump($name).':') |
|
178 | 178 | ->indent(); |
179 | 179 | } |
180 | 180 | |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | if (null !== $v = $this->navigator->accept($v, $metadata->type, $context)) { |
186 | 186 | $this->writer |
187 | 187 | ->rtrim(false) |
188 | - ->writeln(' ' . $v); |
|
189 | - } elseif ($count === $this->writer->changeCount && !$metadata->inline) { |
|
188 | + ->writeln(' '.$v); |
|
189 | + } elseif ($count === $this->writer->changeCount && ! $metadata->inline) { |
|
190 | 190 | $this->writer->revert(); |
191 | 191 | } |
192 | 192 | |
193 | - if (!$metadata->inline) { |
|
193 | + if ( ! $metadata->inline) { |
|
194 | 194 | $this->writer->outdent(); |
195 | 195 | } |
196 | 196 | $this->revertCurrentMetadata(); |