@@ -25,7 +25,7 @@ |
||
| 25 | 25 | All the other cases should work as expected. |
| 26 | 26 | The alternative here is to use the explicit syntax Groups(groups=['value' => '...']) |
| 27 | 27 | */ |
| 28 | - if (count($values) > 0 && ((!isset($values['value']) && !isset($values['groups'])) || count($values) > 1) && 0 === count($groups)) { |
|
| 28 | + if (count($values) > 0 && (( ! isset($values['value']) && ! isset($values['groups'])) || count($values) > 1) && 0 === count($groups)) { |
|
| 29 | 29 | $vars['groups'] = $values; |
| 30 | 30 | $vars['values'] = []; |
| 31 | 31 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | // Locate possible ObjectManager |
| 70 | 70 | $objectManager = $this->managerRegistry->getManagerForClass($metadata->name); |
| 71 | 71 | |
| 72 | - if (!$objectManager) { |
|
| 72 | + if ( ! $objectManager) { |
|
| 73 | 73 | // No ObjectManager found, proceed with normal deserialization |
| 74 | 74 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 75 | 75 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Managed entity, check for proxy load |
| 86 | - if (!is_array($data) && !(is_object($data) && 'SimpleXMLElement' === get_class($data))) { |
|
| 86 | + if ( ! is_array($data) && ! (is_object($data) && 'SimpleXMLElement' === get_class($data))) { |
|
| 87 | 87 | // Single identifier, load proxy |
| 88 | 88 | return $objectManager->getReference($metadata->name, $data); |
| 89 | 89 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | foreach ($classMetadata->getIdentifierFieldNames() as $name) { |
| 96 | 96 | // Avoid calling objectManager->find if some identification properties are excluded |
| 97 | - if (!isset($metadata->propertyMetadata[$name])) { |
|
| 97 | + if ( ! isset($metadata->propertyMetadata[$name])) { |
|
| 98 | 98 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if (is_array($data) && !array_key_exists($propertyMetadata->serializedName, $data)) { |
|
| 108 | + if (is_array($data) && ! array_key_exists($propertyMetadata->serializedName, $data)) { |
|
| 109 | 109 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 110 | - } elseif (is_object($data) && !property_exists($data, $propertyMetadata->serializedName)) { |
|
| 110 | + } elseif (is_object($data) && ! property_exists($data, $propertyMetadata->serializedName)) { |
|
| 111 | 111 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $propertyMetadata = $context->getMetadataStack()->top(); |
| 122 | - if (!$propertyMetadata instanceof PropertyMetadata) { |
|
| 122 | + if ( ! $propertyMetadata instanceof PropertyMetadata) { |
|
| 123 | 123 | return $elements; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -137,18 +137,18 @@ discard block |
||
| 137 | 137 | && $classMetadata->isCollectionValuedAssociation($propertyMetadata->name) |
| 138 | 138 | ) { |
| 139 | 139 | $existingCollection = $classMetadata->getFieldValue($currentObject, $propertyMetadata->name); |
| 140 | - if (!$existingCollection instanceof OrmPersistentCollection) { |
|
| 140 | + if ( ! $existingCollection instanceof OrmPersistentCollection) { |
|
| 141 | 141 | return $elements; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | foreach ($elements as $element) { |
| 145 | - if (!$existingCollection->contains($element)) { |
|
| 145 | + if ( ! $existingCollection->contains($element)) { |
|
| 146 | 146 | $existingCollection->add($element); |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | foreach ($existingCollection as $collectionElement) { |
| 151 | - if (!$elements->contains($collectionElement)) { |
|
| 151 | + if ( ! $elements->contains($collectionElement)) { |
|
| 152 | 152 | $existingCollection->removeElement($collectionElement); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function visitDouble(float $data, array $type) |
| 72 | 72 | { |
| 73 | 73 | $percision = $type['params'][0] ?? null; |
| 74 | - if (!is_int($percision)) { |
|
| 74 | + if ( ! is_int($percision)) { |
|
| 75 | 75 | return $data; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $rs = isset($type['params'][1]) ? new \ArrayObject() : []; |
| 95 | 95 | |
| 96 | - $isList = isset($type['params'][0]) && !isset($type['params'][1]); |
|
| 96 | + $isList = isset($type['params'][0]) && ! isset($type['params'][1]); |
|
| 97 | 97 | |
| 98 | 98 | $elType = $this->getElementType($type); |
| 99 | 99 | foreach ($data as $k => $v) { |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $relativeDepth = 0; |
| 29 | 29 | |
| 30 | 30 | foreach ($context->getMetadataStack() as $metadata) { |
| 31 | - if (!$metadata instanceof PropertyMetadata) { |
|
| 31 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
| 32 | 32 | continue; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | return null; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if (! is_string($data)) { |
|
| 52 | + if ( ! is_string($data)) { |
|
| 53 | 53 | throw NonVisitableTypeException::fromDataAndType($data, $type); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return null; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if (! is_bool($data)) { |
|
| 68 | + if ( ! is_bool($data)) { |
|
| 69 | 69 | throw NonVisitableTypeException::fromDataAndType($data, $type); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | return null; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if (! is_int($data)) { |
|
| 84 | + if ( ! is_int($data)) { |
|
| 85 | 85 | throw NonVisitableTypeException::fromDataAndType($data, $type); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | return null; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if (! is_float($data)) { |
|
| 100 | + if ( ! is_float($data)) { |
|
| 101 | 101 | throw NonVisitableTypeException::fromDataAndType($data, $type); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | 'direction' => GraphNavigatorInterface::DIRECTION_DESERIALIZATION, |
| 71 | 71 | 'format' => $format, |
| 72 | 72 | 'type' => $class, |
| 73 | - 'method' => 'deserializeUidFrom' . ucfirst($format), |
|
| 73 | + 'method' => 'deserializeUidFrom'.ucfirst($format), |
|
| 74 | 74 | ]; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
| 44 | 44 | 'type' => FormInterface::class, |
| 45 | 45 | 'format' => $format, |
| 46 | - 'method' => 'serializeFormTo' . ucfirst($format), |
|
| 46 | + 'method' => 'serializeFormTo'.ucfirst($format), |
|
| 47 | 47 | ]; |
| 48 | 48 | $methods[] = [ |
| 49 | 49 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function __construct(?object $translator = null, string $translationDomain = 'validators') |
| 59 | 59 | { |
| 60 | - if (null !== $translator && (!$translator instanceof TranslatorInterface && !$translator instanceof TranslatorContract)) { |
|
| 60 | + if (null !== $translator && ( ! $translator instanceof TranslatorInterface && ! $translator instanceof TranslatorContract)) { |
|
| 61 | 61 | throw new \InvalidArgumentException(sprintf( |
| 62 | 62 | 'The first argument passed to %s must be instance of %s or %s, %s given', |
| 63 | 63 | self::class, |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | private function getAccessorStrategy(): AccessorStrategyInterface |
| 216 | 216 | { |
| 217 | - if (!$this->accessorStrategy) { |
|
| 217 | + if ( ! $this->accessorStrategy) { |
|
| 218 | 218 | $this->accessorStrategy = new DefaultAccessorStrategy($this->expressionEvaluator); |
| 219 | 219 | } |
| 220 | 220 | |
@@ -251,11 +251,11 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | public function setCacheDir(string $dir): self |
| 253 | 253 | { |
| 254 | - if (!is_dir($dir)) { |
|
| 254 | + if ( ! is_dir($dir)) { |
|
| 255 | 255 | $this->createDir($dir); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - if (!is_writable($dir)) { |
|
| 258 | + if ( ! is_writable($dir)) { |
|
| 259 | 259 | throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir)); |
| 260 | 260 | } |
| 261 | 261 | |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | public function setMetadataDirs(array $namespacePrefixToDirMap): self |
| 378 | 378 | { |
| 379 | 379 | foreach ($namespacePrefixToDirMap as $dir) { |
| 380 | - if (!is_dir($dir)) { |
|
| 380 | + if ( ! is_dir($dir)) { |
|
| 381 | 381 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
| 382 | 382 | } |
| 383 | 383 | } |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | */ |
| 416 | 416 | public function addMetadataDir(string $dir, string $namespacePrefix = ''): self |
| 417 | 417 | { |
| 418 | - if (!is_dir($dir)) { |
|
| 418 | + if ( ! is_dir($dir)) { |
|
| 419 | 419 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
| 420 | 420 | } |
| 421 | 421 | |
@@ -454,11 +454,11 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | public function replaceMetadataDir(string $dir, string $namespacePrefix = ''): self |
| 456 | 456 | { |
| 457 | - if (!is_dir($dir)) { |
|
| 457 | + if ( ! is_dir($dir)) { |
|
| 458 | 458 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - if (!isset($this->metadataDirs[$namespacePrefix])) { |
|
| 461 | + if ( ! isset($this->metadataDirs[$namespacePrefix])) { |
|
| 462 | 462 | throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix)); |
| 463 | 463 | } |
| 464 | 464 | |
@@ -553,23 +553,23 @@ discard block |
||
| 553 | 553 | if (null !== $this->metadataCache) { |
| 554 | 554 | $metadataFactory->setCache($this->metadataCache); |
| 555 | 555 | } elseif (null !== $this->cacheDir) { |
| 556 | - $this->createDir($this->cacheDir . '/metadata'); |
|
| 557 | - $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata')); |
|
| 556 | + $this->createDir($this->cacheDir.'/metadata'); |
|
| 557 | + $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata')); |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - if (!$this->handlersConfigured) { |
|
| 560 | + if ( ! $this->handlersConfigured) { |
|
| 561 | 561 | $this->addDefaultHandlers(); |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | - if (!$this->listenersConfigured) { |
|
| 564 | + if ( ! $this->listenersConfigured) { |
|
| 565 | 565 | $this->addDefaultListeners(); |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | - if (!$this->serializationVisitorsAdded) { |
|
| 568 | + if ( ! $this->serializationVisitorsAdded) { |
|
| 569 | 569 | $this->addDefaultSerializationVisitors(); |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - if (!$this->deserializationVisitorsAdded) { |
|
| 572 | + if ( ! $this->deserializationVisitorsAdded) { |
|
| 573 | 573 | $this->addDefaultDeserializationVisitors(); |
| 574 | 574 | } |
| 575 | 575 | |
@@ -635,12 +635,12 @@ discard block |
||
| 635 | 635 | private function decorateAnnotationReader(Reader $annotationReader): Reader |
| 636 | 636 | { |
| 637 | 637 | if (null !== $this->cacheDir) { |
| 638 | - $this->createDir($this->cacheDir . '/annotations'); |
|
| 638 | + $this->createDir($this->cacheDir.'/annotations'); |
|
| 639 | 639 | if (class_exists(FilesystemAdapter::class)) { |
| 640 | - $annotationsCache = new FilesystemAdapter('', 0, $this->cacheDir . '/annotations'); |
|
| 640 | + $annotationsCache = new FilesystemAdapter('', 0, $this->cacheDir.'/annotations'); |
|
| 641 | 641 | $annotationReader = new PsrCachedReader($annotationReader, $annotationsCache, $this->debug); |
| 642 | 642 | } elseif (class_exists(FilesystemCache::class) && class_exists(CachedReader::class)) { |
| 643 | - $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations'); |
|
| 643 | + $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations'); |
|
| 644 | 644 | $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug); |
| 645 | 645 | } |
| 646 | 646 | } |