Skip to content

Commit

Permalink
Merge pull request #146 from localheinz/fix/clean
Browse files Browse the repository at this point in the history
Fix: Clean up NormalizeCommand
  • Loading branch information
localheinz committed Dec 24, 2018
2 parents 65c9a9a + 1264aaf commit dabf192
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/Command/NormalizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ protected function execute(Console\Input\InputInterface $input, Console\Output\O
{
$io = $this->getIO();

$dryRun = $input->getOption('dry-run');

try {
$indent = $this->indentFrom($input);
} catch (\RuntimeException $exception) {
Expand Down Expand Up @@ -201,7 +199,7 @@ protected function execute(Console\Input\InputInterface $input, Console\Output\O
return 0;
}

if (true === $dryRun) {
if (true === $input->getOption('dry-run')) {
$io->writeError(\sprintf(
'<error>%s is not normalized.</error>',
$composerFile
Expand Down Expand Up @@ -235,26 +233,24 @@ protected function execute(Console\Input\InputInterface $input, Console\Output\O
$composerFile
));

$noUpdateLock = $input->getOption('no-update-lock');

if (false === $noUpdateLock && true === $locker->isLocked()) {
$io->write('<info>Updating lock file.</info>');
if (true === $input->getOption('no-update-lock') || false === $locker->isLocked()) {
return 0;
}

$this->resetComposer();
$io->write('<info>Updating lock file.</info>');

$file = $input->getArgument('file');
$this->resetComposer();

if (\is_string($file)) {
return $this->updateLockerInWorkingDirectory(
$output,
\dirname($file)
);
}
$file = $input->getArgument('file');

return $this->updateLocker($output);
if (\is_string($file)) {
return $this->updateLockerInWorkingDirectory(
$output,
\dirname($file)
);
}

return 0;
return $this->updateLocker($output);
}

/**
Expand Down

0 comments on commit dabf192

Please sign in to comment.