Small code improvements based on review feedback
[MAILPOET-5416]
This commit is contained in:
committed by
Aschepikov
parent
5605259159
commit
b4d0b35a1d
@@ -33,9 +33,9 @@ class Repository {
|
||||
throw MigratorException::templateFileReadFailed($templateFile);
|
||||
}
|
||||
$name = $this->generateName($level);
|
||||
$classDeclaration = str_replace('{level}', $level, 'class {level}MigrationTemplate ');
|
||||
$migration = str_replace($classDeclaration, "class $name ", $template);
|
||||
$path = $this->migrationsDir . "/$level" . "/$name.php";
|
||||
$migration = str_replace('{level}', $level, 'class {level}MigrationTemplate ');
|
||||
$migration = str_replace($migration, "class $name ", $template);
|
||||
$path = "$this->migrationsDir/$level/$name.php";
|
||||
$result = @file_put_contents($path, $migration);
|
||||
if (!$result) {
|
||||
throw MigratorException::migrationFileWriteFailed($path);
|
||||
|
@@ -29,10 +29,9 @@ class Runner {
|
||||
$className = $this->getClassName($name, $level);
|
||||
|
||||
try {
|
||||
/** @var DbMigration|AppMigration $migration */
|
||||
$migration = new $className($this->container);
|
||||
$this->store->startMigration($name);
|
||||
// PHPStan does not recognize that $migration is instance of DbMigration or AppMigration
|
||||
/** @phpstan-ignore-next-line */
|
||||
$migration->run();
|
||||
$this->store->completeMigration($name);
|
||||
} catch (Throwable $e) {
|
||||
|
Reference in New Issue
Block a user