Skip to content

Commit

Permalink
Merge branch 'autoload-relative' of https://github.com/klausi/PHP_Cod…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Dec 8, 2019
2 parents 1811a01 + 5e124a8 commit 08e033e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Ruleset.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,13 @@ public function processRuleset($rulesetPath, $depth=0)
}

$autoloadPath = (string) $autoload;
if (is_file($autoloadPath) === false) {
$autoloadPath = Util\Common::realPath(dirname($rulesetPath).DIRECTORY_SEPARATOR.$autoloadPath);
}

if ($autoloadPath === false) {
// Try relative autoload paths first.
$relativePath = Util\Common::realPath(dirname($rulesetPath).DIRECTORY_SEPARATOR.$autoloadPath);

if ($relativePath !== false && is_file($$relativePath) === true) {
$autoloadPath = $relativePath;
} else if (is_file($autoloadPath) === false) {
throw new RuntimeException('The specified autoload file "'.$autoload.'" does not exist');
}

Expand Down

0 comments on commit 08e033e

Please sign in to comment.