Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony 6.1 command deprecations #85

Closed
0x6d6c opened this issue Jun 10, 2022 · 2 comments · Fixed by #86
Closed

Symfony 6.1 command deprecations #85

0x6d6c opened this issue Jun 10, 2022 · 2 comments · Fixed by #86

Comments

@0x6d6c
Copy link

0x6d6c commented Jun 10, 2022

The following commands:

  • ListProvidersCommand
  • StatusCommand
  • VersionBumpCommand

rely on $defaultName property which is deprecated in Symfony 6.1:

Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated.

It can be replaced by the Symfony\Component\Console\Attribute\AsCommand PHP 8 attribute, also the command descriptions can be placed in the attribute, e.g.:

<?php

use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(
    name: 'app:version:list-providers',
    description: 'List all registered version providers',
)]
final class ListProvidersCommand extends Command
{
    // To remove:
    // protected static $defaultName = 'app:version:list-providers';

    // Also to remove:
    // $this->setDescription('List all registered version providers');
    // from configure() method
    ...
}

I'd happy to prepare a PR but have no idea how to make attributes are not allowed in PHP 7 and I have no idea how to provide a solution compatible with PHP 7.

@dontub
Copy link
Collaborator

dontub commented Jun 16, 2022

Have you already tried adding the attribute and keeping the property for backward compatibility?

@0x6d6c
Copy link
Author

0x6d6c commented Jun 17, 2022

No, I haven't, unfortunately and I have no idea how to make it backward compatible. All commands in my projects use attribites but they run on PHP 8.1 so I haven't had to make it BC.

dontub added a commit that referenced this issue Jul 10, 2022
This issue was closed.
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 a pull request may close this issue.

2 participants