<?php
$a = new \ReflectionClass('ZN\Database\InternalDB');
var_dump($a->getFileName());
// Output: C:\xampp7\htdocs\develop\Internal\Database\DB\InternalDB.php
(PHP 5, PHP 7, PHP 8)
ReflectionClass::getFileName — Obtiene el nombre del fichero donde la clase ha sido declarada
Obtiene el nombre del fichero donde la clase ha sido declarada.
Esta función no contiene ningún parámetro.
Obtiene el nombre del fichero donde la clase ha sido declarada.
Si la clase es declarada en el núcleo de PHP o en una extensión PHP,
false
es devuelto.
<?php
$a = new \ReflectionClass('ZN\Database\InternalDB');
var_dump($a->getFileName());
// Output: C:\xampp7\htdocs\develop\Internal\Database\DB\InternalDB.php
Please note that returned value from this function is actually realpath of the file and if your file is symlink, target of the link will return.