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

SentryTestCommand > Fix deprecated $defaultName #635

Merged
merged 1 commit into from
May 28, 2022

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented May 27, 2022

This fixes a deprecation on Symfony 6.1:

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 "Sentry\SentryBundle\Command\SentryTestCommand" class instead.

@ruudk ruudk changed the title SentryTestCommand > Add #[AsCommand] attribute SentryTestCommand > Fix deprecated $defaultName May 27, 2022
@ruudk ruudk force-pushed the patch-2 branch 2 times, most recently from 7caa57e to ff030f1 Compare May 27, 2022 09:29
@Jean85 Jean85 added this to the 4.2 milestone May 27, 2022
Copy link
Collaborator

@Jean85 Jean85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we simply add the attribute, so we can avoid both the deprecation and the separation between the command and its name? Attributes are parsed as comments in older PHP versions.

@ruudk
Copy link
Contributor Author

ruudk commented May 27, 2022

I tried that first (adding AsCommand attribute and keeping the $defaultName property) but unfortunately, that gives us this error:

The "Symfony\Component\Console\Command\Command::$defaultName" property is considered final. You should not override it in "Sentry\SentryBundle\Command\SentryTestCommand".

Copy link
Collaborator

@Jean85 Jean85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so the change LGTM.

Can you please add a changelog entry then?

This fixes a deprecation on Symfony 6.1:
```
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 "Sentry\SentryBundle\Command\SentryTestCommand" class instead.
```
@ruudk
Copy link
Contributor Author

ruudk commented May 28, 2022

@Jean85 done!

@Jean85 Jean85 merged commit 4174898 into getsentry:master May 28, 2022
@ruudk ruudk deleted the patch-2 branch May 28, 2022 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants