File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,10 @@ private static function getClassProperties(\ReflectionClass $class): array
177177 $ classProperties = [];
178178 $ className = $ class ->name ;
179179
180+ if ($ parent = $ class ->getParentClass ()) {
181+ $ classProperties += self ::$ classProperties [$ parent ->name ] ??= self ::getClassProperties ($ parent );
182+ }
183+
180184 foreach ($ class ->getProperties () as $ p ) {
181185 if ($ p ->isStatic ()) {
182186 continue ;
@@ -189,10 +193,6 @@ private static function getClassProperties(\ReflectionClass $class): array
189193 }] = new UninitializedStub ($ p );
190194 }
191195
192- if ($ parent = $ class ->getParentClass ()) {
193- $ classProperties += self ::$ classProperties [$ parent ->name ] ??= self ::getClassProperties ($ parent );
194- }
195-
196196 return $ classProperties ;
197197 }
198198}
Original file line number Diff line number Diff line change @@ -185,4 +185,29 @@ public function __debugInfo(): array
185185 }
186186 });
187187 }
188+
189+ public function testClassHierarchy ()
190+ {
191+ $ this ->assertDumpMatchesFormat (<<<'DUMP'
192+ Symfony\Component\VarDumper\Tests\Caster\B {
193+ +a: "a"
194+ #b: "b"
195+ -c: "c"
196+ +d: "d"
197+ #e: "e"
198+ -f: "f"
199+ }
200+ DUMP, new B ());
201+ }
202+ }
203+
204+ class A {
205+ public $ a = 'a ' ;
206+ protected $ b = 'b ' ;
207+ private $ c = 'c ' ;
208+ }
209+ class B extends A {
210+ public $ d = 'd ' ;
211+ protected $ e = 'e ' ;
212+ private $ f = 'f ' ;
188213}
You can’t perform that action at this time.
0 commit comments