Skip to content

Commit

Permalink
fix: commit sorting on changelog
Browse files Browse the repository at this point in the history
Refs: #9
  • Loading branch information
Marco Cesarato committed Apr 2, 2021
1 parent e65fb3f commit 0d402cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ public function generate(InputInterface $input, SymfonyStyle $output): int
foreach ($options as $params) {
$commitsRaw = Repository::getCommits($params['options']);
usort($commitsRaw, function ($x, $y) use ($sortBy, $sortOrientation) {
if (is_array($x) && array_key_exists($sortBy, $x)) {
if (property_exists($x, $sortBy)) {
if ($sortOrientation === 'ASC') {
return $x[$sortBy] <=> $y[$sortBy];
return $x->{$sortBy} <=> $y->{$sortBy};
}

return $y[$sortBy] <=> $x[$sortBy];
return $y->{$sortBy} <=> $x->{$sortBy};
}

return 0;
Expand Down

0 comments on commit 0d402cb

Please sign in to comment.