Skip to content

[Symfony73] Remove empty configure() method in CommandHelpToAttributeRector#969

Merged
TomasVotruba merged 1 commit into
mainfrom
remove-empty-configure-help
Jul 23, 2026
Merged

[Symfony73] Remove empty configure() method in CommandHelpToAttributeRector#969
TomasVotruba merged 1 commit into
mainfrom
remove-empty-configure-help

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Once setHelp() is moved to the #[AsCommand] attribute, the configure() method is often left empty. The removal code was a no-op — it unset() a local variable instead of removing the method from the class.

Now the empty configure() is removed, the same way #966 does it for CommandConfigureToAttributeRector. A leftover parent::configure() call counts as empty too.

 #[AsCommand(name: 'some_name', help: <<<'TXT'
 Some help text
 TXT)]
 final class AddHelpToAttributeCommand extends Command
 {
-    public function configure()
-    {
-    }
 }

With a parent::configure() left over:

-#[AsCommand(name: 'some_name')]
+#[AsCommand(name: 'some_name', help: <<<'TXT'
+Some help text
+TXT)]
 final class RemoveConfigureWithParentCall extends Command
 {
-    public function configure()
-    {
-        parent::configure();
-
-        $this->setHelp('Some help text');
-    }
 }

A configure() with other calls left in it is kept as is.

@TomasVotruba
TomasVotruba enabled auto-merge (squash) July 23, 2026 21:04
@TomasVotruba
TomasVotruba merged commit 470e1cd into main Jul 23, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the remove-empty-configure-help branch July 23, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant