Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4: (31 commits)
  [Messenger] Add call to `gc_collect_cycles()` after each message is handled
  fix tests
  fix tests on AppVeyor
  Hungarian typo fix in validators translation
  [VarDump] Fix order of dumped properties - parent goes first
  DX: drop unused import
  [Validator] updated Latvian translation
  re-introduce conflict rule with WebProfilerBundle < 6.4
  [Validator] Added missing Swedish translations
  [Mailer] [Notifier] #52264 Update Sendinblue / Brevo API host
  [Validator] Added missing Estonian translations #51939
  fix File constraint tests on 32bit PHP
  [Form] Skip merging params & files if there are no files in the first place
  [Translation] Ignore bridges in `.gitattributes` file
  [AssetMapper] Adding import-parsing case where import contains a path
  Add missing Hungarian validator translations
  Added missing Bosnian translations #51929
  add return type hints to EntityFactory
  Update UndefinedCallableHandler with "importmap", "form" and "worflow" filters/functions
  [FrameworkBundle] Fix CommandDataCollector is always registered
  ...
  • Loading branch information
xabbuh committed Oct 25, 2023
2 parents e62cd00 + 44d76a0 commit e758122
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Caster/Caster.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ private static function getClassProperties(\ReflectionClass $class): array
$classProperties = [];
$className = $class->name;

if ($parent = $class->getParentClass()) {
$classProperties += self::$classProperties[$parent->name] ??= self::getClassProperties($parent);
}

foreach ($class->getProperties() as $p) {
if ($p->isStatic()) {
continue;
Expand All @@ -189,10 +193,6 @@ private static function getClassProperties(\ReflectionClass $class): array
}] = new UninitializedStub($p);
}

if ($parent = $class->getParentClass()) {
$classProperties += self::$classProperties[$parent->name] ??= self::getClassProperties($parent);
}

return $classProperties;
}
}
28 changes: 28 additions & 0 deletions Tests/Caster/CasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,32 @@ public function __debugInfo(): array
}
});
}

public function testClassHierarchy()
{
$this->assertDumpMatchesFormat(<<<'DUMP'
Symfony\Component\VarDumper\Tests\Caster\B {
+a: "a"
#b: "b"
-c: "c"
+d: "d"
#e: "e"
-f: "f"
}
DUMP, new B());
}
}

class A
{
public $a = 'a';
protected $b = 'b';
private $c = 'c';
}

class B extends A
{
public $d = 'd';
protected $e = 'e';
private $f = 'f';
}

0 comments on commit e758122

Please sign in to comment.