@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function visitString($data, array $type): string |
| 56 | 56 | { |
| 57 | - if (!\is_string($data)) { |
|
| 57 | + if ( ! \is_string($data)) { |
|
| 58 | 58 | throw new RuntimeException(sprintf('Expected string, but got %s: %s', \gettype($data), json_encode($data))); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function visitBoolean($data, array $type): bool |
| 68 | 68 | { |
| 69 | - if (!\is_bool($data)) { |
|
| 69 | + if ( ! \is_bool($data)) { |
|
| 70 | 70 | throw new RuntimeException(sprintf('Expected boolean, but got %s: %s', \gettype($data), json_encode($data))); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function visitInteger($data, array $type): int |
| 80 | 80 | { |
| 81 | - if (!\is_int($data)) { |
|
| 81 | + if ( ! \is_int($data)) { |
|
| 82 | 82 | throw new RuntimeException(sprintf('Expected boolean, but got %s: %s', \gettype($data), json_encode($data))); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function visitDouble($data, array $type): float |
| 92 | 92 | { |
| 93 | - if (!\is_float($data)) { |
|
| 93 | + if ( ! \is_float($data)) { |
|
| 94 | 94 | throw new RuntimeException(sprintf('Expected double, but got %s: %s', \gettype($data), json_encode($data))); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function visitArray($data, array $type): array |
| 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 | return $data; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -174,22 +174,22 @@ discard block |
||
| 174 | 174 | return; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if (!\is_array($data)) { |
|
| 177 | + if ( ! \is_array($data)) { |
|
| 178 | 178 | throw new RuntimeException(sprintf('Invalid data %s (%s), expected "%s".', json_encode($data), $metadata->type['name'], $metadata->class)); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | if (true === $metadata->inline) { |
| 182 | - if (!$metadata->type) { |
|
| 182 | + if ( ! $metadata->type) { |
|
| 183 | 183 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
| 184 | 184 | } |
| 185 | 185 | return $this->navigator->accept($data, $metadata->type); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - if (!array_key_exists($name, $data)) { |
|
| 188 | + if ( ! array_key_exists($name, $data)) { |
|
| 189 | 189 | throw new NotAcceptableException(); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - if (!$metadata->type) { |
|
| 192 | + if ( ! $metadata->type) { |
|
| 193 | 193 | throw RuntimeException::noMetadataForProperty($metadata->class, $metadata->name); |
| 194 | 194 | } |
| 195 | 195 | |