Skip to content

Commit

Permalink
Remove unused paramaters from DiffCommand and VersionCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
nikow13 authored and derrabus committed Mar 6, 2024
1 parent c8f23d8 commit 4ee857f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/Tools/Console/Command/DiffCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected function execute(
$executedUnavailableMigrations = $statusCalculator->getExecutedUnavailableMigrations();
$newMigrations = $statusCalculator->getNewMigrations();

if (! $this->checkNewMigrationsOrExecutedUnavailable($newMigrations, $executedUnavailableMigrations, $input, $output)) {
if (! $this->checkNewMigrationsOrExecutedUnavailable($newMigrations, $executedUnavailableMigrations, $input)) {
$this->io->error('Migration cancelled!');

return 3;
Expand Down Expand Up @@ -189,7 +189,6 @@ private function checkNewMigrationsOrExecutedUnavailable(
AvailableMigrationsList $newMigrations,
ExecutedMigrationsList $executedUnavailableMigrations,
InputInterface $input,
OutputInterface $output,
): bool {
if (count($newMigrations) === 0 && count($executedUnavailableMigrations) === 0) {
return true;
Expand Down
16 changes: 8 additions & 8 deletions src/Tools/Console/Command/VersionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$confirmation = $this->io->confirm($question);

if ($confirmation) {
$this->markVersions($input, $output);
$this->markVersions($input);
} else {
$this->io->error('Migration cancelled!');
}
} else {
$this->markVersions($input, $output);
$this->markVersions($input);
}

return 0;
}

/** @throws InvalidOptionUsage */
private function markVersions(InputInterface $input, OutputInterface $output): void
private function markVersions(InputInterface $input): void
{
$affectedVersion = $input->getArgument('version');
$allOption = $input->getOption('all');
Expand All @@ -151,15 +151,15 @@ private function markVersions(InputInterface $input, OutputInterface $output): v
if ($allOption === true) {
if ($input->getOption('delete') === true) {
foreach ($executedMigrations->getItems() as $availableMigration) {
$this->mark($input, $output, $availableMigration->getVersion(), false, $executedMigrations);
$this->mark($input, $availableMigration->getVersion(), false, $executedMigrations);
}
}

foreach ($availableVersions->getItems() as $availableMigration) {
$this->mark($input, $output, $availableMigration->getVersion(), true, $executedMigrations);
$this->mark($input, $availableMigration->getVersion(), true, $executedMigrations);
}
} elseif ($affectedVersion !== null) {
$this->mark($input, $output, new Version($affectedVersion), false, $executedMigrations);
$this->mark($input, new Version($affectedVersion), false, $executedMigrations);
} elseif ($rangeFromOption !== null && $rangeToOption !== null) {
$migrate = false;
foreach ($availableVersions->getItems() as $availableMigration) {
Expand All @@ -168,7 +168,7 @@ private function markVersions(InputInterface $input, OutputInterface $output): v
}

if ($migrate) {
$this->mark($input, $output, $availableMigration->getVersion(), true, $executedMigrations);
$this->mark($input, $availableMigration->getVersion(), true, $executedMigrations);
}

if ((string) $availableMigration->getVersion() === $rangeToOption) {
Expand All @@ -185,7 +185,7 @@ private function markVersions(InputInterface $input, OutputInterface $output): v
* @throws VersionDoesNotExist
* @throws UnknownMigrationVersion
*/
private function mark(InputInterface $input, OutputInterface $output, Version $version, bool $all, ExecutedMigrationsList $executedMigrations): void
private function mark(InputInterface $input, Version $version, bool $all, ExecutedMigrationsList $executedMigrations): void
{
try {
$availableMigration = $this->getDependencyFactory()->getMigrationRepository()->getMigration($version);
Expand Down

0 comments on commit 4ee857f

Please sign in to comment.