@@ -53,7 +53,7 @@ |
||
53 | 53 | $validator = $this->validator; |
54 | 54 | $groups = $context->hasAttribute('validation_groups') ? $context->getAttribute('validation_groups') : null; |
55 | 55 | |
56 | - if (!$groups) { |
|
56 | + if ( ! $groups) { |
|
57 | 57 | return; |
58 | 58 | } |
59 | 59 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | public function enableExternalEntities(bool $enable = true): self |
42 | 42 | { |
43 | - $this->disableExternalEntities = !$enable; |
|
43 | + $this->disableExternalEntities = ! $enable; |
|
44 | 44 | return $this; |
45 | 45 | } |
46 | 46 |
@@ -40,19 +40,19 @@ |
||
40 | 40 | { |
41 | 41 | $currentSorting = $properties ? array_combine(array_keys($properties), range(1, \count($properties))) : []; |
42 | 42 | |
43 | - uksort($properties, function ($a, $b) use ($currentSorting) { |
|
43 | + uksort($properties, function($a, $b) use ($currentSorting) { |
|
44 | 44 | $existsA = isset($this->ordering[$a]); |
45 | 45 | $existsB = isset($this->ordering[$b]); |
46 | 46 | |
47 | - if (!$existsA && !$existsB) { |
|
47 | + if ( ! $existsA && ! $existsB) { |
|
48 | 48 | return $currentSorting[$a] - $currentSorting[$b]; |
49 | 49 | } |
50 | 50 | |
51 | - if (!$existsA) { |
|
51 | + if ( ! $existsA) { |
|
52 | 52 | return 1; |
53 | 53 | } |
54 | 54 | |
55 | - if (!$existsB) { |
|
55 | + if ( ! $existsB) { |
|
56 | 56 | return -1; |
57 | 57 | } |
58 | 58 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __construct($container) |
22 | 22 | { |
23 | - if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) { |
|
23 | + if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) { |
|
24 | 24 | 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))); |
25 | 25 | } |
26 | 26 | |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | $listeners = parent::initializeListeners($eventName, $loweredClass, $format); |
36 | 36 | |
37 | 37 | foreach ($listeners as &$listener) { |
38 | - if (!\is_array($listener[0]) || !\is_string($listener[0][0])) { |
|
38 | + if ( ! \is_array($listener[0]) || ! \is_string($listener[0][0])) { |
|
39 | 39 | continue; |
40 | 40 | } |
41 | 41 | |
42 | - if (!$this->container->has($listener[0][0])) { |
|
42 | + if ( ! $this->container->has($listener[0][0])) { |
|
43 | 43 | continue; |
44 | 44 | } |
45 | 45 |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function visitArray($data, array $type): array |
88 | 88 | { |
89 | - if (!\is_array($data)) { |
|
89 | + if ( ! \is_array($data)) { |
|
90 | 90 | throw new RuntimeException(sprintf('Expected array, but got %s: %s', \gettype($data), json_encode($data))); |
91 | 91 | } |
92 | 92 | |
93 | 93 | // If no further parameters were given, keys/values are just passed as is. |
94 | - if (!$type['params']) { |
|
94 | + if ( ! $type['params']) { |
|
95 | 95 | return $data; |
96 | 96 | } |
97 | 97 | |
@@ -158,22 +158,22 @@ discard block |
||
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - if (!\is_array($data)) { |
|
161 | + if ( ! \is_array($data)) { |
|
162 | 162 | throw new RuntimeException(sprintf('Invalid data %s (%s), expected "%s".', json_encode($data), $metadata->type['name'], $metadata->class)); |
163 | 163 | } |
164 | 164 | |
165 | 165 | if (true === $metadata->inline) { |
166 | - if (!$metadata->type) { |
|
166 | + if ( ! $metadata->type) { |
|
167 | 167 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
168 | 168 | } |
169 | 169 | return $this->navigator->accept($data, $metadata->type); |
170 | 170 | } |
171 | 171 | |
172 | - if (!array_key_exists($name, $data)) { |
|
172 | + if ( ! array_key_exists($name, $data)) { |
|
173 | 173 | throw new NotAcceptableException(); |
174 | 174 | } |
175 | 175 | |
176 | - if (!$metadata->type) { |
|
176 | + if ( ! $metadata->type) { |
|
177 | 177 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
178 | 178 | } |
179 | 179 |
@@ -153,7 +153,7 @@ |
||
153 | 153 | array $type, |
154 | 154 | DeserializationContext $context |
155 | 155 | ): Generator { |
156 | - return (static function () use (&$visitor, &$data, &$type): Generator { |
|
156 | + return (static function() use (&$visitor, &$data, &$type): Generator { |
|
157 | 157 | $type['name'] = 'array'; |
158 | 158 | yield from $visitor->visitArray($data, $type); |
159 | 159 | })(); |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | |
24 | 24 | switch ($direction) { |
25 | 25 | case GraphNavigatorInterface::DIRECTION_DESERIALIZATION: |
26 | - return 'deserialize' . $type . 'From' . $format; |
|
26 | + return 'deserialize'.$type.'From'.$format; |
|
27 | 27 | |
28 | 28 | case GraphNavigatorInterface::DIRECTION_SERIALIZATION: |
29 | - return 'serialize' . $type . 'To' . $format; |
|
29 | + return 'serialize'.$type.'To'.$format; |
|
30 | 30 | |
31 | 31 | default: |
32 | 32 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigatorInterface::DIRECTION_??? constants.', json_encode($direction))); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler): void |
42 | 42 | { |
43 | 43 | foreach ($handler->getSubscribingMethods() as $methodData) { |
44 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
44 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
45 | 45 | 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))); |
46 | 46 | } |
47 | 47 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function getHandler(int $direction, string $typeName, string $format) |
72 | 72 | { |
73 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
73 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
74 | 74 | return null; |
75 | 75 | } |
76 | 76 |
@@ -26,7 +26,7 @@ discard block |
||
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 |
||
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 |
@@ -114,7 +114,7 @@ discard block |
||
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 |
||
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 |
||
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), |