Don't forget, since 5.5 you can use class keyword for the class name resolution, which would be a lot faster than calling get_class($this)
. The accepted solution would look like this:
protected function getDir() {
return dirname((new ReflectionClass(static::class))->getFileName());
}