diff --git a/src/ModuleAutoloader.php b/src/ModuleAutoloader.php index feb020f..711d7a5 100644 --- a/src/ModuleAutoloader.php +++ b/src/ModuleAutoloader.php @@ -103,9 +103,13 @@ public function autoload($class) $moduleName = substr($class, 0, -7); if (isset($this->explicitPaths[$moduleName])) { - if ($classLoaded = $this->loadModuleFromDir($this->explicitPaths[$moduleName], $class)) { + $classLoaded = $this->loadModuleFromDir($this->explicitPaths[$moduleName], $class); + if ($classLoaded) { return $classLoaded; - } elseif ($classLoaded = $this->loadModuleFromPhar($this->explicitPaths[$moduleName], $class)) { + } + + $classLoaded = $this->loadModuleFromPhar($this->explicitPaths[$moduleName], $class); + if ($classLoaded) { return $classLoaded; } } @@ -119,7 +123,9 @@ public function autoload($class) foreach ($this->paths as $path) { $path = $path . $moduleClassPath; - if ($classLoaded = $this->loadModuleFromDir($path, $class)) { + + $classLoaded = $this->loadModuleFromDir($path, $class); + if ($classLoaded) { return $classLoaded; } @@ -134,7 +140,8 @@ public function autoload($class) continue; } - if ($classLoaded = $this->loadModuleFromPhar($entry->getPathname(), $class)) { + $classLoaded = $this->loadModuleFromPhar($entry->getPathname(), $class); + if ($classLoaded) { return $classLoaded; } }