While refactoring some code into a reusable PHP Class I hit a brief roadblock where some code expected the [__FILE__
magic constant][file] file path. Since that value always refers to the specific file it's called from, it won't work from a separate Class file because the referenced path would be the parent instead of the child.
The full filepath of a child Class can be inferred from an inherited parent Class method by combining [get_class($this)
][get_class] or [get_called_class()
][get_called_class] with the [ReflectionClass::getFileName
][getfilename] method like this:
// ParentClass.php
class ParentClass
{