migrationPlanCalculator->getMigrations(); $executedMigrations = $this->metadataStorage->getExecutedMigrations(); switch ($alias) { case self::ALIAS_FIRST: case '0': return new Version('0'); case self::ALIAS_CURRENT: try { return $executedMigrations->getLast()->getVersion(); } catch (NoMigrationsFoundWithCriteria) { return new Version('0'); } // no break because of return case self::ALIAS_PREV: try { return $executedMigrations->getLast(-1)->getVersion(); } catch (NoMigrationsFoundWithCriteria) { return new Version('0'); } // no break because of return case self::ALIAS_NEXT: $newMigrations = $this->migrationStatusCalculator->getNewMigrations(); try { return $newMigrations->getFirst()->getVersion(); } catch (NoMigrationsFoundWithCriteria $e) { throw NoMigrationsToExecute::new($e); } // no break because of return case self::ALIAS_LATEST: try { return $availableMigrations->getLast()->getVersion(); } catch (NoMigrationsFoundWithCriteria) { return $this->resolveVersionAlias(self::ALIAS_CURRENT); } // no break because of return default: if ($availableMigrations->hasMigration(new Version($alias))) { return $availableMigrations->getMigration(new Version($alias))->getVersion(); } if (substr($alias, 0, 7) === self::ALIAS_CURRENT) { $val = (int) substr($alias, 7); $targetMigration = null; if ($val > 0) { $newMigrations = $this->migrationStatusCalculator->getNewMigrations(); return $newMigrations->getFirst($val - 1)->getVersion(); } return $executedMigrations->getLast($val)->getVersion(); } } throw UnknownMigrationVersion::new($alias); } }