Skip to content

Commit 19eb098

Browse files
Merge branch '3.4'
* 3.4: [Bridge/PhpUnit] Sync the bridge version installed in vendor/ and in phpunit clone [DI] Analyze setter-circular deps more precisely fixing that PropertyNormalizer supports parent properties [SecurityBundle] Don't trigger auto-picking notice if provider is set per listener [TwigBundle][FrameworkBundle] Remove the internals from debug autowiring [DI] Skip hot_path tag for deprecated services as their class might also be [Cache] Memcached options should ignore "lazy" [FrameworkBundle] Dont create empty bundles directory
2 parents ec333c9 + ae0d71a commit 19eb098

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

Normalizer/PropertyNormalizer.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ private function supports(string $class): bool
5656
$class = new \ReflectionClass($class);
5757

5858
// We look for at least one non-static property
59-
foreach ($class->getProperties() as $property) {
60-
if (!$property->isStatic()) {
61-
return true;
59+
do {
60+
foreach ($class->getProperties() as $property) {
61+
if (!$property->isStatic()) {
62+
return true;
63+
}
6264
}
63-
}
65+
} while ($class = $class->getParentClass());
6466

6567
return false;
6668
}

Tests/Normalizer/PropertyNormalizerTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,11 @@ public function testMaxDepth()
441441

442442
$this->assertEquals($expected, $result);
443443
}
444+
445+
public function testInheritedPropertiesSupport()
446+
{
447+
$this->assertTrue($this->normalizer->supportsNormalization(new PropertyChildDummy()));
448+
}
444449
}
445450

446451
class PropertyDummy
@@ -509,3 +514,12 @@ class StaticPropertyDummy
509514
{
510515
private static $property = 'value';
511516
}
517+
518+
class PropertyParentDummy
519+
{
520+
private $foo = 'bar';
521+
}
522+
523+
class PropertyChildDummy extends PropertyParentDummy
524+
{
525+
}

0 commit comments

Comments
 (0)