@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | private function assertMutable() |
| 116 | 116 | { |
| 117 | - if (!$this->initialized) { |
|
| 117 | + if ( ! $this->initialized) { |
|
| 118 | 118 | return; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | throw new \LogicException('The groups must not be empty.'); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $this->attributes->set('groups', (array)$groups); |
|
| 173 | - $this->addExclusionStrategy(new GroupsExclusionStrategy((array)$groups)); |
|
| 172 | + $this->attributes->set('groups', (array) $groups); |
|
| 173 | + $this->addExclusionStrategy(new GroupsExclusionStrategy((array) $groups)); |
|
| 174 | 174 | |
| 175 | 175 | return $this; |
| 176 | 176 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function setSerializeNull($bool) |
| 192 | 192 | { |
| 193 | - $this->serializeNull = (boolean)$bool; |
|
| 193 | + $this->serializeNull = (boolean) $bool; |
|
| 194 | 194 | |
| 195 | 195 | return $this; |
| 196 | 196 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | { |
| 231 | 231 | $metadata = $this->metadataStack->pop(); |
| 232 | 232 | |
| 233 | - if (!$metadata instanceof PropertyMetadata) { |
|
| 233 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
| 234 | 234 | throw new RuntimeException('Context metadataStack not working well'); |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | { |
| 240 | 240 | $metadata = $this->metadataStack->pop(); |
| 241 | 241 | |
| 242 | - if (!$metadata instanceof ClassMetadata) { |
|
| 242 | + if ( ! $metadata instanceof ClassMetadata) { |
|
| 243 | 243 | throw new RuntimeException('Context metadataStack not working well'); |
| 244 | 244 | } |
| 245 | 245 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function getCurrentPath() |
| 256 | 256 | { |
| 257 | - if (!$this->metadataStack) { |
|
| 257 | + if ( ! $this->metadataStack) { |
|
| 258 | 258 | return array(); |
| 259 | 259 | } |
| 260 | 260 | |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | private function getErrorMessage(FormError $error) |
| 123 | 123 | { |
| 124 | 124 | |
| 125 | - if ($this->translator === null){ |
|
| 125 | + if ($this->translator === null) { |
|
| 126 | 126 | return $error->getMessage(); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function setAccessorOrder($order, array $customOrder = array()) |
| 92 | 92 | { |
| 93 | - if (!in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) { |
|
| 93 | + if ( ! in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) { |
|
| 94 | 94 | throw new InvalidArgumentException(sprintf('The accessor order "%s" is invalid.', $order)); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | foreach ($customOrder as $name) { |
| 98 | - if (!\is_string($name)) { |
|
| 98 | + if ( ! \is_string($name)) { |
|
| 99 | 99 | throw new InvalidArgumentException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name))); |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | public function merge(MergeableInterface $object) |
| 143 | 143 | { |
| 144 | - if (!$object instanceof ClassMetadata) { |
|
| 144 | + if ( ! $object instanceof ClassMetadata) { |
|
| 145 | 145 | throw new InvalidArgumentException('$object must be an instance of ClassMetadata.'); |
| 146 | 146 | } |
| 147 | 147 | parent::merge($object); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $this->discriminatorBaseClass, |
| 169 | 169 | $this->discriminatorBaseClass |
| 170 | 170 | )); |
| 171 | - } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 171 | + } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 172 | 172 | $this->discriminatorFieldName = $object->discriminatorFieldName; |
| 173 | 173 | $this->discriminatorMap = $object->discriminatorMap; |
| 174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $this->discriminatorBaseClass = $object->discriminatorBaseClass; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if ($this->discriminatorMap && !$this->reflection->isAbstract()) { |
|
| 186 | + if ($this->discriminatorMap && ! $this->reflection->isAbstract()) { |
|
| 187 | 187 | if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) { |
| 188 | 188 | throw new \LogicException(sprintf( |
| 189 | 189 | 'The sub-class "%s" is not listed in the discriminator of the base class "%s".', |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $this->discriminatorValue = $typeValue; |
| 196 | 196 | |
| 197 | 197 | if (isset($this->propertyMetadata[$this->discriminatorFieldName]) |
| 198 | - && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 198 | + && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 199 | 199 | ) { |
| 200 | 200 | throw new \LogicException(sprintf( |
| 201 | 201 | 'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".', |
@@ -223,12 +223,12 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | public function registerNamespace($uri, $prefix = null) |
| 225 | 225 | { |
| 226 | - if (!\is_string($uri)) { |
|
| 226 | + if ( ! \is_string($uri)) { |
|
| 227 | 227 | throw new InvalidArgumentException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri))); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if ($prefix !== null) { |
| 231 | - if (!\is_string($prefix)) { |
|
| 231 | + if ( ! \is_string($prefix)) { |
|
| 232 | 232 | throw new InvalidArgumentException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix))); |
| 233 | 233 | } |
| 234 | 234 | } else { |
@@ -323,19 +323,19 @@ discard block |
||
| 323 | 323 | case self::ACCESSOR_ORDER_CUSTOM: |
| 324 | 324 | $order = $this->customOrder; |
| 325 | 325 | $currentSorting = $this->propertyMetadata ? array_combine(array_keys($this->propertyMetadata), range(1, \count($this->propertyMetadata))) : []; |
| 326 | - uksort($this->propertyMetadata, function ($a, $b) use ($order, $currentSorting) { |
|
| 326 | + uksort($this->propertyMetadata, function($a, $b) use ($order, $currentSorting) { |
|
| 327 | 327 | $existsA = isset($order[$a]); |
| 328 | 328 | $existsB = isset($order[$b]); |
| 329 | 329 | |
| 330 | - if (!$existsA && !$existsB) { |
|
| 330 | + if ( ! $existsA && ! $existsB) { |
|
| 331 | 331 | return $currentSorting[$a] - $currentSorting[$b]; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if (!$existsA) { |
|
| 334 | + if ( ! $existsA) { |
|
| 335 | 335 | return 1; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if (!$existsB) { |
|
| 338 | + if ( ! $existsB) { |
|
| 339 | 339 | return -1; |
| 340 | 340 | } |
| 341 | 341 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function __construct($container) |
| 29 | 29 | { |
| 30 | - if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) { |
|
| 30 | + if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) { |
|
| 31 | 31 | 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))); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | $listeners = parent::initializeListeners($eventName, $loweredClass, $format); |
| 43 | 43 | |
| 44 | 44 | foreach ($listeners as &$listener) { |
| 45 | - if (!\is_array($listener) || !\is_string($listener[0])) { |
|
| 45 | + if ( ! \is_array($listener) || ! \is_string($listener[0])) { |
|
| 46 | 46 | continue; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if (!$this->container->has($listener[0])) { |
|
| 49 | + if ( ! $this->container->has($listener[0])) { |
|
| 50 | 50 | continue; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | public function startVisiting($object) |
| 54 | 54 | { |
| 55 | - if (!\is_object($object)) { |
|
| 55 | + if ( ! \is_object($object)) { |
|
| 56 | 56 | return; |
| 57 | 57 | } |
| 58 | 58 | $this->visitingSet->attach($object); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function stopVisiting($object) |
| 63 | 63 | { |
| 64 | - if (!\is_object($object)) { |
|
| 64 | + if ( ! \is_object($object)) { |
|
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | $this->visitingSet->detach($object); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function isVisiting($object) |
| 76 | 76 | { |
| 77 | - if (!\is_object($object)) { |
|
| 77 | + if ( ! \is_object($object)) { |
|
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $path[] = \get_class($obj); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if (!$path) { |
|
| 91 | + if ( ! $path) { |
|
| 92 | 92 | return null; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | public function getObject() |
| 109 | 109 | { |
| 110 | - return !$this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
| 110 | + return ! $this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | public function getVisitingStack() |
@@ -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 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | case 'resource': |
| 156 | 156 | $msg = 'Resources are not supported in serialized data.'; |
| 157 | 157 | if ($context instanceof SerializationContext && null !== $path = $context->getPath()) { |
| 158 | - $msg .= ' Path: ' . $path; |
|
| 158 | + $msg .= ' Path: '.$path; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | throw new RuntimeException($msg); |
@@ -211,11 +211,11 @@ discard block |
||
| 211 | 211 | /** @var $metadata ClassMetadata */ |
| 212 | 212 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
| 213 | 213 | |
| 214 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
| 214 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
| 215 | 215 | throw new ExpressionLanguageRequiredException("To use conditional exclude/expose in {$metadata->name} you must configure the expression language."); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if ($context instanceof DeserializationContext && !empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
| 218 | + if ($context instanceof DeserializationContext && ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
| 219 | 219 | $metadata = $this->resolveMetadata($data, $metadata); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -285,22 +285,22 @@ discard block |
||
| 285 | 285 | { |
| 286 | 286 | switch (true) { |
| 287 | 287 | case \is_array($data) && isset($data[$metadata->discriminatorFieldName]): |
| 288 | - $typeValue = (string)$data[$metadata->discriminatorFieldName]; |
|
| 288 | + $typeValue = (string) $data[$metadata->discriminatorFieldName]; |
|
| 289 | 289 | break; |
| 290 | 290 | |
| 291 | 291 | // Check XML attribute for discriminatorFieldName |
| 292 | 292 | case \is_object($data) && $metadata->xmlDiscriminatorAttribute && isset($data[$metadata->discriminatorFieldName]): |
| 293 | - $typeValue = (string)$data[$metadata->discriminatorFieldName]; |
|
| 293 | + $typeValue = (string) $data[$metadata->discriminatorFieldName]; |
|
| 294 | 294 | break; |
| 295 | 295 | |
| 296 | 296 | // Check XML element with namespace for discriminatorFieldName |
| 297 | - case \is_object($data) && !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
| 298 | - $typeValue = (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
| 297 | + case \is_object($data) && ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
| 298 | + $typeValue = (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
| 299 | 299 | break; |
| 300 | 300 | |
| 301 | 301 | // Check XML element for discriminatorFieldName |
| 302 | 302 | case \is_object($data) && isset($data->{$metadata->discriminatorFieldName}): |
| 303 | - $typeValue = (string)$data->{$metadata->discriminatorFieldName}; |
|
| 303 | + $typeValue = (string) $data->{$metadata->discriminatorFieldName}; |
|
| 304 | 304 | break; |
| 305 | 305 | |
| 306 | 306 | default: |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | )); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
| 314 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
| 315 | 315 | throw new \LogicException(sprintf( |
| 316 | 316 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
| 317 | 317 | $typeValue, |
@@ -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 | |