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 LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License
---------------

Copyright (c) 2017-present Tomáš Votruba (https://tomasvotruba.cz)
Copyright (c) 2017-present Tomáš Votruba (https://tomasvotruba.com)

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
11 changes: 10 additions & 1 deletion src/ChangelogContentsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ public function create(array $changelogLines): string
Assert::allString($changelogLines);

// summarize into "Added Features" and "Bugfixes" groups
$linesByCategory = [];
$linesByCategory = [
// set order clearly here
ChangelogCategory::NEW_FEATURES => [],
ChangelogCategory::BUGFIXES => [],
ChangelogCategory::REMOVED => [],
ChangelogCategory::SKIPPED => [],
];

foreach ($changelogLines as $changelogLine) {
foreach (self::FILTER_KEYWORDS_BY_CATEGORY as $category => $filterKeywords) {
Expand All @@ -62,6 +68,9 @@ public function create(array $changelogLines): string
// remove skipped lines
unset($linesByCategory[ChangelogCategory::SKIPPED]);

// remove empty categories
$linesByCategory = array_filter($linesByCategory);

return $this->generateFileContentsFromGroupedItems($linesByCategory);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ protected function setUp(): void
public function test(): void
{
$changelogLines = [
'* Add new rule',
'* Fix bug',
'* Add new rule',
'* Fixed another bug',
'* Removed old rule',
'* Enable PHPStan on tests as well + add "unused public" ([#3238](https://github.com/rectorphp/rector-src/pull/3238))',
];

Expand Down
6 changes: 6 additions & 0 deletions tests/ChangelogContentsFactory/Fixture/generated_changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@

* Fix bug
* Fixed another bug

<br>

## Removed :skull:

* Removed old rule
Loading