Skip to content

Commit 37d320e

Browse files
authored
[7.3] Update InvokableCommandRector to InvokableCommandInputAttributeRector to improve discoverability (#743)
1 parent ad93ade commit 37d320e

File tree

10 files changed

+23
-24
lines changed

10 files changed

+23
-24
lines changed

config/sets/symfony/symfony5/symfony53.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
declare(strict_types=1);
44

55
use Rector\Config\RectorConfig;
6-
use Rector\Symfony\Symfony53\Rector\StaticPropertyFetch\KernelTestCaseContainerPropertyDeprecationRector;
76

87
# https://github.com/symfony/symfony/blob/5.4/UPGRADE-5.3.md
98

config/sets/symfony/symfony73.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use Rector\Config\RectorConfig;
66
use Rector\Symfony\Symfony73\Rector\Class_\CommandHelpToAttributeRector;
7-
use Rector\Symfony\Symfony73\Rector\Class_\InvokableCommandRector;
7+
use Rector\Symfony\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector;
88

99
// @see https://github.com/symfony/symfony/blame/7.3/UPGRADE-7.3.md
1010

1111
return RectorConfig::configure()
12-
->withRules([CommandHelpToAttributeRector::class, InvokableCommandRector::class]);
12+
->withRules([CommandHelpToAttributeRector::class, InvokableCommandInputAttributeRector::class]);

rules-tests/Symfony73/Rector/Class_/CommandHelpToAttributeRector/Fixture/skip_has_help_attribute_command.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandRector\Fixture;
3+
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector\Fixture;
44

55
use Symfony\Component\Console\Attribute\AsCommand;
66
use Symfony\Component\Console\Command\Command;

rules-tests/Symfony73/Rector/Class_/InvokableCommandRector/Fixture/some_command.php.inc renamed to rules-tests/Symfony73/Rector/Class_/InvokableCommandInputAttributeRector/Fixture/some_command.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandRector\Fixture;
3+
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector\Fixture;
44

55
use Symfony\Component\Console\Attribute\AsCommand;
66
use Symfony\Component\Console\Command\Command;
@@ -33,7 +33,7 @@ final class SomeCommand extends Command
3333
-----
3434
<?php
3535

36-
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandRector\Fixture;
36+
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector\Fixture;
3737

3838
use Symfony\Component\Console\Attribute\AsCommand;
3939
use Symfony\Component\Console\Command\Command;

rules-tests/Symfony73/Rector/Class_/InvokableCommandRector/Fixture/some_command_with_method_chaining.php.inc renamed to rules-tests/Symfony73/Rector/Class_/InvokableCommandInputAttributeRector/Fixture/some_command_with_method_chaining.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandRector\Fixture;
3+
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector\Fixture;
44

55
use Symfony\Component\Console\Attribute\AsCommand;
66
use Symfony\Component\Console\Command\Command;
@@ -34,7 +34,7 @@ final class SomeCommandWithMethodChaining extends Command
3434
-----
3535
<?php
3636

37-
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandRector\Fixture;
37+
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector\Fixture;
3838

3939
use Symfony\Component\Console\Attribute\AsCommand;
4040
use Symfony\Component\Console\Command\Command;

rules-tests/Symfony73/Rector/Class_/InvokableCommandRector/Fixture/some_command_with_set_help.php.inc renamed to rules-tests/Symfony73/Rector/Class_/InvokableCommandInputAttributeRector/Fixture/some_command_with_set_help.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandRector\Fixture;
3+
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector\Fixture;
44

55
use Symfony\Component\Console\Attribute\AsCommand;
66
use Symfony\Component\Console\Command\Command;
@@ -34,7 +34,7 @@ final class SomeCommandWithSetHelp extends Command
3434
-----
3535
<?php
3636

37-
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandRector\Fixture;
37+
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector\Fixture;
3838

3939
use Symfony\Component\Console\Attribute\AsCommand;
4040
use Symfony\Component\Console\Command\Command;

rules-tests/Symfony73/Rector/Class_/InvokableCommandRector/InvokableCommandRectorTest.php renamed to rules-tests/Symfony73/Rector/Class_/InvokableCommandInputAttributeRector/InvokableCommandInputAttributeRectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
declare(strict_types=1);
44

5-
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandRector;
5+
namespace Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector;
66

77
use Iterator;
88
use PHPUnit\Framework\Attributes\DataProvider;
99
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
1010

11-
final class InvokableCommandRectorTest extends AbstractRectorTestCase
11+
final class InvokableCommandInputAttributeRectorTest extends AbstractRectorTestCase
1212
{
1313
#[DataProvider('provideData')]
1414
public function test(string $filePath): void
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Symfony\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->rule(InvokableCommandInputAttributeRector::class);
10+
};

rules-tests/Symfony73/Rector/Class_/InvokableCommandRector/config/configured_rule.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

rules/Symfony73/Rector/Class_/InvokableCommandRector.php renamed to rules/Symfony73/Rector/Class_/InvokableCommandInputAttributeRector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
* @see https://github.com/symfony/symfony-docs/issues/20553
3030
* @see https://github.com/symfony/symfony/pull/59340
3131
*
32-
* @see \Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandRector\InvokableCommandRectorTest
32+
* @see \Rector\Symfony\Tests\Symfony73\Rector\Class_\InvokableCommandInputAttributeRector\InvokableCommandRectorTest
3333
*/
34-
final class InvokableCommandRector extends AbstractRector
34+
final class InvokableCommandInputAttributeRector extends AbstractRector
3535
{
3636
private const MIGRATED_CONFIGURE_CALLS = ['addArgument', 'addOption'];
3737

0 commit comments

Comments
 (0)