diff --git a/composer.json b/composer.json index 40a34fc..13b7878 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/phpstan.neon b/phpstan.neon index 630b96b..0ed9842 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,6 @@ parameters: level: 8 + treatPhpDocTypesAsCertain: false paths: - bin diff --git a/rector.php b/rector.php index b0c5275..4ae6bff 100644 --- a/rector.php +++ b/rector.php @@ -5,7 +5,7 @@ use Rector\Config\RectorConfig; return RectorConfig::configure() - ->withImportNames(true) + ->withImportNames() ->withPaths([__DIR__ . '/bin', __DIR__ . '/src', __DIR__ . '/tests']) ->withRootFiles() ->withPhpSets() diff --git a/src/ChangelogContentsFactory.php b/src/ChangelogContentsFactory.php index 9b985a1..e3db8be 100644 --- a/src/ChangelogContentsFactory.php +++ b/src/ChangelogContentsFactory.php @@ -13,7 +13,7 @@ final class ChangelogContentsFactory { /** - * @var array + * @var array */ private const FILTER_KEYWORDS_BY_CATEGORY = [ ChangelogCategory::SKIPPED => [ @@ -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'], ]; /** diff --git a/src/ChangelogLineFactory.php b/src/ChangelogLineFactory.php index fd869a9..482c0e8 100644 --- a/src/ChangelogLineFactory.php +++ b/src/ChangelogLineFactory.php @@ -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 @@ -18,7 +18,7 @@ final class ChangelogLineFactory private const ISSUE_NAME_REGEX = '#(.*?)( \(\#\d+\))?$#ms'; public function __construct( - private readonly GithubApiCaller $githubApiCaller + private GithubApiCaller $githubApiCaller ) { } @@ -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) diff --git a/src/Command/GenerateCommand.php b/src/Command/GenerateCommand.php index 4aaf746..3af439e 100644 --- a/src/Command/GenerateCommand.php +++ b/src/Command/GenerateCommand.php @@ -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); diff --git a/src/Configuration/Configuration.php b/src/Configuration/Configuration.php index d489849..33ea87d 100644 --- a/src/Configuration/Configuration.php +++ b/src/Configuration/Configuration.php @@ -6,7 +6,7 @@ use Webmozart\Assert\Assert; -final class Configuration +final readonly class Configuration { /** * @var string[] diff --git a/src/ValueObject/ExternalRepositoryChangelog.php b/src/ValueObject/ExternalRepositoryChangelog.php index b234250..5f2952c 100644 --- a/src/ValueObject/ExternalRepositoryChangelog.php +++ b/src/ValueObject/ExternalRepositoryChangelog.php @@ -4,7 +4,7 @@ namespace Rector\ReleaseNotesGenerator\ValueObject; -final class ExternalRepositoryChangelog +final readonly class ExternalRepositoryChangelog { /** * @param string[] $lines @@ -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); } }