comparison vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
253 253
254 if ($type->isCollection() && null !== ($collectionValueType = $type->getCollectionValueType()) && Type::BUILTIN_TYPE_OBJECT === $collectionValueType->getBuiltinType()) { 254 if ($type->isCollection() && null !== ($collectionValueType = $type->getCollectionValueType()) && Type::BUILTIN_TYPE_OBJECT === $collectionValueType->getBuiltinType()) {
255 $builtinType = Type::BUILTIN_TYPE_OBJECT; 255 $builtinType = Type::BUILTIN_TYPE_OBJECT;
256 $class = $collectionValueType->getClassName().'[]'; 256 $class = $collectionValueType->getClassName().'[]';
257 257
258 // Fix a collection that contains the only one element
259 // This is special to xml format only
260 if ('xml' === $format && !is_int(key($data))) {
261 $data = array($data);
262 }
263
258 if (null !== $collectionKeyType = $type->getCollectionKeyType()) { 264 if (null !== $collectionKeyType = $type->getCollectionKeyType()) {
259 $context['key_type'] = $collectionKeyType; 265 $context['key_type'] = $collectionKeyType;
260 } 266 }
261 } else { 267 } else {
262 $builtinType = $type->getBuiltinType(); 268 $builtinType = $type->getBuiltinType();
299 } 305 }
300 306
301 /** 307 /**
302 * Sets an attribute and apply the name converter if necessary. 308 * Sets an attribute and apply the name converter if necessary.
303 * 309 *
304 * @param array $data
305 * @param string $attribute 310 * @param string $attribute
306 * @param mixed $attributeValue 311 * @param mixed $attributeValue
307 * 312 *
308 * @return array 313 * @return array
309 */ 314 */
330 */ 335 */
331 private function isMaxDepthReached(array $attributesMetadata, $class, $attribute, array &$context) 336 private function isMaxDepthReached(array $attributesMetadata, $class, $attribute, array &$context)
332 { 337 {
333 if ( 338 if (
334 !isset($context[static::ENABLE_MAX_DEPTH]) || 339 !isset($context[static::ENABLE_MAX_DEPTH]) ||
340 !$context[static::ENABLE_MAX_DEPTH] ||
335 !isset($attributesMetadata[$attribute]) || 341 !isset($attributesMetadata[$attribute]) ||
336 null === $maxDepth = $attributesMetadata[$attribute]->getMaxDepth() 342 null === $maxDepth = $attributesMetadata[$attribute]->getMaxDepth()
337 ) { 343 ) {
338 return false; 344 return false;
339 } 345 }