Skip to content

Conversation

@laetus007
Copy link

@laetus007 laetus007 commented Jan 12, 2026

Overview

This pull request:

  • Fixes a bug
  • Adds a feature
  • Breaks backwards compatibility
  • Has tests that cover changes
  • Adds or fixes documentation

Summary

Proposed Solution:
Added a compatibility wrapper addCommand() in Robo\Application that:

  • Calls parent::addCommand() if available (Symfony 7.4+)
  • Falls back to parent::add() for Symfony 6
  • Override add() in Robo\Application to redirect to addCommand()

Update all internal calls to use addCommand() instead of add()

This ensures Robo works without deprecation warnings on Symfony 7.4+ and remains compatible with Symfony 6.

Description

When using Robo with Symfony Console 7.4+, a deprecation warning is triggered:

ERROR: Since symfony/console 7.4: The "Symfony\Component\Console\Application::add()" method is deprecated and will be removed in Symfony 8.0, use "Symfony\Component\Console\Application::addCommand()" instead.

This occurs because Robo and its consumers call add() to register commands, but Symfony 7.4+ expects addCommand() instead. However, Symfony 6 does not have addCommand(), so a compatibility layer is needed.

***Note: We heavily use robo to orchestrate our local development and CI/CD for a single Drupal codebase using a custom upstream in Pantheon for over 200+ sites. We recently updated to Drupal 11.3 and we started getting a number of errors when running the custom robo commands. AI was used in the analysis of this issue and the solution proposed. We have tested against our own codebase and validated the errors no longer appear for us. I'll watch this to see if there are any test failures and will try to gracefully address, if possible and as time permits.

@pixelbrackets
Copy link
Contributor

pixelbrackets commented Feb 5, 2026

I tested this in issue 1183, works like a charm. All breaking messages gone. A merge would be appreciated since this affects every run of a robo script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants