Skip to content

Conversation

@jury89
Copy link
Contributor

@jury89 jury89 commented Oct 13, 2022

This PR is addressing the following deprecation warnings that I'm getting when using Symfony 6.1 and the latest version of the oauth2 server bundle.

2022-10-13T07:48:25+00:00 [info] User Deprecated: Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute to the "League\Bundle\OAuth2ServerBundle\Command\CreateClientCommand" class instead. 2022-10-13T07:48:25+00:00 [info] User Deprecated: Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute to the "League\Bundle\OAuth2ServerBundle\Command\UpdateClientCommand" class instead. 2022-10-13T07:48:25+00:00 [info] User Deprecated: Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute to the "League\Bundle\OAuth2ServerBundle\Command\DeleteClientCommand" class instead. 2022-10-13T07:48:25+00:00 [info] User Deprecated: Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute to the "League\Bundle\OAuth2ServerBundle\Command\ListClientsCommand" class instead. 2022-10-13T07:48:25+00:00 [info] User Deprecated: Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute to the "League\Bundle\OAuth2ServerBundle\Command\ClearExpiredTokensCommand" class instead. 

In all Commands, I have replaced the deprecated static property "$defaultName" with the AsCommand attribute. As a result of this change, I also had to upgrade the minimum PHP version allowed from 7.2 to 8.0.

@fbourigault
Copy link
Contributor

For a Bundle, I would like to recommend using the command and description attributes of the console.command tag.

@jury89
Copy link
Contributor Author

jury89 commented Oct 13, 2022

Thank you @fbourigault for your suggestion, I didn't know that was possible. I will close this PR and reopen a new one with the suggested implementation

@jury89 jury89 closed this Oct 13, 2022
@jury89 jury89 deleted the ascommand-deprecation-notice branch October 13, 2022 09:46
chalasr added a commit that referenced this pull request Oct 16, 2022
This PR was merged into the 0.4-dev branch. Discussion ---------- Fix deprecation warnings in commands This PR a follow up of #105 and it's addressing the following deprecation warnings that I'm getting when using Symfony 6.1 and the latest version of the oauth2 server bundle. ``` 2022-10-13T07:48:25+00:00 [info] User Deprecated: Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute to the "League\Bundle\OAuth2ServerBundle\Command\CreateClientCommand" class instead. 2022-10-13T07:48:25+00:00 [info] User Deprecated: Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute to the "League\Bundle\OAuth2ServerBundle\Command\UpdateClientCommand" class instead. 2022-10-13T07:48:25+00:00 [info] User Deprecated: Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute to the "League\Bundle\OAuth2ServerBundle\Command\DeleteClientCommand" class instead. 2022-10-13T07:48:25+00:00 [info] User Deprecated: Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute to the "League\Bundle\OAuth2ServerBundle\Command\ListClientsCommand" class instead. 2022-10-13T07:48:25+00:00 [info] User Deprecated: Since symfony/console 6.1: Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "Symfony\Component\Console\Attribute\AsCommand" attribute to the "League\Bundle\OAuth2ServerBundle\Command\ClearExpiredTokensCommand" class instead. ``` Commits ------- b9998c0 Add #[AsCommand] attribute for discovery and future-proofness d2ca305 replace static property $defaultName in commands with command attributes of tag "console.command"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants