diff --git a/src/Command/NormalizeCommand.php b/src/Command/NormalizeCommand.php index 938a269d..6f119aae 100644 --- a/src/Command/NormalizeCommand.php +++ b/src/Command/NormalizeCommand.php @@ -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) { @@ -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( '%s is not normalized.', $composerFile @@ -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('Updating lock file.'); + if (true === $input->getOption('no-update-lock') || false === $locker->isLocked()) { + return 0; + } - $this->resetComposer(); + $io->write('Updating lock file.'); - $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); } /**