WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Deprecation warning from Symfony Console breaks Robo #1183

@rsebboc

Description

@rsebboc

Hello

After upgrading my dependencies, I am getting the following error message after every Robo command (including just robo):
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.

It seems to be related to src/Robo.php in registerSingle() method:

         // If the instance is a Symfony Command, register it with
        // the application
        if ($instance instanceof Command) {
            $app->add($instance); // <--- DEPRECATED
            return $instance;
        }

        // Register commands for all of the public methods in the RoboFile.
        $commandFactory = $container->get('commandFactory');
        $commandList = $commandFactory->createCommandsFromClass($instance);
        foreach ($commandList as $command) {
            $app->add($command); // <--- DEPRECATED
        }
        return $instance;

Replacing them with ->addCommand() removes the error message. I am not sure what other impact it could have.

Added #1184

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions