Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused paramaters from DiffCommand and VersionCommand #1386

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading