Skip to content

Conversation

@heiglandreas
Copy link

Static analysis tools like PHPStan treat the @deprecated flag as inherited. So when a class constant is marked as deprecated, then the same class constant in an extending class is also marked deprecated unless it gets explicitly marked as @non-deprecated.

Without this flag PHPStan will return the message

Fetching deprecated class constant LAST_USERNAME of class Symfony\Bundle\SecurityBundle\Security:                          
since Symfony 6.2, use \Symfony\Bundle\SecurityBundle\Security::LAST_USERNAME instead 

which is not really helpful as that is exactly what one did at that point.

By marking these class-constants as @non-deprecated PHPStan and other static analysis tools can recognize these class constants as being the rightly used ones.

For more information have a look at the discussion at phpstan/phpstan-deprecation-rules#100

Static analysis tools like PHPStan treat the `@deprecated` flag as inherited. So when a class constant is marked as deprecated, then the same class constant in an extending class is also marked deprecated unless it gets explicitly marked as `@non-deprecated`.

Without this flag PHPStan will return the message 

Fetching deprecated class constant LAST_USERNAME of class Symfony\Bundle\SecurityBundle\Security:                         
since Symfony 6.2, use \Symfony\Bundle\SecurityBundle\Security::LAST_USERNAME instead 

which is not really helpful as that is exactly what one did at that point.

By marking these class-constants as @non-deprecated PHPStan and other static analysis tools can recognize these class constants as being the rightly used ones.

For more information have a look at the discussion at phpstan/phpstan-deprecation-rules#100
@github-actions
Copy link

Thanks for your pull request! We love contributions.

However, you should instead open a pull request on the main repository:

https://github.com/symfony/symfony

This repository is what we call a "subtree split": a read-only subset of that main repository.

We're looking forward to your PR there!

@github-actions github-actions bot closed this Jun 16, 2023
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.

1 participant