diff --git a/composer.lock b/composer.lock index 36c6f3a27..8bb46d040 100644 --- a/composer.lock +++ b/composer.lock @@ -9264,16 +9264,16 @@ }, { "name": "rector/rector", - "version": "2.2.3", + "version": "2.2.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "d27f976a332a87b5d03553c2e6f04adbe5da034f" + "reference": "fb9418af7777dfb1c87a536dc58398b5b07c74b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/d27f976a332a87b5d03553c2e6f04adbe5da034f", - "reference": "d27f976a332a87b5d03553c2e6f04adbe5da034f", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/fb9418af7777dfb1c87a536dc58398b5b07c74b9", + "reference": "fb9418af7777dfb1c87a536dc58398b5b07c74b9", "shasum": "" }, "require": { @@ -9312,7 +9312,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/2.2.3" + "source": "https://github.com/rectorphp/rector/tree/2.2.5" }, "funding": [ { @@ -9320,7 +9320,7 @@ "type": "github" } ], - "time": "2025-10-11T21:50:23+00:00" + "time": "2025-10-23T11:22:37+00:00" }, { "name": "revolt/event-loop", diff --git a/rector.php b/rector.php index 628b2dae3..e88269735 100644 --- a/rector.php +++ b/rector.php @@ -17,6 +17,7 @@ use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; +use Rector\PHPUnit\CodeQuality\Rector\FuncCall\AssertFuncCallToPHPUnitAssertRector; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; @@ -40,5 +41,6 @@ NullToStrictStringFuncCallArgRector::class, PreferPHPUnitThisCallRector::class, NarrowUnusedSetUpDefinedPropertyRector::class, + AssertFuncCallToPHPUnitAssertRector::class, ]); }; diff --git a/src/Command/ReleaseCommand.php b/src/Command/ReleaseCommand.php index 6f34198c3..10c6daeb5 100644 --- a/src/Command/ReleaseCommand.php +++ b/src/Command/ReleaseCommand.php @@ -127,7 +127,7 @@ private function selectProject(InputInterface $input, OutputInterface $output): $question = new Question('Please enter the name of the project to release: '); $question->setAutocompleterValues(array_keys($this->projects->all())); $question->setTrimmable(true); - $question->setValidator(fn ($answer): Project => $this->projects->byName($answer)); + $question->setValidator($this->projects->byName(...)); $question->setMaxAttempts(3); $project = $helper->ask($input, $output, $question); @@ -154,7 +154,7 @@ private function selectBranch(InputInterface $input, OutputInterface $output, Pr $default ); $question->setTrimmable(true); - $question->setValidator(static fn ($answer): Branch => $project->branch($answer)); + $question->setValidator($project->branch(...)); $question->setMaxAttempts(3); $branch = $helper->ask($input, $output, $question); diff --git a/src/Domain/Value/Branch.php b/src/Domain/Value/Branch.php index 1d8b9579b..124ecb152 100644 --- a/src/Domain/Value/Branch.php +++ b/src/Domain/Value/Branch.php @@ -65,7 +65,7 @@ public static function fromValues(string $name, array $config): self } $phpExtensions = array_map( - static fn (string $phpExtension): PhpExtension => PhpExtension::fromString($phpExtension), + PhpExtension::fromString(...), $config['php_extensions'] ); diff --git a/src/Domain/Value/Changelog.php b/src/Domain/Value/Changelog.php index 9aa13f93c..aea6e6c7b 100644 --- a/src/Domain/Value/Changelog.php +++ b/src/Domain/Value/Changelog.php @@ -62,7 +62,7 @@ public static function fromPullRequests(array $pullRequests, Tag $next, Tag $cur $changelog = array_reduce( $changelogs, - 'array_merge_recursive', + array_merge_recursive(...), [] ); diff --git a/src/Github/Api/Comments.php b/src/Github/Api/Comments.php index 4b14cb1fe..413b8915c 100644 --- a/src/Github/Api/Comments.php +++ b/src/Github/Api/Comments.php @@ -36,7 +36,7 @@ public function __construct(private GithubClient $github, private ResultPagerInt public function all(Repository $repository, PullRequest $pullRequest, ?string $username = null): array { $comments = array_map( - static fn (array $response): Comment => Comment::fromResponse($response), + Comment::fromResponse(...), $this->githubPager->fetchAll($this->github->issues()->comments(), 'all', [ $repository->username(), $repository->name(), diff --git a/src/Github/Api/Commits.php b/src/Github/Api/Commits.php index 21db5abb8..bae7d1992 100644 --- a/src/Github/Api/Commits.php +++ b/src/Github/Api/Commits.php @@ -36,7 +36,7 @@ public function __construct(private GithubClient $github, private ResultPagerInt public function all(Repository $repository, PullRequest $pullRequest): array { return array_map( - static fn (array $response): Commit => Commit::fromResponse($response), + Commit::fromResponse(...), $this->githubPager->fetchAll($this->github->pullRequest(), 'commits', [ $repository->username(), $repository->name(), diff --git a/src/Github/Api/Hooks.php b/src/Github/Api/Hooks.php index 519fc25ec..c3374ce4b 100644 --- a/src/Github/Api/Hooks.php +++ b/src/Github/Api/Hooks.php @@ -32,7 +32,7 @@ public function __construct(private GithubClient $github) public function all(Repository $repository): array { return array_map( - static fn (array $response): Hook => Hook::fromResponse($response), + Hook::fromResponse(...), $this->github->repo()->hooks()->all($repository->username(), $repository->name()) ); } diff --git a/src/Github/Api/Labels.php b/src/Github/Api/Labels.php index 0e7b02d77..4c9b50dc3 100644 --- a/src/Github/Api/Labels.php +++ b/src/Github/Api/Labels.php @@ -32,7 +32,7 @@ public function __construct(private GithubClient $github) public function all(Repository $repository): array { return array_map( - static fn (array $response): Label => Label::fromResponse($response), + Label::fromResponse(...), $this->github->repo()->labels()->all($repository->username(), $repository->name()) ); } diff --git a/tests/Util/Factory/Github/Response/CheckRunsFactory.php b/tests/Util/Factory/Github/Response/CheckRunsFactory.php index b7fec8528..b136ea521 100644 --- a/tests/Util/Factory/Github/Response/CheckRunsFactory.php +++ b/tests/Util/Factory/Github/Response/CheckRunsFactory.php @@ -30,7 +30,7 @@ public static function create(array $parameters = []): array $response = [ 'check_runs' => array_map( - static fn ($item): array => CheckRunFactory::create(), + CheckRunFactory::create(...), range(0, $faker->numberBetween(2, 3)) ), ]; diff --git a/tests/Util/Factory/Github/Response/CombinedStatusFactory.php b/tests/Util/Factory/Github/Response/CombinedStatusFactory.php index 6d969f55e..4b858d797 100644 --- a/tests/Util/Factory/Github/Response/CombinedStatusFactory.php +++ b/tests/Util/Factory/Github/Response/CombinedStatusFactory.php @@ -37,7 +37,7 @@ public static function create(array $parameters = []): array $response = [ 'state' => $state, 'statuses' => array_map( - static fn ($item): array => StatusFactory::create(), + StatusFactory::create(...), range('pending' === $state ? 0 : 1, $faker->numberBetween(2, 3)) ), ]; diff --git a/tests/Util/Factory/Github/Response/PullRequestFactory.php b/tests/Util/Factory/Github/Response/PullRequestFactory.php index 7b8ad906d..82f4b160b 100644 --- a/tests/Util/Factory/Github/Response/PullRequestFactory.php +++ b/tests/Util/Factory/Github/Response/PullRequestFactory.php @@ -70,7 +70,7 @@ public static function create(array $parameters = []): array ), 'html_url' => $faker->url(), 'labels' => array_map( - static fn ($item): array => LabelFactory::create(), + LabelFactory::create(...), range(0, $faker->numberBetween(0, 5)) ), ];