-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support for #[Deprecated()] annotation #81
Comments
Could be a nice feature! The today work around: Double /**
* @deprecated
*/
#[Deprecated("use createFromDateRange() instead", 'DateHelper::createFromDateRange(%parametersList%)')]
public static function fromDateRangePicker(string $dateRangeFormData): array
{
return self::createFromDateRange($dateRangeFormData);
} |
Is it hard to implement @ondrejmirtes? |
It's not hard at all. The issue is that this attribute isn't official in any way. Someone might prefer to use a different attribute (like their own class) for this same purpose so we better make sure this system is extensible like other similar extension types in PHPStan: https://phpstan.org/developing-extensions/extension-types |
Sorry, I hijacked this. The wrong node would be passed in. But using Old and invalidI think this would be achievable if `\PHPStan\Rules\Deprecations\DeprecatedScopeHelper` was aware of the node in `\PHPStan\Rules\Deprecations\DeprecatedScopeHelper::isScopeDeprecated`. A custom deprecated scope resolver could then inspect the node to see if it has the attribute. The problem is I cannot think of a non-breaking way to introduce a change to Edit: Passing the node object in would help solve a final problem in mglaman/phpstan-drupal#714 for myself. I'll propose a PR so we can discuss the code, or just close out the idea. |
the native attribute with php 8.4 which was added with https://wiki.php.net/rfc/deprecated_attribute already works like expected (I just work on adding test-coverage) |
@staabm It doesn't. I have about 500 LoC commit in my private PHPStan 2.1.x branch that adds proper support for that to PHPStan. Hopefully it's going to be out still in 2024. |
in my local testing it at least reports calls to functions annotated with will wait for your work then so we don't step onto each others toe |
phpstorm-stubs use JetBrains\PhpStorm\Deprecated annotation to mark method's, class e.t.c
This annotation allows for more detailed description of the problem and suggested changes.
Other projects use this annotation as well
Can deprecation-rules show it in the same way like
@deprecated
?The text was updated successfully, but these errors were encountered: