Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
6 changes: 6 additions & 0 deletions src/GitResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Rector\ReleaseNotesGenerator\ValueObject\Commit;
use Symfony\Component\Process\Process;
use Webmozart\Assert\Assert;

final class GitResolver
{
Expand Down Expand Up @@ -34,6 +35,11 @@ private function mapCommitLinesToCommits(array $commitLines): array
{
return array_map(static function (string $line): Commit {
preg_match('#(?<hash>\w+) (?<message>.*?) (?<date>\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);
}
Expand Down