Skip to content

Commit

Permalink
fix: update code to check for class existence
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Oct 6, 2023
1 parent a1143c7 commit 83566ae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion system/CLI/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function discoverCommands()
foreach ($files as $file) {
$className = $locator->findQualifiedNameFromPath($file);

if ($className === '' || ! class_exists($className)) {
if ($className === false || ! class_exists($className)) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion system/Config/Factories.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class_exists($alias, false)
foreach ($files as $file) {
$class = $locator->findQualifiedNameFromPath($file);

if ($class && self::verifyInstanceOf($options, $class)) {
if ($class !== false && self::verifyInstanceOf($options, $class)) {
return $class;
}
}
Expand Down
2 changes: 1 addition & 1 deletion system/Publisher/Publisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ final public static function discover(string $directory = 'Publishers'): array
foreach (array_unique($files) as $file) {
$className = $locator->findQualifiedNameFromPath($file);

if ($className !== '' && class_exists($className) && is_a($className, self::class, true)) {
if ($className !== false && class_exists($className) && is_a($className, self::class, true)) {
self::$discovered[$directory][] = new $className();
}
}
Expand Down

0 comments on commit 83566ae

Please sign in to comment.