Skip to content

Replace deprecated Symfony Console add() with addCommand()#755

Closed
ozdemirburak wants to merge 1 commit intotighten:mainfrom
ozdemirburak:fix-symfony-console
Closed

Replace deprecated Symfony Console add() with addCommand()#755
ozdemirburak wants to merge 1 commit intotighten:mainfrom
ozdemirburak:fix-symfony-console

Conversation

@ozdemirburak
Copy link
Copy Markdown

This PR fixes the warning below:

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.

@tomasnorre
Copy link
Copy Markdown
Contributor

Wouldn't you need to bump the symfony/console to ^7.4 to ensure the new command is present? I think that's why the "lowest" tests are failing.

"symfony/console": "^7.4" requires PHP >= 8.2
"tightenco/jigsaw": "1.8.3" requires PHP ^8.2

So it should be possible to "just" bump the requirements

@midnight-wonderer
Copy link
Copy Markdown
Contributor

Hi, sorry, I didn't see this PR before starting work on mine (#768).
I've already addressed the issue, and all tests passed.

The problem with this PR is as @tomasnorre mentioned.
However, the minimum version is actually 7.1. From the Composer log, we see that the failing tests installed 7.0.

@ozdemirburak
Copy link
Copy Markdown
Author

Thanks, just updated composer.json. Though, according to this CHANGELOG, it is 7.4 where addCommand was introduced.

@midnight-wonderer
Copy link
Copy Markdown
Contributor

In my PR, I used addCommands, which has been available since 7.1:
https://github.com/symfony/console/blob/7.1/Application.php#L502
This, IMO, not only supports a wider range of versions but is also more idiomatic for the use case in Jigsaw.

I guess, I'll leave mine open, just in case.

@nicodevs
Copy link
Copy Markdown
Contributor

Closed in favor of #768

@nicodevs nicodevs closed this Feb 27, 2026
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.

4 participants