In Symfony2, I saw the code as shown below:
if (null === $this->rootDir) {
$r = new \ReflectionObject($this);
$this->rootDir = dirname($r->getFileName());
}
why not just use it __DIR__?
if (null === $this->rootDir) {
$this->rootDir = __DIR__;
}
What is the difference between the two?
source
share