@@ -30,19 +30,19 @@ |
||
| 30 | 30 | { |
| 31 | 31 | $currentSorting = $properties ? array_combine(array_keys($properties), range(1, count($properties))) : []; |
| 32 | 32 | |
| 33 | - uksort($properties, function ($a, $b) use ($currentSorting) { |
|
| 33 | + uksort($properties, function($a, $b) use ($currentSorting) { |
|
| 34 | 34 | $existsA = isset($this->ordering[$a]); |
| 35 | 35 | $existsB = isset($this->ordering[$b]); |
| 36 | 36 | |
| 37 | - if (!$existsA && !$existsB) { |
|
| 37 | + if ( ! $existsA && ! $existsB) { |
|
| 38 | 38 | return $currentSorting[$a] - $currentSorting[$b]; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if (!$existsA) { |
|
| 41 | + if ( ! $existsA) { |
|
| 42 | 42 | return 1; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if (!$existsB) { |
|
| 45 | + if ( ! $existsB) { |
|
| 46 | 46 | return -1; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | { |
| 18 | 18 | uasort( |
| 19 | 19 | $properties, |
| 20 | - function (PropertyMetadata $a, PropertyMetadata $b): int { |
|
| 20 | + function(PropertyMetadata $a, PropertyMetadata $b): int { |
|
| 21 | 21 | return strcmp($a->name, $b->name); |
| 22 | 22 | } |
| 23 | 23 | ); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function __construct($container, array $handlers = []) |
| 23 | 23 | { |
| 24 | - if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) { |
|
| 24 | + if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) { |
|
| 25 | 25 | 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))); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | return $this->initializedHandlers[$direction][$typeName][$format]; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
| 44 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
| 45 | 45 | return null; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -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); |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | switch ($direction) { |
| 29 | 29 | case GraphNavigatorInterface::DIRECTION_DESERIALIZATION: |
| 30 | - return 'deserialize' . $type . 'From' . $format; |
|
| 30 | + return 'deserialize'.$type.'From'.$format; |
|
| 31 | 31 | |
| 32 | 32 | case GraphNavigatorInterface::DIRECTION_SERIALIZATION: |
| 33 | - return 'serialize' . $type . 'To' . $format; |
|
| 33 | + return 'serialize'.$type.'To'.$format; |
|
| 34 | 34 | |
| 35 | 35 | default: |
| 36 | 36 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigatorInterface::DIRECTION_??? constants.', json_encode($direction))); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler): void |
| 46 | 46 | { |
| 47 | 47 | foreach ($handler->getSubscribingMethods() as $methodData) { |
| 48 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
| 48 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
| 49 | 49 | 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))); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | public function getHandler(int $direction, string $typeName, string $format) |
| 70 | 70 | { |
| 71 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
| 71 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
| 72 | 72 | return null; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'type' => $type, |
| 40 | 40 | 'format' => $format, |
| 41 | 41 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
| 42 | - 'method' => 'serialize' . $type, |
|
| 42 | + 'method' => 'serialize'.$type, |
|
| 43 | 43 | ]; |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | private function parseDateTime($data, array $type, $immutable = false) |
| 161 | 161 | { |
| 162 | - $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 162 | + $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 163 | 163 | $format = $this->getDeserializationFormat($type); |
| 164 | 164 | |
| 165 | 165 | if ($immutable) { |
@@ -218,15 +218,15 @@ discard block |
||
| 218 | 218 | $format = 'P'; |
| 219 | 219 | |
| 220 | 220 | if (0 < $dateInterval->y) { |
| 221 | - $format .= $dateInterval->y . 'Y'; |
|
| 221 | + $format .= $dateInterval->y.'Y'; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (0 < $dateInterval->m) { |
| 225 | - $format .= $dateInterval->m . 'M'; |
|
| 225 | + $format .= $dateInterval->m.'M'; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | if (0 < $dateInterval->d) { |
| 229 | - $format .= $dateInterval->d . 'D'; |
|
| 229 | + $format .= $dateInterval->d.'D'; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -234,15 +234,15 @@ discard block |
||
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if (0 < $dateInterval->h) { |
| 237 | - $format .= $dateInterval->h . 'H'; |
|
| 237 | + $format .= $dateInterval->h.'H'; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if (0 < $dateInterval->i) { |
| 241 | - $format .= $dateInterval->i . 'M'; |
|
| 241 | + $format .= $dateInterval->i.'M'; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | if (0 < $dateInterval->s) { |
| 245 | - $format .= $dateInterval->s . 'S'; |
|
| 245 | + $format .= $dateInterval->s.'S'; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | if ($format === 'P') { |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | if ($this->evaluator === null) { |
| 39 | 39 | throw new ExpressionLanguageRequiredException(sprintf('The property %s on %s requires the expression accessor strategy to be enabled.', $metadata->name, $metadata->class)); |
| 40 | 40 | } |
| 41 | - return $this->evaluator->evaluate($metadata->expression, ['object' => $object, 'context' => $context, 'property_metadata' => $metadata ]); |
|
| 41 | + return $this->evaluator->evaluate($metadata->expression, ['object' => $object, 'context' => $context, 'property_metadata' => $metadata]); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (null === $metadata->getter) { |
| 45 | - if (!isset($this->readAccessors[$metadata->class])) { |
|
| 45 | + if ( ! isset($this->readAccessors[$metadata->class])) { |
|
| 46 | 46 | if ($metadata->forceReflectionAccess === true) { |
| 47 | - $this->readAccessors[$metadata->class] = function ($o, $name) use ($metadata) { |
|
| 47 | + $this->readAccessors[$metadata->class] = function($o, $name) use ($metadata) { |
|
| 48 | 48 | $ref = $this->propertyReflectionCache[$metadata->class][$name] ?? null; |
| 49 | 49 | if ($ref === null) { |
| 50 | 50 | $ref = new \ReflectionProperty($metadata->class, $name); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | return $ref->getValue($o); |
| 56 | 56 | }; |
| 57 | 57 | } else { |
| 58 | - $this->readAccessors[$metadata->class] = \Closure::bind(function ($o, $name) { |
|
| 58 | + $this->readAccessors[$metadata->class] = \Closure::bind(function($o, $name) { |
|
| 59 | 59 | return $o->$name; |
| 60 | 60 | }, null, $metadata->class); |
| 61 | 61 | } |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | if (null === $metadata->setter) { |
| 77 | - if (!isset($this->writeAccessors[$metadata->class])) { |
|
| 77 | + if ( ! isset($this->writeAccessors[$metadata->class])) { |
|
| 78 | 78 | if ($metadata->forceReflectionAccess === true) { |
| 79 | - $this->writeAccessors[$metadata->class] = function ($o, $name, $value) use ($metadata): void { |
|
| 79 | + $this->writeAccessors[$metadata->class] = function($o, $name, $value) use ($metadata): void { |
|
| 80 | 80 | $ref = $this->propertyReflectionCache[$metadata->class][$name] ?? null; |
| 81 | 81 | if ($ref === null) { |
| 82 | 82 | $ref = new \ReflectionProperty($metadata->class, $name); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $ref->setValue($o, $value); |
| 88 | 88 | }; |
| 89 | 89 | } else { |
| 90 | - $this->writeAccessors[$metadata->class] = \Closure::bind(function ($o, $name, $value): void { |
|
| 90 | + $this->writeAccessors[$metadata->class] = \Closure::bind(function($o, $name, $value): void { |
|
| 91 | 91 | $o->$name = $value; |
| 92 | 92 | }, null, $metadata->class); |
| 93 | 93 | } |
@@ -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 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public static function getDefaultMethodName($eventName) |
| 26 | 26 | { |
| 27 | - return 'on' . str_replace(['_', '.'], '', $eventName); |
|
| 27 | + return 'on'.str_replace(['_', '.'], '', $eventName); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function addSubscriber(EventSubscriberInterface $subscriber): void |
| 48 | 48 | { |
| 49 | 49 | foreach ($subscriber->getSubscribedEvents() as $eventData) { |
| 50 | - if (!isset($eventData['event'])) { |
|
| 50 | + if ( ! isset($eventData['event'])) { |
|
| 51 | 51 | throw new InvalidArgumentException(sprintf('Each event must have a "event" key.')); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -62,33 +62,33 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public function hasListeners(string $eventName, string $class, string $format): bool |
| 64 | 64 | { |
| 65 | - if (!isset($this->listeners[$eventName])) { |
|
| 65 | + if ( ! isset($this->listeners[$eventName])) { |
|
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if (!isset($this->classListeners[$eventName][$class][$format])) { |
|
| 69 | + if ( ! isset($this->classListeners[$eventName][$class][$format])) { |
|
| 70 | 70 | $this->classListeners[$eventName][$class][$format] = $this->initializeListeners($eventName, $class, $format); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - return !!$this->classListeners[$eventName][$class][$format]; |
|
| 73 | + return ! ! $this->classListeners[$eventName][$class][$format]; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public function dispatch($eventName, string $class, string $format, Event $event): void |
| 77 | 77 | { |
| 78 | - if (!isset($this->listeners[$eventName])) { |
|
| 78 | + if ( ! isset($this->listeners[$eventName])) { |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $object = $event instanceof ObjectEvent ? $event->getObject() : null; |
| 83 | 83 | $realClass = is_object($object) ? get_class($object) : ''; |
| 84 | - $objectClass = $realClass !== $class ? ($realClass . $class) : $class; |
|
| 84 | + $objectClass = $realClass !== $class ? ($realClass.$class) : $class; |
|
| 85 | 85 | |
| 86 | - if (!isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
| 86 | + if ( ! isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
| 87 | 87 | $this->classListeners[$eventName][$objectClass][$format] = $this->initializeListeners($eventName, $class, $format); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | foreach ($this->classListeners[$eventName][$objectClass][$format] as $listener) { |
| 91 | - if (!empty($listener[3]) && !($object instanceof $listener[3])) { |
|
| 91 | + if ( ! empty($listener[3]) && ! ($object instanceof $listener[3])) { |
|
| 92 | 92 | continue; |
| 93 | 93 | } |
| 94 | 94 | |