From 1e7aa6b174ba6e5395f2ff1992058e4581444a56 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 25 Jun 2024 08:52:36 +0900 Subject: [PATCH 1/3] add fixture with call to keep --- .../Fixture/other-calls.php.inc | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/other-calls.php.inc diff --git a/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/other-calls.php.inc b/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/other-calls.php.inc new file mode 100644 index 00000000..39b4ca59 --- /dev/null +++ b/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/other-calls.php.inc @@ -0,0 +1,31 @@ +setName('sunshine') + ->setAliases(['first', 'second']) + ->addArgument('argument name'); + } +} + +?> +----- +addArgument('argument name'); + } +} + +?> From 4c7607f02eeafc78b0eff71de63682a70f5bcfe2 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 25 Jun 2024 08:54:12 +0900 Subject: [PATCH 2/3] add hidden support to CommandConfigureToAttributeRector --- .../Fixture/name_and_hidden.php.inc | 29 +++++++++++++++++ .../Fixture/other-calls-middle.php.inc | 31 +++++++++++++++++++ .../CommandConfigureToAttributeRector.php | 1 + 3 files changed, 61 insertions(+) create mode 100644 rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/name_and_hidden.php.inc create mode 100644 rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/other-calls-middle.php.inc diff --git a/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/name_and_hidden.php.inc b/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/name_and_hidden.php.inc new file mode 100644 index 00000000..07bcf78d --- /dev/null +++ b/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/name_and_hidden.php.inc @@ -0,0 +1,29 @@ +setName('sunshine'); + $this->setAliases(['first', 'second']) + ->setHidden(true); + } +} + +?> +----- + diff --git a/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/other-calls-middle.php.inc b/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/other-calls-middle.php.inc new file mode 100644 index 00000000..f5bad67f --- /dev/null +++ b/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/other-calls-middle.php.inc @@ -0,0 +1,31 @@ +setName('sunshine') + ->addArgument('argument name') + ->setAliases(['first', 'second']); + } +} + +?> +----- +addArgument('argument name'); + } +} + +?> diff --git a/rules/Symfony61/Rector/Class_/CommandConfigureToAttributeRector.php b/rules/Symfony61/Rector/Class_/CommandConfigureToAttributeRector.php index 53f50dde..512cb443 100644 --- a/rules/Symfony61/Rector/Class_/CommandConfigureToAttributeRector.php +++ b/rules/Symfony61/Rector/Class_/CommandConfigureToAttributeRector.php @@ -39,6 +39,7 @@ final class CommandConfigureToAttributeRector extends AbstractRector implements 'setName' => 'name', 'setDescription' => 'description', 'setAliases' => 'aliases', + 'setHidden' => 'hidden', ]; public function __construct( From 568a8cb5b1e61c9bac5f31afc2d1286b7af4ce20 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 25 Jun 2024 08:58:41 +0900 Subject: [PATCH 3/3] add hidden false fixture --- .../Fixture/name_and_hidden_false.php.inc | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/name_and_hidden_false.php.inc diff --git a/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/name_and_hidden_false.php.inc b/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/name_and_hidden_false.php.inc new file mode 100644 index 00000000..4bbb35b8 --- /dev/null +++ b/rules-tests/Symfony61/Rector/Class_/CommandConfigureToAttributeRector/Fixture/name_and_hidden_false.php.inc @@ -0,0 +1,28 @@ +setHidden(false); + $this->setName('sunshine'); + } +} + +?> +----- +