Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Sep 22, 2019
2 parents 991ed9a + 6924b39 commit 3c65796
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Util/Standards.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ class Standards


/**
* Get a list paths where standards are installed.
* Get a list of paths where standards are installed.
*
* Unresolvable relative paths will be excluded from the results.
*
* @return array
*/
Expand All @@ -34,6 +36,9 @@ public static function getInstalledStandardPaths()
foreach ($installedPaths as $installedPath) {
if (substr($installedPath, 0, 1) === '.') {
$installedPath = Common::realPath(__DIR__.$ds.'..'.$ds.'..'.$ds.$installedPath);
if ($installedPath === false) {
continue;
}
}

$resolvedInstalledPaths[] = $installedPath;
Expand Down Expand Up @@ -229,6 +234,9 @@ public static function isInstalledStandard($standard)
// This could be a custom standard, installed outside our
// standards directory.
$standard = Common::realPath($standard);
if ($standard === false) {
return false;
}

// Might be an actual ruleset file itUtil.
// If it has an XML extension, let's at least try it.
Expand Down Expand Up @@ -282,7 +290,7 @@ public static function getInstalledStandardPath($standard)

$path = Common::realpath($standardPath.DIRECTORY_SEPARATOR.'ruleset.xml');

if (is_file($path) === true) {
if ($path !== false && is_file($path) === true) {
return $path;
} else if (Common::isPharFile($standardPath) === true) {
$path = Common::realpath($standardPath);
Expand Down

0 comments on commit 3c65796

Please sign in to comment.