Skip to content

Commit

Permalink
tidy up (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba authored Jan 19, 2025
1 parent 02df1b4 commit 1a0d956
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 16 deletions.
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"symfony/process": "^6.4|^7.0"
},
"require-dev": {
"rector/rector": "^1.1",
"symplify/easy-coding-standard": "^12.3",
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^10.5",
"phpstan/phpstan-webmozart-assert": "^1.2.2",
"phpstan/extension-installer": "^1.3",
"rector/rector": "^2.0",
"phpecs/phpecs": "^2.0",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^11.5",
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpstan/extension-installer": "^1.4",
"tracy/tracy": "^2.10"
},
"autoload": {
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
level: 8
treatPhpDocTypesAsCertain: false

paths:
- bin
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Rector\Config\RectorConfig;

return RectorConfig::configure()
->withImportNames(true)
->withImportNames()
->withPaths([__DIR__ . '/bin', __DIR__ . '/src', __DIR__ . '/tests'])
->withRootFiles()
->withPhpSets()
Expand Down
7 changes: 5 additions & 2 deletions src/ChangelogContentsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
final class ChangelogContentsFactory
{
/**
* @var array<string, string[]>
* @var array<ChangelogCategory::*, string[]>
*/
private const FILTER_KEYWORDS_BY_CATEGORY = [
ChangelogCategory::SKIPPED => [
Expand All @@ -26,10 +26,13 @@ final class ChangelogContentsFactory
'update to',
'[automated]',
'[core]',
'[scope]',
'[scoper]',
'[scoped]',
],
ChangelogCategory::NEW_FEATURES => ['add', 'added', 'improve'],
ChangelogCategory::BUGFIXES => ['fixed', 'fix'],
ChangelogCategory::REMOVED => ['removed', 'deleted', 'remove deprecated', 'remove'],
ChangelogCategory::REMOVED => ['removed', 'deleted', 'remove deprecated', 'remove', 'deprecated'],
];

/**
Expand Down
6 changes: 3 additions & 3 deletions src/ChangelogLineFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Rector\ReleaseNotesGenerator\ValueObject\Commit;
use stdClass;

final class ChangelogLineFactory
final readonly class ChangelogLineFactory
{
/**
* @see https://regex101.com/r/jdT01W/1
Expand All @@ -18,7 +18,7 @@ final class ChangelogLineFactory
private const ISSUE_NAME_REGEX = '#(.*?)( \(\#\d+\))?$#ms';

public function __construct(
private readonly GithubApiCaller $githubApiCaller
private GithubApiCaller $githubApiCaller
) {
}

Expand Down Expand Up @@ -70,7 +70,7 @@ public function create(Commit $commit, Configuration $configuration): string

return sprintf(
'* %s (%s)%s%s',
(string) $commit,
$commit,
$parenthesis,
$issuesToReference !== [] ? ', ' . implode(', ', $issuesToReference) : '',
$this->createThanks($thanks)
Expand Down
1 change: 1 addition & 0 deletions src/Command/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function __construct(
protected function configure(): void
{
$this->setName('generate');

$this->addOption(Option::FROM_COMMIT, null, InputOption::VALUE_REQUIRED);
$this->addOption(Option::TO_COMMIT, null, InputOption::VALUE_REQUIRED);
$this->addOption(Option::GITHUB_TOKEN, null, InputOption::VALUE_REQUIRED);
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Webmozart\Assert\Assert;

final class Configuration
final readonly class Configuration
{
/**
* @var string[]
Expand Down
5 changes: 2 additions & 3 deletions src/ValueObject/ExternalRepositoryChangelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Rector\ReleaseNotesGenerator\ValueObject;

final class ExternalRepositoryChangelog
final readonly class ExternalRepositoryChangelog
{
/**
* @param string[] $lines
Expand Down Expand Up @@ -33,8 +33,7 @@ public function toString(): string
{
$changelogContents = '## ' . $this->title . PHP_EOL . PHP_EOL;
$changelogContents .= implode(PHP_EOL, $this->lines);
$changelogContents .= PHP_EOL . PHP_EOL;

return $changelogContents;
return $changelogContents . (PHP_EOL . PHP_EOL);
}
}

0 comments on commit 1a0d956

Please sign in to comment.