@@ -130,33 +130,33 @@ |
||
| 130 | 130 | |
| 131 | 131 | switch ($type['name']) { |
| 132 | 132 | case 'NULL': |
| 133 | - if (!$this->shouldSerializeNull) { |
|
| 133 | + if ( ! $this->shouldSerializeNull) { |
|
| 134 | 134 | throw new NotAcceptableException(); |
| 135 | 135 | } |
| 136 | 136 | return $this->visitor->visitNull($data, $type); |
| 137 | 137 | |
| 138 | 138 | case 'string': |
| 139 | - return $this->visitor->visitString((string)$data, $type); |
|
| 139 | + return $this->visitor->visitString((string) $data, $type); |
|
| 140 | 140 | |
| 141 | 141 | case 'int': |
| 142 | 142 | case 'integer': |
| 143 | - return $this->visitor->visitInteger((int)$data, $type); |
|
| 143 | + return $this->visitor->visitInteger((int) $data, $type); |
|
| 144 | 144 | |
| 145 | 145 | case 'bool': |
| 146 | 146 | case 'boolean': |
| 147 | - return $this->visitor->visitBoolean((bool)$data, $type); |
|
| 147 | + return $this->visitor->visitBoolean((bool) $data, $type); |
|
| 148 | 148 | |
| 149 | 149 | case 'double': |
| 150 | 150 | case 'float': |
| 151 | - return $this->visitor->visitDouble((float)$data, $type); |
|
| 151 | + return $this->visitor->visitDouble((float) $data, $type); |
|
| 152 | 152 | |
| 153 | 153 | case 'array': |
| 154 | - return $this->visitor->visitArray((array)$data, $type); |
|
| 154 | + return $this->visitor->visitArray((array) $data, $type); |
|
| 155 | 155 | |
| 156 | 156 | case 'resource': |
| 157 | 157 | $msg = 'Resources are not supported in serialized data.'; |
| 158 | 158 | if (null !== $path = $this->context->getPath()) { |
| 159 | - $msg .= ' Path: ' . $path; |
|
| 159 | + $msg .= ' Path: '.$path; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | throw new RuntimeException($msg); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | private function getNavigator(int $direction): GraphNavigatorInterface |
| 139 | 139 | { |
| 140 | - if (!isset($this->graphNavigators[$direction])) { |
|
| 140 | + if ( ! isset($this->graphNavigators[$direction])) { |
|
| 141 | 141 | throw new RuntimeException( |
| 142 | 142 | sprintf( |
| 143 | 143 | 'Can not find a graph navigator for the direction "%s".', |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | ? $this->serializationVisitors |
| 156 | 156 | : $this->deserializationVisitors; |
| 157 | 157 | |
| 158 | - if (!isset($factories[$format])) { |
|
| 158 | + if ( ! isset($factories[$format])) { |
|
| 159 | 159 | throw new UnsupportedFormatException( |
| 160 | 160 | sprintf( |
| 161 | 161 | 'The format "%s" is not supported for %s.', $format, |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $result = $this->visit($navigator, $visitor, $context, $data, 'json', $type); |
| 212 | 212 | $result = $this->convertArrayObjects($result); |
| 213 | 213 | |
| 214 | - if (!\is_array($result)) { |
|
| 214 | + if ( ! \is_array($result)) { |
|
| 215 | 215 | throw new RuntimeException(sprintf( |
| 216 | 216 | 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', |
| 217 | 217 | \is_object($data) ? \get_class($data) : \gettype($data), |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | private function convertArrayObjects($data) |
| 263 | 263 | { |
| 264 | 264 | if ($data instanceof \ArrayObject || $data instanceof \stdClass) { |
| 265 | - $data = (array)$data; |
|
| 265 | + $data = (array) $data; |
|
| 266 | 266 | } |
| 267 | 267 | if (\is_array($data)) { |
| 268 | 268 | foreach ($data as $k => $v) { |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | |
| 41 | 41 | public function enableExternalEntities(bool $enable = true): self |
| 42 | 42 | { |
| 43 | - $this->disableExternalEntities = !$enable; |
|
| 43 | + $this->disableExternalEntities = ! $enable; |
|
| 44 | 44 | return $this; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | |
| 68 | 68 | public function setFormatOutput(bool $formatOutput): self |
| 69 | 69 | { |
| 70 | - $this->formatOutput = (boolean)$formatOutput; |
|
| 70 | + $this->formatOutput = (boolean) $formatOutput; |
|
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | public function setOptions(int $options): self |
| 44 | 44 | { |
| 45 | - $this->options = (integer)$options; |
|
| 45 | + $this->options = (integer) $options; |
|
| 46 | 46 | return $this; |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $this->addExclusionStrategy(new VersionExclusionStrategy($this->attributes['version'])); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if (!empty($this->attributes['max_depth_checks'])) { |
|
| 92 | + if ( ! empty($this->attributes['max_depth_checks'])) { |
|
| 93 | 93 | $this->addExclusionStrategy(new DepthExclusionStrategy()); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | private function assertMutable(): void |
| 138 | 138 | { |
| 139 | - if (!$this->initialized) { |
|
| 139 | + if ( ! $this->initialized) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | throw new LogicException('The groups must not be empty.'); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - $this->attributes['groups'] = (array)$groups; |
|
| 171 | + $this->attributes['groups'] = (array) $groups; |
|
| 172 | 172 | |
| 173 | 173 | return $this; |
| 174 | 174 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | { |
| 226 | 226 | $metadata = $this->metadataStack->pop(); |
| 227 | 227 | |
| 228 | - if (!$metadata instanceof PropertyMetadata) { |
|
| 228 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
| 229 | 229 | throw new RuntimeException('Context metadataStack not working well'); |
| 230 | 230 | } |
| 231 | 231 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | { |
| 235 | 235 | $metadata = $this->metadataStack->pop(); |
| 236 | 236 | |
| 237 | - if (!$metadata instanceof ClassMetadata) { |
|
| 237 | + if ( ! $metadata instanceof ClassMetadata) { |
|
| 238 | 238 | throw new RuntimeException('Context metadataStack not working well'); |
| 239 | 239 | } |
| 240 | 240 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function getCurrentPath(): array |
| 251 | 251 | { |
| 252 | - if (!$this->metadataStack) { |
|
| 252 | + if ( ! $this->metadataStack) { |
|
| 253 | 253 | return []; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | public function createDriver(array $metadataDirs, Reader $reader): DriverInterface |
| 24 | 24 | { |
| 25 | 25 | $driver = \call_user_func($this->callback, $metadataDirs, $reader); |
| 26 | - if (!$driver instanceof DriverInterface) { |
|
| 26 | + if ( ! $driver instanceof DriverInterface) { |
|
| 27 | 27 | throw new LogicException('The callback must return an instance of DriverInterface.'); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | public function createDriver(array $metadataDirs, Reader $annotationReader): DriverInterface |
| 33 | 33 | { |
| 34 | - if (!empty($metadataDirs)) { |
|
| 34 | + if ( ! empty($metadataDirs)) { |
|
| 35 | 35 | $fileLocator = new FileLocator($metadataDirs); |
| 36 | 36 | |
| 37 | 37 | return new DriverChain([ |
@@ -53,7 +53,7 @@ discard block |
||
| 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 | |