Skip to content

Commit f783dc7

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Increase the inlining YAML level for config:debug [Serializer] Minor: fix CS and PHPDoc [Form] fix tests [Serializer] Ensure that groups are strings [Debug] Tell that the extension is for PHP 5 only Static code analysis Update AnnotationDirectoryLoader.php added a test Escape the delimiter in Glob::toRegex [FrameworkBundle] Fix template location for PHP templates [FrameworkBundle] Add path verification to the template parsing test cases
2 parents 2e2ca63 + c250801 commit f783dc7

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed

Mapping/Factory/ClassMetadataFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
2727
* @var LoaderInterface
2828
*/
2929
private $loader;
30+
3031
/**
3132
* @var Cache
3233
*/
3334
private $cache;
35+
3436
/**
3537
* @var array
3638
*/

Mapping/Loader/YamlFileLoader.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata)
6565

6666
if (isset($yaml['attributes']) && is_array($yaml['attributes'])) {
6767
$attributesMetadata = $classMetadata->getAttributesMetadata();
68+
6869
foreach ($yaml['attributes'] as $attribute => $data) {
6970
if (isset($attributesMetadata[$attribute])) {
7071
$attributeMetadata = $attributesMetadata[$attribute];
@@ -74,7 +75,15 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata)
7475
}
7576

7677
if (isset($data['groups'])) {
78+
if (!is_array($data['groups'])) {
79+
throw new MappingException('The "groups" key must be an array of strings in "%s" for the attribute "%s" of the class "%s".', $this->file, $attribute, $classMetadata->getName());
80+
}
81+
7782
foreach ($data['groups'] as $group) {
83+
if (!is_string($group)) {
84+
throw new MappingException('Group names must be strings in "%s" for the attribute "%s" of the class "%s".', $this->file, $attribute, $classMetadata->getName());
85+
}
86+
7887
$attributeMetadata->addGroup($group);
7988
}
8089
}

NameConverter/CamelCaseToSnakeCaseNameConverter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class CamelCaseToSnakeCaseNameConverter implements NameConverterInterface
2222
* @var array|null
2323
*/
2424
private $attributes;
25+
2526
/**
2627
* @var bool
2728
*/

Normalizer/AbstractNormalizer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,32 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
3535
* @var int
3636
*/
3737
protected $circularReferenceLimit = 1;
38+
3839
/**
3940
* @var callable
4041
*/
4142
protected $circularReferenceHandler;
43+
4244
/**
4345
* @var ClassMetadataFactoryInterface|null
4446
*/
4547
protected $classMetadataFactory;
48+
4649
/**
4750
* @var NameConverterInterface|null
4851
*/
4952
protected $nameConverter;
53+
5054
/**
5155
* @var array
5256
*/
5357
protected $callbacks = array();
58+
5459
/**
5560
* @var array
5661
*/
5762
protected $ignoredAttributes = array();
63+
5864
/**
5965
* @var array
6066
*/

Serializer.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,22 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
4141
* @var Encoder\ChainEncoder
4242
*/
4343
protected $encoder;
44+
4445
/**
4546
* @var Encoder\ChainDecoder
4647
*/
4748
protected $decoder;
49+
4850
/**
4951
* @var array
5052
*/
5153
protected $normalizers = array();
54+
5255
/**
5356
* @var array
5457
*/
5558
protected $normalizerCache = array();
59+
5660
/**
5761
* @var array
5862
*/
@@ -247,8 +251,10 @@ private function denormalizeObject($data, $class, $format, array $context = arra
247251
}
248252

249253
foreach ($this->normalizers as $normalizer) {
250-
if ($normalizer instanceof DenormalizerInterface
251-
&& $normalizer->supportsDenormalization($data, $class, $format)) {
254+
if (
255+
$normalizer instanceof DenormalizerInterface &&
256+
$normalizer->supportsDenormalization($data, $class, $format)
257+
) {
252258
return $normalizer->denormalize($data, $class, $format, $context);
253259
}
254260
}

Tests/Normalizer/GetSetMethodNormalizerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,6 @@ public function provideCallbacks()
420420
array(
421421
array(
422422
'bar' => function ($bar) {
423-
return;
424423
},
425424
),
426425
'baz',

0 commit comments

Comments
 (0)