From f2ff74ed783442cfe046eae764ed95252ef9ba2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Hempel?= Date: Sat, 31 Dec 2022 22:29:46 +0100 Subject: [PATCH] Fix root directory to data path --- src/Validator.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Validator.php b/src/Validator.php index 6448e32..963ade6 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -62,23 +62,14 @@ public function __construct(protected File|Json $data, protected File|Json $sche * Returns the root directory of this project. * * @return string - * @throws FileNotFoundException */ private function getDirectoryRoot(): string { - if (!is_null($this->directoryRoot)) { - return $this->directoryRoot; - } - - $reflection = new ReflectionClass(ClassLoader::class); - - $fileName = $reflection->getFileName(); - - if ($fileName === false) { - throw new FileNotFoundException('reflection-class'); + if (is_null($this->directoryRoot)) { + $this->directoryRoot = dirname(__FILE__, 2); } - return dirname($fileName, 3); + return $this->directoryRoot; } /**