diff --git a/src/Patcher.php b/src/Patcher.php index f6d87911..fcf2061a 100644 --- a/src/Patcher.php +++ b/src/Patcher.php @@ -88,7 +88,10 @@ protected function getPatchers(): array ); } - if (!$patcher->canUse()) { + $usable = $patcher->canUse(); + $this->io->write(self::class . " usable: " . ($usable ? "yes" : "no"), true, IOInterface::DEBUG); + + if (!$usable) { unset($newPatchers[$i]); } } diff --git a/src/Patcher/BsdPatchPatcher.php b/src/Patcher/BsdPatchPatcher.php index 306c0ef0..84350999 100644 --- a/src/Patcher/BsdPatchPatcher.php +++ b/src/Patcher/BsdPatchPatcher.php @@ -37,10 +37,6 @@ public function canUse(): bool $output = ""; $result = $this->executor->execute($this->patchTool() . ' --version', $output); // TODO: Is it a valid assumption to assume that if GNU is *not* in the version output, that it's BSD patch? - $usable = ($result === 0) && (!str_contains($output, 'GNU patch')); - - $this->io->write(self::class . " usable: " . ($usable ? "yes" : "no"), true, IOInterface::DEBUG); - - return $usable; + return ($result === 0) && (!str_contains($output, 'GNU patch')); } } diff --git a/src/Patcher/GitPatcher.php b/src/Patcher/GitPatcher.php index 4d57e5b1..551162dd 100644 --- a/src/Patcher/GitPatcher.php +++ b/src/Patcher/GitPatcher.php @@ -51,10 +51,6 @@ public function canUse(): bool { $output = ""; $result = $this->executor->execute($this->patchTool() . ' --version', $output); - $usable = ($result === 0); - - $this->io->write(self::class . " usable: " . ($usable ? "yes" : "no"), true, IOInterface::DEBUG); - - return $usable; + return ($result === 0); } } diff --git a/src/Patcher/GnuPatchPatcher.php b/src/Patcher/GnuPatchPatcher.php index a9294a20..5b7ac3f9 100644 --- a/src/Patcher/GnuPatchPatcher.php +++ b/src/Patcher/GnuPatchPatcher.php @@ -35,10 +35,6 @@ public function canUse(): bool { $output = ""; $result = $this->executor->execute($this->patchTool() . ' --version', $output); - $usable = ($result === 0) && (str_contains($output, 'GNU patch')); - - $this->io->write(self::class . " usable: " . ($usable ? "yes" : "no"), true, IOInterface::DEBUG); - - return $usable; + return ($result === 0) && (str_contains($output, 'GNU patch')); } }