Skip to content

Commit

Permalink
fix: Remove unnecessary code from the diff command
Browse files Browse the repository at this point in the history
- Restarting the process is no longer needed within the diff command as
  extracting the PHAR is done in a separate process.
- Catching the exception is no longer necessary or desired since any
  failure will throw a comprehensive error.
  • Loading branch information
theofidry committed Oct 9, 2023
1 parent 14cf228 commit 892e057
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions src/Console/Command/Diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Filesystem\Path;
use Throwable;
use Webmozart\Assert\Assert;
use function array_map;
use function count;
// TODO: migrate to Safe API
use function explode;
use function is_string;
use function KevinGH\Box\check_php_settings;
use function sprintf;
use const PHP_EOL;

Expand Down Expand Up @@ -101,26 +99,9 @@ public function getConfiguration(): Configuration

public function execute(IO $io): int
{
check_php_settings($io);

$paths = self::getPaths($io);

try {
$diff = new PharDiff(...$paths);
} catch (Throwable $throwable) {
if ($io->isDebug()) {
throw $throwable;
}

$io->writeln(
sprintf(
'<error>Could not check the PHARs: %s</error>',
$throwable->getMessage(),
),
);

return ExitCode::FAILURE;
}
$diff = new PharDiff(...$paths);

$result1 = $this->compareArchives($diff, $io);
$result2 = $this->compareContents($diff, $io);
Expand Down

0 comments on commit 892e057

Please sign in to comment.