Skip to content

Commit

Permalink
Fix root directory to data path
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoern-hempel committed Dec 31, 2022
1 parent a44b55a commit f2ff74e
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit f2ff74e

Please sign in to comment.