Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SRWieZ committed Sep 13, 2024
1 parent 326583c commit 3e7434b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/whatsdiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
}

if (class_exists('\NunoMaduro\Collision\Provider')) {
error_reporting(0);
(new \NunoMaduro\Collision\Provider())->register();
} else {
// TODO : register a function to catch exception
error_reporting(0);
// TODO : register a function to catch exception and show nice exception
}

// Argument parsing
Expand Down Expand Up @@ -72,6 +72,10 @@ function isFileHasBeenRecentlyUpdated(string $filename): bool
// Execute the command and get the output
$output = shell_exec("git status --porcelain");

if (is_null($output)) {
return false;
}

$status = collect(explode("\n", trim($output)))
->mapWithKeys(function ($line) {
$line = array_values(array_filter(explode(' ', $line)));
Expand Down Expand Up @@ -158,7 +162,7 @@ function printDiff(array $diff): void
return;
}
$maxStrLen = max(array_map('strlen', array_keys($diff)));
$maxStrLenVersion = max(array_map(fn ($el) => strlen($el[0]), $diff));
$maxStrLenVersion = max(array_map(fn ($el) => strlen($el['from']), $diff));
foreach ($diff as $package => $infos) {
if ($infos['from'] !== null && $infos['to'] !== null) {
if (Comparator::greaterThan($infos['to'], $infos['from'])) {
Expand Down

0 comments on commit 3e7434b

Please sign in to comment.