命名空间冲突

This commit is contained in:
zyimm 2023-02-01 10:15:30 +08:00
parent b755061b36
commit 413b7d83e1

View File

@ -140,12 +140,14 @@ abstract class Migrate extends Command
$fileNames[$class] = basename($filePath); $fileNames[$class] = basename($filePath);
// load the migration file // load the migration file
/** @noinspection PhpIncludeInspection */
require_once $filePath; require_once $filePath;
if (!class_exists($class)) { if (!class_exists($class)) {
throw new InvalidArgumentException(sprintf('Could not find class "%s" in file "%s"', $class, $filePath)); if (!class_exists('database\\migrations\\' . $class)) {
throw new InvalidArgumentException(sprintf('Could not find class "%s" in file "%s"', $class, $filePath));
} else {
$class = 'database\\migrations\\' . $class;
}
} }
// instantiate it // instantiate it
$migration = new $class($version, $this->input, $this->output); $migration = new $class($version, $this->input, $this->output);