@@ -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 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | 'type' => $type, |
| 55 | 55 | 'format' => $format, |
| 56 | 56 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
| 57 | - 'method' => 'serialize' . $type, |
|
| 57 | + 'method' => 'serialize'.$type, |
|
| 58 | 58 | ); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | private function isDataXmlNull($data) |
| 118 | 118 | { |
| 119 | 119 | $attributes = $data->attributes('xsi', true); |
| 120 | - return isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true'; |
|
| 120 | + return isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true'; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | public function deserializeDateTimeFromXml(XmlDeserializationVisitor $visitor, $data, array $type) |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | private function parseDateTime($data, array $type, $immutable = false) |
| 205 | 205 | { |
| 206 | - $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 206 | + $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 207 | 207 | $format = $this->getDeserializationFormat($type); |
| 208 | 208 | |
| 209 | 209 | if ($immutable) { |
| 210 | - $datetime = \DateTimeImmutable::createFromFormat($format, (string)$data, $timezone); |
|
| 210 | + $datetime = \DateTimeImmutable::createFromFormat($format, (string) $data, $timezone); |
|
| 211 | 211 | } else { |
| 212 | - $datetime = \DateTime::createFromFormat($format, (string)$data, $timezone); |
|
| 212 | + $datetime = \DateTime::createFromFormat($format, (string) $data, $timezone); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | if (false === $datetime) { |
@@ -268,15 +268,15 @@ discard block |
||
| 268 | 268 | $format = 'P'; |
| 269 | 269 | |
| 270 | 270 | if (0 < $dateInterval->y) { |
| 271 | - $format .= $dateInterval->y . 'Y'; |
|
| 271 | + $format .= $dateInterval->y.'Y'; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | if (0 < $dateInterval->m) { |
| 275 | - $format .= $dateInterval->m . 'M'; |
|
| 275 | + $format .= $dateInterval->m.'M'; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | if (0 < $dateInterval->d) { |
| 279 | - $format .= $dateInterval->d . 'D'; |
|
| 279 | + $format .= $dateInterval->d.'D'; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -284,15 +284,15 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | if (0 < $dateInterval->h) { |
| 287 | - $format .= $dateInterval->h . 'H'; |
|
| 287 | + $format .= $dateInterval->h.'H'; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | if (0 < $dateInterval->i) { |
| 291 | - $format .= $dateInterval->i . 'M'; |
|
| 291 | + $format .= $dateInterval->i.'M'; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | if (0 < $dateInterval->s) { |
| 295 | - $format .= $dateInterval->s . 'S'; |
|
| 295 | + $format .= $dateInterval->s.'S'; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | if ($format === 'P') { |
@@ -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 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
| 41 | 41 | 'type' => $type, |
| 42 | 42 | 'format' => $format, |
| 43 | - 'method' => $method . 'To' . $format, |
|
| 43 | + 'method' => $method.'To'.$format, |
|
| 44 | 44 | ); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | public function serializeListToXml(XmlSerializationVisitor $visitor, ConstraintViolationList $list, array $type) |
| 52 | 52 | { |
| 53 | 53 | $currentNode = $visitor->getCurrentNode(); |
| 54 | - if (!$currentNode) { |
|
| 54 | + if ( ! $currentNode) { |
|
| 55 | 55 | $visitor->createRoot(); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $violationNode = $visitor->getDocument()->createElement('violation'); |
| 76 | 76 | |
| 77 | 77 | $parent = $visitor->getCurrentNode(); |
| 78 | - if (!$parent) { |
|
| 78 | + if ( ! $parent) { |
|
| 79 | 79 | $visitor->setCurrentAndRootNode($violationNode); |
| 80 | 80 | } else { |
| 81 | 81 | $parent->appendChild($violationNode); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function createDriver(array $metadataDirs, Reader $reader) |
| 22 | 22 | { |
| 23 | 23 | $driver = \call_user_func($this->callback, $metadataDirs, $reader); |
| 24 | - if (!$driver instanceof DriverInterface) { |
|
| 24 | + if ( ! $driver instanceof DriverInterface) { |
|
| 25 | 25 | throw new LogicException('The callback must return an instance of DriverInterface.'); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function __construct($class, $name) |
| 60 | 60 | { |
| 61 | 61 | parent::__construct($class, $name); |
| 62 | - $this->closureAccessor = \Closure::bind(function ($o, $name) { |
|
| 62 | + $this->closureAccessor = \Closure::bind(function($o, $name) { |
|
| 63 | 63 | return $o->$name; |
| 64 | 64 | }, null, $class); |
| 65 | 65 | } |
@@ -69,22 +69,22 @@ discard block |
||
| 69 | 69 | $class = $this->reflection->getDeclaringClass(); |
| 70 | 70 | |
| 71 | 71 | if (empty($getter)) { |
| 72 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
| 73 | - $getter = 'get' . $this->name; |
|
| 74 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
| 75 | - $getter = 'is' . $this->name; |
|
| 76 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
| 77 | - $getter = 'has' . $this->name; |
|
| 72 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
| 73 | + $getter = 'get'.$this->name; |
|
| 74 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
| 75 | + $getter = 'is'.$this->name; |
|
| 76 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
| 77 | + $getter = 'has'.$this->name; |
|
| 78 | 78 | } else { |
| 79 | - throw new RuntimeException(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)); |
|
| 79 | + throw new RuntimeException(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)); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if (empty($setter) && !$this->readOnly) { |
|
| 84 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
| 85 | - $setter = 'set' . $this->name; |
|
| 83 | + if (empty($setter) && ! $this->readOnly) { |
|
| 84 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
| 85 | + $setter = 'set'.$this->name; |
|
| 86 | 86 | } else { |
| 87 | - throw new RuntimeException(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)); |
|
| 87 | + throw new RuntimeException(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)); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | parent::unserialize($parentStr); |
| 201 | 201 | |
| 202 | - $this->closureAccessor = \Closure::bind(function ($o, $name) { |
|
| 202 | + $this->closureAccessor = \Closure::bind(function($o, $name) { |
|
| 203 | 203 | return $o->$name; |
| 204 | 204 | }, null, $this->class); |
| 205 | 205 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function createDriver(array $metadataDirs, Reader $annotationReader) |
| 24 | 24 | { |
| 25 | - if (!empty($metadataDirs)) { |
|
| 25 | + if ( ! empty($metadataDirs)) { |
|
| 26 | 26 | $fileLocator = new FileLocator($metadataDirs); |
| 27 | 27 | |
| 28 | 28 | return new DriverChain(array( |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | /** @var $metadata ClassMetadata */ |
| 148 | 148 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
| 149 | 149 | |
| 150 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
| 150 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
| 151 | 151 | throw new ExpressionLanguageRequiredException("To use conditional exclude/expose in {$metadata->name} you must configure the expression language."); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
| 154 | + if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
| 155 | 155 | $metadata = $this->resolveMetadata($data, $metadata); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -195,22 +195,22 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | switch (true) { |
| 197 | 197 | case \is_array($data) && isset($data[$metadata->discriminatorFieldName]): |
| 198 | - $typeValue = (string)$data[$metadata->discriminatorFieldName]; |
|
| 198 | + $typeValue = (string) $data[$metadata->discriminatorFieldName]; |
|
| 199 | 199 | break; |
| 200 | 200 | |
| 201 | 201 | // Check XML attribute for discriminatorFieldName |
| 202 | 202 | case \is_object($data) && $metadata->xmlDiscriminatorAttribute && isset($data[$metadata->discriminatorFieldName]): |
| 203 | - $typeValue = (string)$data[$metadata->discriminatorFieldName]; |
|
| 203 | + $typeValue = (string) $data[$metadata->discriminatorFieldName]; |
|
| 204 | 204 | break; |
| 205 | 205 | |
| 206 | 206 | // Check XML element with namespace for discriminatorFieldName |
| 207 | - case \is_object($data) && !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
| 208 | - $typeValue = (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
| 207 | + case \is_object($data) && ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
| 208 | + $typeValue = (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
| 209 | 209 | break; |
| 210 | 210 | |
| 211 | 211 | // Check XML element for discriminatorFieldName |
| 212 | 212 | case \is_object($data) && isset($data->{$metadata->discriminatorFieldName}): |
| 213 | - $typeValue = (string)$data->{$metadata->discriminatorFieldName}; |
|
| 213 | + $typeValue = (string) $data->{$metadata->discriminatorFieldName}; |
|
| 214 | 214 | break; |
| 215 | 215 | |
| 216 | 216 | default: |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | )); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
| 224 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
| 225 | 225 | throw new LogicException(sprintf( |
| 226 | 226 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
| 227 | 227 | $typeValue, |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function __construct($container) |
| 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 | |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | $listeners = parent::initializeListeners($eventName, $loweredClass, $format); |
| 44 | 44 | |
| 45 | 45 | foreach ($listeners as &$listener) { |
| 46 | - if (!\is_array($listener) || !\is_string($listener[0])) { |
|
| 46 | + if ( ! \is_array($listener) || ! \is_string($listener[0])) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if (!$this->container->has($listener[0])) { |
|
| 50 | + if ( ! $this->container->has($listener[0])) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |