diff --git a/composer.json b/composer.json index d6f077c..40a34fc 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "require": { "php": "^8.2", "symfony/console": "^6.4|^7.0", - "nategood/httpful": "^0.3.2", + "nategood/httpful": "^1.0", "webmozart/assert": "^1.11", "symfony/process": "^6.4|^7.0" }, diff --git a/src/GitResolver.php b/src/GitResolver.php index 06fbfe4..c67cee8 100644 --- a/src/GitResolver.php +++ b/src/GitResolver.php @@ -6,6 +6,7 @@ use Rector\ReleaseNotesGenerator\ValueObject\Commit; use Symfony\Component\Process\Process; +use Webmozart\Assert\Assert; final class GitResolver { @@ -34,6 +35,11 @@ private function mapCommitLinesToCommits(array $commitLines): array { return array_map(static function (string $line): Commit { preg_match('#(?\w+) (?.*?) (?\d+\-\d+\-\d+)#', $line, $matches); + + Assert::keyExists($matches, 'hash'); + Assert::keyExists($matches, 'message'); + Assert::keyExists($matches, 'date'); + return new Commit($matches['hash'], $matches['message'], $matches['date']); }, $commitLines); }