I am trying to access/change the properties of a class’ Parent through Reflection.
If I run ReflectionClass::getProperties() on the child, does it also return any properties that the Parent has as well?
If it doesn’t, is there any way to access the parent properties using Reflection?
I worked up this quick test. It looks like private properties of the parent are hidden when you get the child classes’s properties. However, if you invoke
getParentClass()thengetProperties()you will have the missing set of private props.Output (notice the private prop
Ford::modelis missing):Second Chunk (contains all the properties of the Ford class):