@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public function __construct($container) |
| 32 | 32 | { |
| 33 | - if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) { |
|
| 33 | + if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) { |
|
| 34 | 34 | 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))); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | $listeners = parent::initializeListeners($eventName, $loweredClass, $format); |
| 46 | 46 | |
| 47 | 47 | foreach ($listeners as &$listener) { |
| 48 | - if (!\is_array($listener[0]) || !\is_string($listener[0][0])) { |
|
| 48 | + if ( ! \is_array($listener[0]) || ! \is_string($listener[0][0])) { |
|
| 49 | 49 | continue; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if (!$this->container->has($listener[0][0])) { |
|
| 52 | + if ( ! $this->container->has($listener[0][0])) { |
|
| 53 | 53 | continue; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | use Hoa\Compiler\Llk\Llk; |
| 23 | 23 | use Hoa\File\Read; |
| 24 | 24 | |
| 25 | -require __DIR__ . '/../../vendor/autoload.php'; |
|
| 25 | +require __DIR__.'/../../vendor/autoload.php'; |
|
| 26 | 26 | |
| 27 | -$compiler = Llk::load(new Read(__DIR__ . '/grammar.pp')); |
|
| 27 | +$compiler = Llk::load(new Read(__DIR__.'/grammar.pp')); |
|
| 28 | 28 | |
| 29 | 29 | file_put_contents( |
| 30 | - __DIR__ . '/InnerParser.php', |
|
| 30 | + __DIR__.'/InnerParser.php', |
|
| 31 | 31 | <<<EOS |
| 32 | 32 | <?php |
| 33 | 33 | |
@@ -57,5 +57,5 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | |
| 59 | 59 | EOS |
| 60 | - . 'final ' . Llk::save($compiler, 'InnerParser') |
|
| 60 | + . 'final '.Llk::save($compiler, 'InnerParser') |
|
| 61 | 61 | ); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | return $value; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - return str_replace($escapeChar . $escapeChar, $escapeChar, $value); |
|
| 62 | + return str_replace($escapeChar.$escapeChar, $escapeChar, $value); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | private function visitCompoundType(TreeNode $element, ?int &$handle, ?int $eldnah) : array |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return [ |
| 71 | 71 | 'name' => $nameToken->getValueValue(), |
| 72 | 72 | 'params' => array_map( |
| 73 | - function (TreeNode $node) use ($handle, $eldnah) { |
|
| 73 | + function(TreeNode $node) use ($handle, $eldnah) { |
|
| 74 | 74 | return $node->accept($this, $handle, $eldnah); |
| 75 | 75 | }, |
| 76 | 76 | $parameters |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $rs = isset($type['params'][1]) ? new \ArrayObject() : []; |
| 79 | 79 | |
| 80 | - $isList = isset($type['params'][0]) && !isset($type['params'][1]); |
|
| 80 | + $isList = isset($type['params'][0]) && ! isset($type['params'][1]); |
|
| 81 | 81 | |
| 82 | 82 | $elType = $this->getElementType($type); |
| 83 | 83 | foreach ($data as $k => $v) { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | if ($metadata->inline) { |
| 134 | 134 | if (\is_array($v) || ($v instanceof \ArrayObject)) { |
| 135 | - $this->data = array_merge($this->data, (array)$v); |
|
| 135 | + $this->data = array_merge($this->data, (array) $v); |
|
| 136 | 136 | } |
| 137 | 137 | } else { |
| 138 | 138 | $this->data[$metadata->serializedName] = $v; |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | $classMetadata->setDiscriminator($annot->field, $annot->map, $annot->groups); |
| 115 | 115 | } |
| 116 | 116 | } elseif ($annot instanceof XmlDiscriminator) { |
| 117 | - $classMetadata->xmlDiscriminatorAttribute = (bool)$annot->attribute; |
|
| 118 | - $classMetadata->xmlDiscriminatorCData = (bool)$annot->cdata; |
|
| 119 | - $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string)$annot->namespace : null; |
|
| 117 | + $classMetadata->xmlDiscriminatorAttribute = (bool) $annot->attribute; |
|
| 118 | + $classMetadata->xmlDiscriminatorCData = (bool) $annot->cdata; |
|
| 119 | + $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string) $annot->namespace : null; |
|
| 120 | 120 | } elseif ($annot instanceof VirtualProperty) { |
| 121 | 121 | $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $annot->name, $annot->exp); |
| 122 | 122 | $propertiesMetadata[] = $virtualPropertyMetadata; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if (!$excludeAll) { |
|
| 153 | + if ( ! $excludeAll) { |
|
| 154 | 154 | foreach ($class->getProperties() as $property) { |
| 155 | 155 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 156 | 156 | continue; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } elseif ($annot instanceof Expose) { |
| 182 | 182 | $isExpose = true; |
| 183 | 183 | if (null !== $annot->if) { |
| 184 | - $propertyMetadata->excludeIf = "!(" . $annot->if . ")"; |
|
| 184 | + $propertyMetadata->excludeIf = "!(".$annot->if.")"; |
|
| 185 | 185 | } |
| 186 | 186 | } elseif ($annot instanceof Exclude) { |
| 187 | 187 | if (null !== $annot->if) { |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | $accessor = [$annot->getter, $annot->setter]; |
| 226 | 226 | } elseif ($annot instanceof Groups) { |
| 227 | 227 | $propertyMetadata->groups = $annot->groups; |
| 228 | - foreach ((array)$propertyMetadata->groups as $groupName) { |
|
| 228 | + foreach ((array) $propertyMetadata->groups as $groupName) { |
|
| 229 | 229 | if (false !== strpos($groupName, ',')) { |
| 230 | 230 | throw new InvalidArgumentException(sprintf( |
| 231 | 231 | 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', |
| 232 | 232 | implode(', ', $propertyMetadata->groups), |
| 233 | - $propertyMetadata->class . '->' . $propertyMetadata->name |
|
| 233 | + $propertyMetadata->class.'->'.$propertyMetadata->name |
|
| 234 | 234 | )); |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if (!$propertyMetadata->serializedName) { |
|
| 246 | + if ( ! $propertyMetadata->serializedName) { |
|
| 247 | 247 | $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata); |
| 248 | 248 | } |
| 249 | 249 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 256 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 257 | 257 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 258 | 258 | ) { |
| 259 | 259 | $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
| 43 | 43 | 'type' => $type, |
| 44 | 44 | 'format' => $format, |
| 45 | - 'method' => $method . 'To' . $format, |
|
| 45 | + 'method' => $method.'To'.$format, |
|
| 46 | 46 | ]; |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | public function serializeListToXml(XmlSerializationVisitor $visitor, ConstraintViolationList $list, array $type) |
| 54 | 54 | { |
| 55 | 55 | $currentNode = $visitor->getCurrentNode(); |
| 56 | - if (!$currentNode) { |
|
| 56 | + if ( ! $currentNode) { |
|
| 57 | 57 | $visitor->createRoot(); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $violationNode = $visitor->getDocument()->createElement('violation'); |
| 73 | 73 | |
| 74 | 74 | $parent = $visitor->getCurrentNode(); |
| 75 | - if (!$parent) { |
|
| 75 | + if ( ! $parent) { |
|
| 76 | 76 | $visitor->setCurrentAndRootNode($violationNode); |
| 77 | 77 | } else { |
| 78 | 78 | $parent->appendChild($violationNode); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function __construct($container, array $handlers = []) |
| 33 | 33 | { |
| 34 | - if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) { |
|
| 34 | + if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) { |
|
| 35 | 35 | 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))); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | return $this->initializedHandlers[$direction][$typeName][$format]; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
| 54 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
| 55 | 55 | return null; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $classMetadata = $context->getMetadataFactory()->getMetadataForClass('stdClass'); |
| 53 | 53 | $visitor->startVisitingObject($classMetadata, $stdClass, ['name' => 'stdClass'], $context); |
| 54 | 54 | |
| 55 | - foreach ((array)$stdClass as $name => $value) { |
|
| 55 | + foreach ((array) $stdClass as $name => $value) { |
|
| 56 | 56 | $metadata = new StaticPropertyMetadata('stdClass', $name, $value); |
| 57 | 57 | $visitor->visitProperty($metadata, $value); |
| 58 | 58 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | // Locate possible ObjectManager |
| 66 | 66 | $objectManager = $this->managerRegistry->getManagerForClass($metadata->name); |
| 67 | 67 | |
| 68 | - if (!$objectManager) { |
|
| 68 | + if ( ! $objectManager) { |
|
| 69 | 69 | // No ObjectManager found, proceed with normal deserialization |
| 70 | 70 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 71 | 71 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // Managed entity, check for proxy load |
| 82 | - if (!\is_array($data)) { |
|
| 82 | + if ( ! \is_array($data)) { |
|
| 83 | 83 | // Single identifier, load proxy |
| 84 | 84 | return $objectManager->getReference($metadata->name, $data); |
| 85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $identifierList = []; |
| 90 | 90 | |
| 91 | 91 | foreach ($classMetadata->getIdentifierFieldNames() as $name) { |
| 92 | - if (!array_key_exists($name, $data)) { |
|
| 92 | + if ( ! array_key_exists($name, $data)) { |
|
| 93 | 93 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 94 | 94 | } |
| 95 | 95 | |