Fix: Add Symfony Console 7.4+ addCommand() compatibility#1185
Fix: Add Symfony Console 7.4+ addCommand() compatibility#1185laetus007 wants to merge 2 commits into
Conversation
|
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. |
|
@greg-1-anderson any chance to get this merged and released soon? It's a real bummer ATM 🫤 |
There was a problem hiding this comment.
This looks complete, and I like the compatibility wrapper with a clear instruction as to how to fix the invalid argument.
This solves a current issue with Robo. I see no reason to hold it back. Thank you aetus007
Update: Tested on several projects using Robo and works flawlessly.
|
it looks like better to add the shim to annotated command repo so robo and config and drush can reuse it faced working on Symfon7 8+ compatibility where the |
|
Yes - I agree that this should not be merged here and it is more appropriate to address - https://github.com/search?q=repo%3Aconsolidation%2Fannotated-command+-%3Eadd%28&type=code What is best practice in this scenario? Convert this to draft while the issue is reported and addressed in the annotated-command? |
Overview
This pull request:
Summary
Proposed Solution:
Added a compatibility wrapper addCommand() in Robo\Application that:
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:
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.