I am trying to get the filename of the class which is the child of the top of the hierarchy, where the depth of the class hierarchy is not known.
I.e. I'm trying to work out what code to put inside baseApplicationClass in order to get the filename of myApplicationClass, which will work in both examples:
baseApplicationClass L abstract myApplicationClass extends baseApplicationClass L myInstanceClass extends myApplicationClass and
baseApplicationClass L myApplicationClass extends baseApplicationClass Using get_class ($this) doesn't work, because that gives an inconsistent result between these two examples.
In both cases, I need to get the filename of myApplicationClass.
Note that the baseApplicationClass obviously has a known name, whereas the other one/two classes do not.
With a two-level hierarchy (i.e. second example), I can obviously do:
$reflector = new ReflectionClass (get_class ($this)); $applicationRoot = dirname ($reflector->getFileName ()); but this fails for a three-level hierarchy.