@@ -69,22 +69,22 @@ |
||
| 69 | 69 | $class = $this->getReflection()->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 | } |
@@ -49,32 +49,32 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public function visitString($data, array $type): string |
| 51 | 51 | { |
| 52 | - return (string)$data; |
|
| 52 | + return (string) $data; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function visitBoolean($data, array $type): bool |
| 56 | 56 | { |
| 57 | - return (bool)$data; |
|
| 57 | + return (bool) $data; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | public function visitInteger($data, array $type): int |
| 61 | 61 | { |
| 62 | - return (int)$data; |
|
| 62 | + return (int) $data; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function visitDouble($data, array $type): float |
| 66 | 66 | { |
| 67 | - return (double)$data; |
|
| 67 | + return (double) $data; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function visitArray($data, array $type): array |
| 71 | 71 | { |
| 72 | - if (!\is_array($data)) { |
|
| 72 | + if ( ! \is_array($data)) { |
|
| 73 | 73 | throw new RuntimeException(sprintf('Expected array, but got %s: %s', \gettype($data), json_encode($data))); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // If no further parameters were given, keys/values are just passed as is. |
| 77 | - if (!$type['params']) { |
|
| 77 | + if ( ! $type['params']) { |
|
| 78 | 78 | return $data; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): string |
| 110 | 110 | { |
| 111 | 111 | if (isset($data[$metadata->discriminatorFieldName])) { |
| 112 | - return (string)$data[$metadata->discriminatorFieldName]; |
|
| 112 | + return (string) $data[$metadata->discriminatorFieldName]; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | throw new LogicException(sprintf( |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if (!\is_array($data)) { |
|
| 135 | + if ( ! \is_array($data)) { |
|
| 136 | 136 | throw new RuntimeException(sprintf('Invalid data "%s"(%s), expected "%s".', $data, $metadata->type['name'], $metadata->class)); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if (!array_key_exists($name, $data)) { |
|
| 139 | + if ( ! array_key_exists($name, $data)) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if (!$metadata->type) { |
|
| 143 | + if ( ! $metadata->type) { |
|
| 144 | 144 | throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->class, $metadata->name)); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function setAccessorOrder(string $order, array $customOrder = []):void |
| 102 | 102 | { |
| 103 | - if (!in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { |
|
| 103 | + if ( ! in_array($order, [self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM], true)) { |
|
| 104 | 104 | throw new InvalidArgumentException(sprintf('The accessor order "%s" is invalid.', $order)); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | foreach ($customOrder as $name) { |
| 108 | - if (!\is_string($name)) { |
|
| 108 | + if ( ! \is_string($name)) { |
|
| 109 | 109 | throw new InvalidArgumentException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name))); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | public function merge(MergeableInterface $object):void |
| 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); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $this->discriminatorBaseClass, |
| 166 | 166 | $this->discriminatorBaseClass |
| 167 | 167 | )); |
| 168 | - } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 168 | + } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 169 | 169 | $this->discriminatorFieldName = $object->discriminatorFieldName; |
| 170 | 170 | $this->discriminatorMap = $object->discriminatorMap; |
| 171 | 171 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $this->discriminatorBaseClass = $object->discriminatorBaseClass; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if ($this->discriminatorMap && !$this->getReflection()->isAbstract()) { |
|
| 183 | + if ($this->discriminatorMap && ! $this->getReflection()->isAbstract()) { |
|
| 184 | 184 | if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) { |
| 185 | 185 | throw new LogicException(sprintf( |
| 186 | 186 | 'The sub-class "%s" is not listed in the discriminator of the base class "%s".', |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $this->discriminatorValue = $typeValue; |
| 193 | 193 | |
| 194 | 194 | if (isset($this->propertyMetadata[$this->discriminatorFieldName]) |
| 195 | - && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 195 | + && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 196 | 196 | ) { |
| 197 | 197 | throw new LogicException(sprintf( |
| 198 | 198 | 'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".', |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | public function registerNamespace(string $uri, ?string $prefix = null):void |
| 222 | 222 | { |
| 223 | - if (!\is_string($uri)) { |
|
| 223 | + if ( ! \is_string($uri)) { |
|
| 224 | 224 | throw new InvalidArgumentException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri))); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | if ($prefix !== null) { |
| 228 | - if (!\is_string($prefix)) { |
|
| 228 | + if ( ! \is_string($prefix)) { |
|
| 229 | 229 | throw new InvalidArgumentException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix))); |
| 230 | 230 | } |
| 231 | 231 | } else { |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | protected function setDiscriminator(DoctrineClassMetadata $doctrineMetadata, ClassMetadata $classMetadata):void |
| 34 | 34 | { |
| 35 | - if (empty($classMetadata->discriminatorMap) && !$classMetadata->discriminatorDisabled |
|
| 36 | - && !empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
| 35 | + if (empty($classMetadata->discriminatorMap) && ! $classMetadata->discriminatorDisabled |
|
| 36 | + && ! empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
| 37 | 37 | ) { |
| 38 | 38 | $classMetadata->setDiscriminator( |
| 39 | 39 | $doctrineMetadata->discriminatorColumn['name'], |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | // For inheritance schemes, we cannot add any type as we would only add the super-type of the hierarchy. |
| 58 | 58 | // On serialization, this would lead to only the supertype being serialized, and properties of subtypes |
| 59 | 59 | // being ignored. |
| 60 | - if ($targetMetadata instanceof DoctrineClassMetadata && !$targetMetadata->isInheritanceTypeNone()) { |
|
| 60 | + if ($targetMetadata instanceof DoctrineClassMetadata && ! $targetMetadata->isInheritanceTypeNone()) { |
|
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 64 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 65 | 65 | $targetEntity = "ArrayCollection<{$targetEntity}>"; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $this->namingStrategy = $namingStrategy; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - protected function loadMetadataFromFile(\ReflectionClass $class, $path):?\Metadata\ClassMetadata |
|
| 52 | + protected function loadMetadataFromFile(\ReflectionClass $class, $path): ?\Metadata\ClassMetadata |
|
| 53 | 53 | { |
| 54 | 54 | $previous = libxml_use_internal_errors(true); |
| 55 | 55 | libxml_clear_errors(); |
@@ -62,97 +62,97 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $metadata = new ClassMetadata($name = $class->name); |
| 65 | - if (!$elems = $elem->xpath("./class[@name = '" . $name . "']")) { |
|
| 65 | + if ( ! $elems = $elem->xpath("./class[@name = '".$name."']")) { |
|
| 66 | 66 | throw new RuntimeException(sprintf('Could not find class %s inside XML element.', $name)); |
| 67 | 67 | } |
| 68 | 68 | $elem = reset($elems); |
| 69 | 69 | |
| 70 | 70 | $metadata->fileResources[] = $path; |
| 71 | 71 | $metadata->fileResources[] = $class->getFileName(); |
| 72 | - $exclusionPolicy = strtoupper((string)$elem->attributes()->{'exclusion-policy'}) ?: 'NONE'; |
|
| 73 | - $excludeAll = null !== ($exclude = $elem->attributes()->exclude) ? 'true' === strtolower((string)$exclude) : false; |
|
| 74 | - $classAccessType = (string)($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
| 72 | + $exclusionPolicy = strtoupper((string) $elem->attributes()->{'exclusion-policy'}) ?: 'NONE'; |
|
| 73 | + $excludeAll = null !== ($exclude = $elem->attributes()->exclude) ? 'true' === strtolower((string) $exclude) : false; |
|
| 74 | + $classAccessType = (string) ($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
| 75 | 75 | |
| 76 | 76 | $propertiesMetadata = []; |
| 77 | 77 | $propertiesNodes = []; |
| 78 | 78 | |
| 79 | 79 | if (null !== $accessorOrder = $elem->attributes()->{'accessor-order'}) { |
| 80 | - $metadata->setAccessorOrder((string)$accessorOrder, preg_split('/\s*,\s*/', (string)$elem->attributes()->{'custom-accessor-order'})); |
|
| 80 | + $metadata->setAccessorOrder((string) $accessorOrder, preg_split('/\s*,\s*/', (string) $elem->attributes()->{'custom-accessor-order'})); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | if (null !== $xmlRootName = $elem->attributes()->{'xml-root-name'}) { |
| 84 | - $metadata->xmlRootName = (string)$xmlRootName; |
|
| 84 | + $metadata->xmlRootName = (string) $xmlRootName; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if (null !== $xmlRootNamespace = $elem->attributes()->{'xml-root-namespace'}) { |
| 88 | - $metadata->xmlRootNamespace = (string)$xmlRootNamespace; |
|
| 88 | + $metadata->xmlRootNamespace = (string) $xmlRootNamespace; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $readOnlyClass = 'true' === strtolower((string)$elem->attributes()->{'read-only'}); |
|
| 91 | + $readOnlyClass = 'true' === strtolower((string) $elem->attributes()->{'read-only'}); |
|
| 92 | 92 | |
| 93 | - $discriminatorFieldName = (string)$elem->attributes()->{'discriminator-field-name'}; |
|
| 93 | + $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'}; |
|
| 94 | 94 | $discriminatorMap = []; |
| 95 | 95 | foreach ($elem->xpath('./discriminator-class') as $entry) { |
| 96 | - if (!isset($entry->attributes()->value)) { |
|
| 96 | + if ( ! isset($entry->attributes()->value)) { |
|
| 97 | 97 | throw new RuntimeException('Each discriminator-class element must have a "value" attribute.'); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $discriminatorMap[(string)$entry->attributes()->value] = (string)$entry; |
|
| 100 | + $discriminatorMap[(string) $entry->attributes()->value] = (string) $entry; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if ('true' === (string)$elem->attributes()->{'discriminator-disabled'}) { |
|
| 103 | + if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) { |
|
| 104 | 104 | $metadata->discriminatorDisabled = true; |
| 105 | - } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) { |
|
| 105 | + } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) { |
|
| 106 | 106 | |
| 107 | 107 | $discriminatorGroups = []; |
| 108 | 108 | foreach ($elem->xpath('./discriminator-groups/group') as $entry) { |
| 109 | - $discriminatorGroups[] = (string)$entry; |
|
| 109 | + $discriminatorGroups[] = (string) $entry; |
|
| 110 | 110 | } |
| 111 | 111 | $metadata->setDiscriminator($discriminatorFieldName, $discriminatorMap, $discriminatorGroups); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) { |
| 115 | - if (!isset($xmlNamespace->attributes()->uri)) { |
|
| 115 | + if ( ! isset($xmlNamespace->attributes()->uri)) { |
|
| 116 | 116 | throw new RuntimeException('The prefix attribute must be set for all xml-namespace elements.'); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if (isset($xmlNamespace->attributes()->prefix)) { |
| 120 | - $prefix = (string)$xmlNamespace->attributes()->prefix; |
|
| 120 | + $prefix = (string) $xmlNamespace->attributes()->prefix; |
|
| 121 | 121 | } else { |
| 122 | 122 | $prefix = null; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $metadata->registerNamespace((string)$xmlNamespace->attributes()->uri, $prefix); |
|
| 125 | + $metadata->registerNamespace((string) $xmlNamespace->attributes()->uri, $prefix); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | foreach ($elem->xpath('./xml-discriminator') as $xmlDiscriminator) { |
| 129 | 129 | if (isset($xmlDiscriminator->attributes()->attribute)) { |
| 130 | - $metadata->xmlDiscriminatorAttribute = (string)$xmlDiscriminator->attributes()->attribute === 'true'; |
|
| 130 | + $metadata->xmlDiscriminatorAttribute = (string) $xmlDiscriminator->attributes()->attribute === 'true'; |
|
| 131 | 131 | } |
| 132 | 132 | if (isset($xmlDiscriminator->attributes()->cdata)) { |
| 133 | - $metadata->xmlDiscriminatorCData = (string)$xmlDiscriminator->attributes()->cdata === 'true'; |
|
| 133 | + $metadata->xmlDiscriminatorCData = (string) $xmlDiscriminator->attributes()->cdata === 'true'; |
|
| 134 | 134 | } |
| 135 | 135 | if (isset($xmlDiscriminator->attributes()->namespace)) { |
| 136 | - $metadata->xmlDiscriminatorNamespace = (string)$xmlDiscriminator->attributes()->namespace; |
|
| 136 | + $metadata->xmlDiscriminatorNamespace = (string) $xmlDiscriminator->attributes()->namespace; |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | foreach ($elem->xpath('./virtual-property') as $method) { |
| 141 | 141 | |
| 142 | 142 | if (isset($method->attributes()->expression)) { |
| 143 | - $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string)$method->attributes()->name, (string)$method->attributes()->expression); |
|
| 143 | + $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string) $method->attributes()->name, (string) $method->attributes()->expression); |
|
| 144 | 144 | } else { |
| 145 | - if (!isset($method->attributes()->method)) { |
|
| 145 | + if ( ! isset($method->attributes()->method)) { |
|
| 146 | 146 | throw new RuntimeException('The method attribute must be set for all virtual-property elements.'); |
| 147 | 147 | } |
| 148 | - $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string)$method->attributes()->method); |
|
| 148 | + $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string) $method->attributes()->method); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $propertiesMetadata[] = $virtualPropertyMetadata; |
| 152 | 152 | $propertiesNodes[] = $method; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if (!$excludeAll) { |
|
| 155 | + if ( ! $excludeAll) { |
|
| 156 | 156 | |
| 157 | 157 | foreach ($class->getProperties() as $property) { |
| 158 | 158 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $propertiesMetadata[] = new PropertyMetadata($name, $pName = $property->getName()); |
| 163 | - $pElems = $elem->xpath("./property[@name = '" . $pName . "']"); |
|
| 163 | + $pElems = $elem->xpath("./property[@name = '".$pName."']"); |
|
| 164 | 164 | |
| 165 | 165 | $propertiesNodes[] = $pElems ? reset($pElems) : null; |
| 166 | 166 | } |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | || $pMetadata instanceof ExpressionPropertyMetadata; |
| 173 | 173 | |
| 174 | 174 | $pElem = $propertiesNodes[$propertyKey]; |
| 175 | - if (!empty($pElem)) { |
|
| 175 | + if ( ! empty($pElem)) { |
|
| 176 | 176 | |
| 177 | 177 | if (null !== $exclude = $pElem->attributes()->exclude) { |
| 178 | - $isExclude = 'true' === strtolower((string)$exclude); |
|
| 178 | + $isExclude = 'true' === strtolower((string) $exclude); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | if ($isExclude) { |
@@ -183,44 +183,44 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | if (null !== $expose = $pElem->attributes()->expose) { |
| 186 | - $isExpose = 'true' === strtolower((string)$expose); |
|
| 186 | + $isExpose = 'true' === strtolower((string) $expose); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | if (null !== $excludeIf = $pElem->attributes()->{'exclude-if'}) { |
| 190 | - $pMetadata->excludeIf = (string)$excludeIf; |
|
| 190 | + $pMetadata->excludeIf = (string) $excludeIf; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if (null !== $skip = $pElem->attributes()->{'skip-when-empty'}) { |
| 194 | - $pMetadata->skipWhenEmpty = 'true' === strtolower((string)$skip); |
|
| 194 | + $pMetadata->skipWhenEmpty = 'true' === strtolower((string) $skip); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) { |
| 198 | - $pMetadata->excludeIf = "!(" . (string)$excludeIf . ")"; |
|
| 198 | + $pMetadata->excludeIf = "!(".(string) $excludeIf.")"; |
|
| 199 | 199 | $isExpose = true; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | if (null !== $version = $pElem->attributes()->{'since-version'}) { |
| 203 | - $pMetadata->sinceVersion = (string)$version; |
|
| 203 | + $pMetadata->sinceVersion = (string) $version; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | if (null !== $version = $pElem->attributes()->{'until-version'}) { |
| 207 | - $pMetadata->untilVersion = (string)$version; |
|
| 207 | + $pMetadata->untilVersion = (string) $version; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (null !== $serializedName = $pElem->attributes()->{'serialized-name'}) { |
| 211 | - $pMetadata->serializedName = (string)$serializedName; |
|
| 211 | + $pMetadata->serializedName = (string) $serializedName; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | if (null !== $type = $pElem->attributes()->type) { |
| 215 | - $pMetadata->setType($this->typeParser->parse((string)$type)); |
|
| 215 | + $pMetadata->setType($this->typeParser->parse((string) $type)); |
|
| 216 | 216 | } elseif (isset($pElem->type)) { |
| 217 | - $pMetadata->setType($this->typeParser->parse((string)$pElem->type)); |
|
| 217 | + $pMetadata->setType($this->typeParser->parse((string) $pElem->type)); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | if (null !== $groups = $pElem->attributes()->groups) { |
| 221 | - $pMetadata->groups = preg_split('/\s*,\s*/', trim((string)$groups)); |
|
| 221 | + $pMetadata->groups = preg_split('/\s*,\s*/', trim((string) $groups)); |
|
| 222 | 222 | } elseif (isset($pElem->groups)) { |
| 223 | - $pMetadata->groups = (array)$pElem->groups->value; |
|
| 223 | + $pMetadata->groups = (array) $pElem->groups->value; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | if (isset($pElem->{'xml-list'})) { |
@@ -229,21 +229,21 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | $colConfig = $pElem->{'xml-list'}; |
| 231 | 231 | if (isset($colConfig->attributes()->inline)) { |
| 232 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
| 232 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if (isset($colConfig->attributes()->{'entry-name'})) { |
| 236 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
| 236 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if (isset($colConfig->attributes()->{'skip-when-empty'})) { |
| 240 | - $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string)$colConfig->attributes()->{'skip-when-empty'}; |
|
| 240 | + $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string) $colConfig->attributes()->{'skip-when-empty'}; |
|
| 241 | 241 | } else { |
| 242 | 242 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | if (isset($colConfig->attributes()->namespace)) { |
| 246 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
| 246 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
@@ -252,56 +252,56 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $colConfig = $pElem->{'xml-map'}; |
| 254 | 254 | if (isset($colConfig->attributes()->inline)) { |
| 255 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
| 255 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | if (isset($colConfig->attributes()->{'entry-name'})) { |
| 259 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
| 259 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if (isset($colConfig->attributes()->namespace)) { |
| 263 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
| 263 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | if (isset($colConfig->attributes()->{'key-attribute-name'})) { |
| 267 | - $pMetadata->xmlKeyAttribute = (string)$colConfig->attributes()->{'key-attribute-name'}; |
|
| 267 | + $pMetadata->xmlKeyAttribute = (string) $colConfig->attributes()->{'key-attribute-name'}; |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | if (isset($pElem->{'xml-element'})) { |
| 272 | 272 | $colConfig = $pElem->{'xml-element'}; |
| 273 | 273 | if (isset($colConfig->attributes()->cdata)) { |
| 274 | - $pMetadata->xmlElementCData = 'true' === (string)$colConfig->attributes()->cdata; |
|
| 274 | + $pMetadata->xmlElementCData = 'true' === (string) $colConfig->attributes()->cdata; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | if (isset($colConfig->attributes()->namespace)) { |
| 278 | - $pMetadata->xmlNamespace = (string)$colConfig->attributes()->namespace; |
|
| 278 | + $pMetadata->xmlNamespace = (string) $colConfig->attributes()->namespace; |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | if (isset($pElem->attributes()->{'xml-attribute'})) { |
| 283 | - $pMetadata->xmlAttribute = 'true' === (string)$pElem->attributes()->{'xml-attribute'}; |
|
| 283 | + $pMetadata->xmlAttribute = 'true' === (string) $pElem->attributes()->{'xml-attribute'}; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | if (isset($pElem->attributes()->{'xml-attribute-map'})) { |
| 287 | - $pMetadata->xmlAttributeMap = 'true' === (string)$pElem->attributes()->{'xml-attribute-map'}; |
|
| 287 | + $pMetadata->xmlAttributeMap = 'true' === (string) $pElem->attributes()->{'xml-attribute-map'}; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | if (isset($pElem->attributes()->{'xml-value'})) { |
| 291 | - $pMetadata->xmlValue = 'true' === (string)$pElem->attributes()->{'xml-value'}; |
|
| 291 | + $pMetadata->xmlValue = 'true' === (string) $pElem->attributes()->{'xml-value'}; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | if (isset($pElem->attributes()->{'xml-key-value-pairs'})) { |
| 295 | - $pMetadata->xmlKeyValuePairs = 'true' === (string)$pElem->attributes()->{'xml-key-value-pairs'}; |
|
| 295 | + $pMetadata->xmlKeyValuePairs = 'true' === (string) $pElem->attributes()->{'xml-key-value-pairs'}; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | if (isset($pElem->attributes()->{'max-depth'})) { |
| 299 | - $pMetadata->maxDepth = (int)$pElem->attributes()->{'max-depth'}; |
|
| 299 | + $pMetadata->maxDepth = (int) $pElem->attributes()->{'max-depth'}; |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | //we need read-only before setter and getter set, because that method depends on flag being set |
| 303 | 303 | if (null !== $readOnly = $pElem->attributes()->{'read-only'}) { |
| 304 | - $pMetadata->readOnly = 'true' === strtolower((string)$readOnly); |
|
| 304 | + $pMetadata->readOnly = 'true' === strtolower((string) $readOnly); |
|
| 305 | 305 | } else { |
| 306 | 306 | $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass; |
| 307 | 307 | } |
@@ -309,26 +309,26 @@ discard block |
||
| 309 | 309 | $getter = $pElem->attributes()->{'accessor-getter'}; |
| 310 | 310 | $setter = $pElem->attributes()->{'accessor-setter'}; |
| 311 | 311 | $pMetadata->setAccessor( |
| 312 | - (string)($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
| 313 | - $getter ? (string)$getter : null, |
|
| 314 | - $setter ? (string)$setter : null |
|
| 312 | + (string) ($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
| 313 | + $getter ? (string) $getter : null, |
|
| 314 | + $setter ? (string) $setter : null |
|
| 315 | 315 | ); |
| 316 | 316 | |
| 317 | 317 | if (null !== $inline = $pElem->attributes()->inline) { |
| 318 | - $pMetadata->inline = 'true' === strtolower((string)$inline); |
|
| 318 | + $pMetadata->inline = 'true' === strtolower((string) $inline); |
|
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - if (!$pMetadata->serializedName) { |
|
| 322 | + if ( ! $pMetadata->serializedName) { |
|
| 323 | 323 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if (!empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 327 | - $pMetadata->name = (string)$name; |
|
| 326 | + if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 327 | + $pMetadata->name = (string) $name; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if ((ExclusionPolicy::NONE === (string)$exclusionPolicy && !$isExclude) |
|
| 331 | - || (ExclusionPolicy::ALL === (string)$exclusionPolicy && $isExpose) |
|
| 330 | + if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
| 331 | + || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
|
| 332 | 332 | ) { |
| 333 | 333 | |
| 334 | 334 | |
@@ -338,31 +338,31 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | foreach ($elem->xpath('./callback-method') as $method) { |
| 341 | - if (!isset($method->attributes()->type)) { |
|
| 341 | + if ( ! isset($method->attributes()->type)) { |
|
| 342 | 342 | throw new RuntimeException('The type attribute must be set for all callback-method elements.'); |
| 343 | 343 | } |
| 344 | - if (!isset($method->attributes()->name)) { |
|
| 344 | + if ( ! isset($method->attributes()->name)) { |
|
| 345 | 345 | throw new RuntimeException('The name attribute must be set for all callback-method elements.'); |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - switch ((string)$method->attributes()->type) { |
|
| 348 | + switch ((string) $method->attributes()->type) { |
|
| 349 | 349 | case 'pre-serialize': |
| 350 | - $metadata->addPreSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 350 | + $metadata->addPreSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 351 | 351 | break; |
| 352 | 352 | |
| 353 | 353 | case 'post-serialize': |
| 354 | - $metadata->addPostSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 354 | + $metadata->addPostSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 355 | 355 | break; |
| 356 | 356 | |
| 357 | 357 | case 'post-deserialize': |
| 358 | - $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 358 | + $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 359 | 359 | break; |
| 360 | 360 | |
| 361 | 361 | case 'handler': |
| 362 | - if (!isset($method->attributes()->format)) { |
|
| 362 | + if ( ! isset($method->attributes()->format)) { |
|
| 363 | 363 | throw new RuntimeException('The format attribute must be set for "handler" callback methods.'); |
| 364 | 364 | } |
| 365 | - if (!isset($method->attributes()->direction)) { |
|
| 365 | + if ( ! isset($method->attributes()->direction)) { |
|
| 366 | 366 | throw new RuntimeException('The direction attribute must be set for "handler" callback methods.'); |
| 367 | 367 | } |
| 368 | 368 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | class NullDriver implements DriverInterface |
| 27 | 27 | { |
| 28 | - public function loadMetadataForClass(\ReflectionClass $class):?\Metadata\ClassMetadata |
|
| 28 | + public function loadMetadataForClass(\ReflectionClass $class): ?\Metadata\ClassMetadata |
|
| 29 | 29 | { |
| 30 | 30 | $classMetadata = new ClassMetadata($name = $class->name); |
| 31 | 31 | $classMetadata->fileResources[] = $class->getFilename(); |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | $this->namingStrategy = $namingStrategy; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - protected function loadMetadataFromFile(\ReflectionClass $class, string $file):?\Metadata\ClassMetadata |
|
| 52 | + protected function loadMetadataFromFile(\ReflectionClass $class, string $file): ?\Metadata\ClassMetadata |
|
| 53 | 53 | { |
| 54 | 54 | $config = Yaml::parse(file_get_contents($file)); |
| 55 | 55 | |
| 56 | - if (!isset($config[$name = $class->name])) { |
|
| 56 | + if ( ! isset($config[$name = $class->name])) { |
|
| 57 | 57 | throw new RuntimeException(sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file)); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | $metadata->fileResources[] = $file; |
| 63 | 63 | $metadata->fileResources[] = $class->getFileName(); |
| 64 | 64 | $exclusionPolicy = isset($config['exclusion_policy']) ? strtoupper($config['exclusion_policy']) : 'NONE'; |
| 65 | - $excludeAll = isset($config['exclude']) ? (Boolean)$config['exclude'] : false; |
|
| 65 | + $excludeAll = isset($config['exclude']) ? (Boolean) $config['exclude'] : false; |
|
| 66 | 66 | $classAccessType = isset($config['access_type']) ? $config['access_type'] : PropertyMetadata::ACCESS_TYPE_PROPERTY; |
| 67 | - $readOnlyClass = isset($config['read_only']) ? (Boolean)$config['read_only'] : false; |
|
| 67 | + $readOnlyClass = isset($config['read_only']) ? (Boolean) $config['read_only'] : false; |
|
| 68 | 68 | $this->addClassProperties($metadata, $config); |
| 69 | 69 | |
| 70 | 70 | $propertiesMetadata = []; |
@@ -75,20 +75,20 @@ discard block |
||
| 75 | 75 | unset($propertySettings['exp']); |
| 76 | 76 | } else { |
| 77 | 77 | |
| 78 | - if (!$class->hasMethod($methodName)) { |
|
| 79 | - throw new RuntimeException('The method ' . $methodName . ' not found in class ' . $class->name); |
|
| 78 | + if ( ! $class->hasMethod($methodName)) { |
|
| 79 | + throw new RuntimeException('The method '.$methodName.' not found in class '.$class->name); |
|
| 80 | 80 | } |
| 81 | 81 | $virtualPropertyMetadata = new VirtualPropertyMetadata($name, $methodName); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $pName = !empty($propertySettings["name"]) ? $propertySettings["name"] : $virtualPropertyMetadata->name; |
|
| 84 | + $pName = ! empty($propertySettings["name"]) ? $propertySettings["name"] : $virtualPropertyMetadata->name; |
|
| 85 | 85 | |
| 86 | 86 | $propertiesMetadata[$pName] = $virtualPropertyMetadata; |
| 87 | 87 | $config['properties'][$pName] = $propertySettings; |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if (!$excludeAll) { |
|
| 91 | + if ( ! $excludeAll) { |
|
| 92 | 92 | foreach ($class->getProperties() as $property) { |
| 93 | 93 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 94 | 94 | continue; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $pConfig = $config['properties'][$pName]; |
| 109 | 109 | |
| 110 | 110 | if (isset($pConfig['exclude'])) { |
| 111 | - $isExclude = (Boolean)$pConfig['exclude']; |
|
| 111 | + $isExclude = (Boolean) $pConfig['exclude']; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | if ($isExclude) { |
@@ -116,35 +116,35 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (isset($pConfig['expose'])) { |
| 119 | - $isExpose = (Boolean)$pConfig['expose']; |
|
| 119 | + $isExpose = (Boolean) $pConfig['expose']; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (isset($pConfig['skip_when_empty'])) { |
| 123 | - $pMetadata->skipWhenEmpty = (Boolean)$pConfig['skip_when_empty']; |
|
| 123 | + $pMetadata->skipWhenEmpty = (Boolean) $pConfig['skip_when_empty']; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (isset($pConfig['since_version'])) { |
| 127 | - $pMetadata->sinceVersion = (string)$pConfig['since_version']; |
|
| 127 | + $pMetadata->sinceVersion = (string) $pConfig['since_version']; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (isset($pConfig['until_version'])) { |
| 131 | - $pMetadata->untilVersion = (string)$pConfig['until_version']; |
|
| 131 | + $pMetadata->untilVersion = (string) $pConfig['until_version']; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (isset($pConfig['exclude_if'])) { |
| 135 | - $pMetadata->excludeIf = (string)$pConfig['exclude_if']; |
|
| 135 | + $pMetadata->excludeIf = (string) $pConfig['exclude_if']; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (isset($pConfig['expose_if'])) { |
| 139 | - $pMetadata->excludeIf = "!(" . $pConfig['expose_if'] . ")"; |
|
| 139 | + $pMetadata->excludeIf = "!(".$pConfig['expose_if'].")"; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (isset($pConfig['serialized_name'])) { |
| 143 | - $pMetadata->serializedName = (string)$pConfig['serialized_name']; |
|
| 143 | + $pMetadata->serializedName = (string) $pConfig['serialized_name']; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if (isset($pConfig['type'])) { |
| 147 | - $pMetadata->setType($this->typeParser->parse((string)$pConfig['type'])); |
|
| 147 | + $pMetadata->setType($this->typeParser->parse((string) $pConfig['type'])); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (isset($pConfig['groups'])) { |
@@ -156,21 +156,21 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $colConfig = $pConfig['xml_list']; |
| 158 | 158 | if (isset($colConfig['inline'])) { |
| 159 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
| 159 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | if (isset($colConfig['entry_name'])) { |
| 163 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
| 163 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | if (isset($colConfig['skip_when_empty'])) { |
| 167 | - $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty']; |
|
| 167 | + $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean) $colConfig['skip_when_empty']; |
|
| 168 | 168 | } else { |
| 169 | 169 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if (isset($colConfig['namespace'])) { |
| 173 | - $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace']; |
|
| 173 | + $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace']; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -179,15 +179,15 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $colConfig = $pConfig['xml_map']; |
| 181 | 181 | if (isset($colConfig['inline'])) { |
| 182 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
| 182 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | if (isset($colConfig['entry_name'])) { |
| 186 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
| 186 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | if (isset($colConfig['namespace'])) { |
| 190 | - $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace']; |
|
| 190 | + $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace']; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if (isset($colConfig['key_attribute_name'])) { |
@@ -198,33 +198,33 @@ discard block |
||
| 198 | 198 | if (isset($pConfig['xml_element'])) { |
| 199 | 199 | $colConfig = $pConfig['xml_element']; |
| 200 | 200 | if (isset($colConfig['cdata'])) { |
| 201 | - $pMetadata->xmlElementCData = (Boolean)$colConfig['cdata']; |
|
| 201 | + $pMetadata->xmlElementCData = (Boolean) $colConfig['cdata']; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | if (isset($colConfig['namespace'])) { |
| 205 | - $pMetadata->xmlNamespace = (string)$colConfig['namespace']; |
|
| 205 | + $pMetadata->xmlNamespace = (string) $colConfig['namespace']; |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if (isset($pConfig['xml_attribute'])) { |
| 210 | - $pMetadata->xmlAttribute = (Boolean)$pConfig['xml_attribute']; |
|
| 210 | + $pMetadata->xmlAttribute = (Boolean) $pConfig['xml_attribute']; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | if (isset($pConfig['xml_attribute_map'])) { |
| 214 | - $pMetadata->xmlAttributeMap = (Boolean)$pConfig['xml_attribute_map']; |
|
| 214 | + $pMetadata->xmlAttributeMap = (Boolean) $pConfig['xml_attribute_map']; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | if (isset($pConfig['xml_value'])) { |
| 218 | - $pMetadata->xmlValue = (Boolean)$pConfig['xml_value']; |
|
| 218 | + $pMetadata->xmlValue = (Boolean) $pConfig['xml_value']; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | if (isset($pConfig['xml_key_value_pairs'])) { |
| 222 | - $pMetadata->xmlKeyValuePairs = (Boolean)$pConfig['xml_key_value_pairs']; |
|
| 222 | + $pMetadata->xmlKeyValuePairs = (Boolean) $pConfig['xml_key_value_pairs']; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | //we need read_only before setter and getter set, because that method depends on flag being set |
| 226 | 226 | if (isset($pConfig['read_only'])) { |
| 227 | - $pMetadata->readOnly = (Boolean)$pConfig['read_only']; |
|
| 227 | + $pMetadata->readOnly = (Boolean) $pConfig['read_only']; |
|
| 228 | 228 | } else { |
| 229 | 229 | $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass; |
| 230 | 230 | } |
@@ -236,15 +236,15 @@ discard block |
||
| 236 | 236 | ); |
| 237 | 237 | |
| 238 | 238 | if (isset($pConfig['inline'])) { |
| 239 | - $pMetadata->inline = (Boolean)$pConfig['inline']; |
|
| 239 | + $pMetadata->inline = (Boolean) $pConfig['inline']; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | if (isset($pConfig['max_depth'])) { |
| 243 | - $pMetadata->maxDepth = (int)$pConfig['max_depth']; |
|
| 243 | + $pMetadata->maxDepth = (int) $pConfig['max_depth']; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - if (!$pMetadata->serializedName) { |
|
| 247 | + if ( ! $pMetadata->serializedName) { |
|
| 248 | 248 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 249 | 249 | } |
| 250 | 250 | |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | $pConfig = $config['properties'][$pName]; |
| 253 | 253 | |
| 254 | 254 | if (isset($pConfig['name'])) { |
| 255 | - $pMetadata->name = (string)$pConfig['name']; |
|
| 255 | + $pMetadata->name = (string) $pConfig['name']; |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 259 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 260 | 260 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 261 | 261 | ) { |
| 262 | 262 | $metadata->addPropertyMetadata($pMetadata); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | private function addClassProperties(ClassMetadata $metadata, array $config) |
| 290 | 290 | { |
| 291 | - if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) { |
|
| 291 | + if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) { |
|
| 292 | 292 | $config['accessor_order'] = 'custom'; |
| 293 | 293 | } |
| 294 | 294 | |
@@ -297,11 +297,11 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if (isset($config['xml_root_name'])) { |
| 300 | - $metadata->xmlRootName = (string)$config['xml_root_name']; |
|
| 300 | + $metadata->xmlRootName = (string) $config['xml_root_name']; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | if (isset($config['xml_root_namespace'])) { |
| 304 | - $metadata->xmlRootNamespace = (string)$config['xml_root_namespace']; |
|
| 304 | + $metadata->xmlRootNamespace = (string) $config['xml_root_namespace']; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | if (array_key_exists('xml_namespaces', $config)) { |
@@ -315,25 +315,25 @@ discard block |
||
| 315 | 315 | if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) { |
| 316 | 316 | $metadata->discriminatorDisabled = true; |
| 317 | 317 | } else { |
| 318 | - if (!isset($config['discriminator']['field_name'])) { |
|
| 318 | + if ( ! isset($config['discriminator']['field_name'])) { |
|
| 319 | 319 | throw new RuntimeException('The "field_name" attribute must be set for discriminators.'); |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - if (!isset($config['discriminator']['map']) || !\is_array($config['discriminator']['map'])) { |
|
| 322 | + if ( ! isset($config['discriminator']['map']) || ! \is_array($config['discriminator']['map'])) { |
|
| 323 | 323 | throw new RuntimeException('The "map" attribute must be set, and be an array for discriminators.'); |
| 324 | 324 | } |
| 325 | 325 | $groups = isset($config['discriminator']['groups']) ? $config['discriminator']['groups'] : []; |
| 326 | 326 | $metadata->setDiscriminator($config['discriminator']['field_name'], $config['discriminator']['map'], $groups); |
| 327 | 327 | |
| 328 | 328 | if (isset($config['discriminator']['xml_attribute'])) { |
| 329 | - $metadata->xmlDiscriminatorAttribute = (bool)$config['discriminator']['xml_attribute']; |
|
| 329 | + $metadata->xmlDiscriminatorAttribute = (bool) $config['discriminator']['xml_attribute']; |
|
| 330 | 330 | } |
| 331 | 331 | if (isset($config['discriminator']['xml_element'])) { |
| 332 | 332 | if (isset($config['discriminator']['xml_element']['cdata'])) { |
| 333 | - $metadata->xmlDiscriminatorCData = (bool)$config['discriminator']['xml_element']['cdata']; |
|
| 333 | + $metadata->xmlDiscriminatorCData = (bool) $config['discriminator']['xml_element']['cdata']; |
|
| 334 | 334 | } |
| 335 | 335 | if (isset($config['discriminator']['xml_element']['namespace'])) { |
| 336 | - $metadata->xmlDiscriminatorNamespace = (string)$config['discriminator']['xml_element']['namespace']; |
|
| 336 | + $metadata->xmlDiscriminatorNamespace = (string) $config['discriminator']['xml_element']['namespace']; |
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | } |
@@ -344,13 +344,13 @@ discard block |
||
| 344 | 344 | { |
| 345 | 345 | if (\is_string($config)) { |
| 346 | 346 | $config = [$config]; |
| 347 | - } elseif (!\is_array($config)) { |
|
| 347 | + } elseif ( ! \is_array($config)) { |
|
| 348 | 348 | throw new RuntimeException(sprintf('callback methods expects a string, or an array of strings that represent method names, but got %s.', json_encode($config['pre_serialize']))); |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | $methods = []; |
| 352 | 352 | foreach ($config as $name) { |
| 353 | - if (!$class->hasMethod($name)) { |
|
| 353 | + if ( ! $class->hasMethod($name)) { |
|
| 354 | 354 | throw new RuntimeException(sprintf('The method %s does not exist in class %s.', $name, $class->name)); |
| 355 | 355 | } |
| 356 | 356 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $classMetadata = $this->delegate->loadMetadataForClass($class); |
| 89 | 89 | |
| 90 | 90 | // Abort if the given class is not a mapped entity |
| 91 | - if (!$doctrineMetadata = $this->tryLoadingDoctrineMetadata($class->name)) { |
|
| 91 | + if ( ! $doctrineMetadata = $this->tryLoadingDoctrineMetadata($class->name)) { |
|
| 92 | 92 | return $classMetadata; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | protected function tryLoadingDoctrineMetadata(string $className): ?DoctrineClassMetadata |
| 155 | 155 | { |
| 156 | - if (!$manager = $this->registry->getManagerForClass($className)) { |
|
| 156 | + if ( ! $manager = $this->registry->getManagerForClass($className)) { |
|
| 157 | 157 | return null; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | protected function normalizeFieldType($type): ?string |
| 168 | 168 | { |
| 169 | - if (!isset($this->fieldMapping[$type])) { |
|
| 169 | + if ( ! isset($this->fieldMapping[$type])) { |
|
| 170 | 170 | return null; |
| 171 | 171 | } |
| 172 | 172 | |