diff --git a/src/Phar/PharDiff.php b/src/Phar/PharDiff.php index 3f561f731..ee892075a 100644 --- a/src/Phar/PharDiff.php +++ b/src/Phar/PharDiff.php @@ -29,40 +29,40 @@ final class PharDiff { private readonly ParagoniePharDiff $diff; - private readonly PharInfo $pharA; - private readonly PharInfo $pharB; + private readonly PharInfo $pharInfoA; + private readonly PharInfo $pharInfoB; public function __construct(string $pathA, string $pathB) { - $phars = array_map( + [$pharInfoA, $pharInfoB] = array_map( static fn (string $path) => new PharInfo($path), [$pathA, $pathB], ); - $this->pharA = $phars[0]; - $this->pharB = $phars[1]; + $this->pharInfoA = $pharInfoA; + $this->pharInfoB = $pharInfoB; - $diff = new ParagoniePharDiff(...$phars); + $diff = new ParagoniePharDiff($pharInfoA, $pharInfoB); $diff->setVerbose(true); $this->diff = $diff; } - public function getPharA(): PharInfo + public function getPharInfoA(): PharInfo { - return $this->pharA; + return $this->pharInfoA; } - public function getPharB(): PharInfo + public function getPharInfoB(): PharInfo { - return $this->pharB; + return $this->pharInfoB; } public function gitDiff(): ?string { return self::getDiff( - $this->pharA, - $this->pharB, + $this->pharInfoA, + $this->pharInfoB, 'git diff --no-index', ); } @@ -70,8 +70,8 @@ public function gitDiff(): ?string public function gnuDiff(): ?string { return self::getDiff( - $this->pharA, - $this->pharB, + $this->pharInfoA, + $this->pharInfoB, 'diff', ); } @@ -91,8 +91,8 @@ public function listChecksums(string $algo = 'sha384'): int */ public function listDiff(): array { - $pharAFiles = self::collectFiles($this->pharA); - $pharBFiles = self::collectFiles($this->pharB); + $pharAFiles = self::collectFiles($this->pharInfoA); + $pharBFiles = self::collectFiles($this->pharInfoB); return [ array_diff($pharAFiles, $pharBFiles), diff --git a/src/Pharaoh/PharDiff.php b/src/Pharaoh/PharDiff.php index 14e46ac4e..6a39f8758 100644 --- a/src/Pharaoh/PharDiff.php +++ b/src/Pharaoh/PharDiff.php @@ -43,6 +43,7 @@ namespace KevinGH\Box\Pharaoh; +use KevinGH\Box\Phar\PharInfo; use KevinGH\Box\PharInfo\IncompariblePhars; use ParagonIE\ConstantTime\Hex; use ParagonIE_Sodium_File; @@ -77,18 +78,18 @@ class PharDiff 'yellow' => "\033[0;93m", ]; - /** @var array */ - private array $phars = []; + /** @var array */ + private array $pharInfos = []; private bool $verbose = false; - public function __construct(SafePhar $pharA, SafePhar $pharB) + public function __construct(PharInfo $pharInfoA, PharInfo $pharInfoB) { - if ($pharA->hasPubKey() || $pharB->hasPubKey()) { + if ($pharInfoA->hasPubKey() || $pharInfoB->hasPubKey()) { throw IncompariblePhars::signedPhars(); } - $this->phars = [$pharA, $pharB]; + $this->pharInfos = [$pharInfoA, $pharInfoB]; } /** @@ -208,8 +209,8 @@ public function listChecksums(string $algo = 'sha384'): int { [$pharA, $pharB] = $this->hashChildren( $algo, - $this->phars[0]->getTmp(), - $this->phars[1]->getTmp(), + $this->pharInfos[0]->getTmp(), + $this->pharInfos[1]->getTmp(), ); $diffs = 0; diff --git a/tests/Console/Command/DiffTest.php b/tests/Console/Command/DiffTest.php index af8fc425b..9aae0eb21 100644 --- a/tests/Console/Command/DiffTest.php +++ b/tests/Console/Command/DiffTest.php @@ -27,7 +27,6 @@ use function ob_get_clean; use function ob_start; use function realpath; -use const PHP_VERSION_ID; /** * @covers \KevinGH\Box\Console\Command\Diff