From dcdeefc3327b5ffdc918f78357be52115f5c1c2d Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 17 Mar 2026 04:07:05 +0700 Subject: [PATCH 1/5] [Console] Allow short command "p" on ConsoleApplication --- .github/workflows/e2e_command_with_option.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/e2e_command_with_option.yaml b/.github/workflows/e2e_command_with_option.yaml index 07495e42b7f..81e5710a729 100644 --- a/.github/workflows/e2e_command_with_option.yaml +++ b/.github/workflows/e2e_command_with_option.yaml @@ -50,6 +50,8 @@ jobs: php ../../bin/rector process some_file.php --output-format json php ../../bin/rector process some_file.php --output-format=json + php ../../bin/rector p some_file.php --output-format=json + # with implicit process command ../../bin/rector --output-format json --dry-run ../../bin/rector --output-format=json --dry-run From 1df05a2962ea7eaa169c9ca70f0da7502c821372 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 17 Mar 2026 04:10:13 +0700 Subject: [PATCH 2/5] Fix --- src/Console/ConsoleApplication.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/ConsoleApplication.php b/src/Console/ConsoleApplication.php index 40c945b40a9..99d8708ddf7 100644 --- a/src/Console/ConsoleApplication.php +++ b/src/Console/ConsoleApplication.php @@ -80,7 +80,7 @@ public function doRun(InputInterface $input, OutputInterface $output): int $tokens = $privatesAccessor->getPrivateProperty($input, 'tokens'); $tokens = array_merge(['process'], $tokens); $privatesAccessor->setPrivateProperty($input, 'tokens', $tokens); - } elseif (! $this->has($commandName)) { + } elseif ($commandName !== 'p' && ! $this->has($commandName)) { $this->symfonyStyle->error( sprintf( 'The following given path does not match any files or directories: %s%s', From d9fb872a7938ce78a39bb51dc8f5548ec4bf6368 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 17 Mar 2026 04:18:35 +0700 Subject: [PATCH 3/5] Fix latest phpstan assert --- .../Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/DeadCode/Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php b/rules/DeadCode/Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php index b90cc345753..654a66c583b 100644 --- a/rules/DeadCode/Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php +++ b/rules/DeadCode/Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php @@ -126,8 +126,8 @@ public function refactor(Node $node): ?Node $hasImplicitNullReturn = $this->silentVoidResolver->hasSilentVoid($node) || $this->hasImplicitNullReturn($returnStatements); + /** @var UnionType|NullableType $returnType */ $returnType = $node->returnType; - Assert::isInstanceOfAny($returnType, [UnionType::class, NullableType::class]); $returnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($returnType); $actualReturnTypes = $this->collectActualReturnTypes($returnStatements); From 64d672f1a1b0d94a194447fbdb1592f373642f0b Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 16 Mar 2026 21:20:20 +0000 Subject: [PATCH 4/5] [ci-review] Rector Rectify --- .../Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/DeadCode/Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php b/rules/DeadCode/Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php index 654a66c583b..2ecc8ddd341 100644 --- a/rules/DeadCode/Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php +++ b/rules/DeadCode/Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php @@ -35,7 +35,6 @@ use Rector\VersionBonding\Contract\MinPhpVersionInterface; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; -use Webmozart\Assert\Assert; /** * @see \Rector\Tests\DeadCode\Rector\FunctionLike\NarrowWideUnionReturnTypeRector\NarrowWideUnionReturnTypeRectorTest @@ -130,6 +129,7 @@ public function refactor(Node $node): ?Node $returnType = $node->returnType; $returnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($returnType); + $actualReturnTypes = $this->collectActualReturnTypes($returnStatements); if ($hasImplicitNullReturn) { From 41447c0300000cf0f1ff6b86c847f0fe4c281972 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 17 Mar 2026 17:51:56 +0700 Subject: [PATCH 5/5] with setAliases() --- src/Console/Command/ProcessCommand.php | 1 + src/Console/ConsoleApplication.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Console/Command/ProcessCommand.php b/src/Console/Command/ProcessCommand.php index 6f6edea58ef..a8e7451628f 100644 --- a/src/Console/Command/ProcessCommand.php +++ b/src/Console/Command/ProcessCommand.php @@ -54,6 +54,7 @@ public function __construct( protected function configure(): void { $this->setName('process'); + $this->setAliases(['p']); $this->setDescription('Upgrades or refactors source code with provided Rector rules'); $this->setHelp( <<<'EOF' diff --git a/src/Console/ConsoleApplication.php b/src/Console/ConsoleApplication.php index 99d8708ddf7..40c945b40a9 100644 --- a/src/Console/ConsoleApplication.php +++ b/src/Console/ConsoleApplication.php @@ -80,7 +80,7 @@ public function doRun(InputInterface $input, OutputInterface $output): int $tokens = $privatesAccessor->getPrivateProperty($input, 'tokens'); $tokens = array_merge(['process'], $tokens); $privatesAccessor->setPrivateProperty($input, 'tokens', $tokens); - } elseif ($commandName !== 'p' && ! $this->has($commandName)) { + } elseif (! $this->has($commandName)) { $this->symfonyStyle->error( sprintf( 'The following given path does not match any files or directories: %s%s',