-
Notifications
You must be signed in to change notification settings - Fork 18
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
Detect override of deprecated property #90
base: 1.1.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We shouldn't report this for private properties that are marked as
@deprecated
. - We should also have the same rule for methods and constants.
- These new rules have to be registered in bleedingEdge only. Example here: https://github.com/phpstan/phpstan-doctrine/blob/62bd362b432fe29e175168689510ddd927b698f8/rules.neon#L27-L29
a5d3011
to
7ba6d2f
Compare
7ba6d2f
to
2226d83
Compare
|
||
$parents = $class->getParents(); | ||
|
||
$name = (string) $node->consts[0]->name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should go through all the constants, not just the first one.
|
||
$class = $scope->getClassReflection(); | ||
|
||
$parents = $class->getParents(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't go through all the parents. This would break the @deprecated
/ @not-deprecated
behaviour. Please read about it and write a test: https://phpstan.org/writing-php-code/phpdocs-basics#deprecations
It's sufficient to ask for the property in the first parent class if there's one.
You should also look into interfaces.
|
||
$class = $scope->getClassReflection(); | ||
|
||
$parents = $class->getParents(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dtto with parents
return []; | ||
} | ||
|
||
return [sprintf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the more modern approach with RuleErrorBuilder instead of just returning a string.
2226d83
to
99cadb0
Compare
Hi, I can't review this because you need to rebase your commits on top of 1.1.x. Your branch includes commits from 1.2.x which is unwanted. |
5ec6592
to
daf5f98
Compare
Sorry about that, after it took me so long to get back to this, I just updated to the most recent branch. |
daf5f98
to
b924bc4
Compare
Closes #82