@@ -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 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
| 27 | 27 | 'type' => $type, |
| 28 | 28 | 'format' => $format, |
| 29 | - 'method' => $method . 'To' . $format, |
|
| 29 | + 'method' => $method.'To'.$format, |
|
| 30 | 30 | ]; |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function serializeListToXml(XmlSerializationVisitor $visitor, ConstraintViolationList $list, array $type): void |
| 38 | 38 | { |
| 39 | 39 | $currentNode = $visitor->getCurrentNode(); |
| 40 | - if (!$currentNode) { |
|
| 40 | + if ( ! $currentNode) { |
|
| 41 | 41 | $visitor->createRoot(); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $violationNode = $visitor->getDocument()->createElement('violation'); |
| 57 | 57 | |
| 58 | 58 | $parent = $visitor->getCurrentNode(); |
| 59 | - if (!$parent) { |
|
| 59 | + if ( ! $parent) { |
|
| 60 | 60 | $visitor->setCurrentAndRootNode($violationNode); |
| 61 | 61 | } else { |
| 62 | 62 | $parent->appendChild($violationNode); |
@@ -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 | })(); |
@@ -157,22 +157,22 @@ discard block |
||
| 157 | 157 | $class = $this->getReflection()->getDeclaringClass(); |
| 158 | 158 | |
| 159 | 159 | if (empty($getter)) { |
| 160 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
| 161 | - $getter = 'get' . $this->name; |
|
| 162 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
| 163 | - $getter = 'is' . $this->name; |
|
| 164 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
| 165 | - $getter = 'has' . $this->name; |
|
| 160 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
| 161 | + $getter = 'get'.$this->name; |
|
| 162 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
| 163 | + $getter = 'is'.$this->name; |
|
| 164 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
| 165 | + $getter = 'has'.$this->name; |
|
| 166 | 166 | } else { |
| 167 | - throw new InvalidMetadataException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get' . ucfirst($this->name), 'is' . ucfirst($this->name), 'has' . ucfirst($this->name), $this->class, $this->name)); |
|
| 167 | + throw new InvalidMetadataException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get'.ucfirst($this->name), 'is'.ucfirst($this->name), 'has'.ucfirst($this->name), $this->class, $this->name)); |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if (empty($setter) && !$this->readOnly) { |
|
| 172 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
| 173 | - $setter = 'set' . $this->name; |
|
| 171 | + if (empty($setter) && ! $this->readOnly) { |
|
| 172 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
| 173 | + $setter = 'set'.$this->name; |
|
| 174 | 174 | } else { |
| 175 | - throw new InvalidMetadataException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set' . ucfirst($this->name), $this->class, $this->name)); |
|
| 175 | + throw new InvalidMetadataException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set'.ucfirst($this->name), $this->class, $this->name)); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | return is_array($type) |
| 192 | 192 | && 'array' === $type['name'] |
| 193 | 193 | && isset($type['params'][0]) |
| 194 | - && !isset($type['params'][1]); |
|
| 194 | + && ! isset($type['params'][1]); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | public static function isCollectionMap(?array $type = null): bool |
@@ -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), |