-
Notifications
You must be signed in to change notification settings - Fork 461
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 deprecated methods from the interface as well. #792
Detect deprecated methods from the interface as well. #792
Conversation
|
||
$class = $reflectionProvider->getClass(\DeprecatedAnnotations\DeprecatedBar::class); | ||
$scope = $this->createMock(Scope::class); | ||
$this->assertTrue($class->getMethod('superDeprecated', $scope)->isDeprecated()->yes()); |
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.
I don't like mocking, you can call getNativeMethod
instead
@@ -131,4 +131,15 @@ public function testNonDeprecatedNativeFunctions(): void | |||
$this->assertFalse($reflectionProvider->getFunction(new Name('function_exists'), null)->isDeprecated()->yes()); | |||
} | |||
|
|||
public function testDeprecatedMethodsFromInterface(): void | |||
{ | |||
require_once __DIR__ . '/data/annotations-deprecated.php'; |
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.
The require doesn't need to be there. You just need to make sure to run composer dump
locally before running tests.
Can you please rebase and force push so that the history is linear with no merge commits? Thank you. |
34a1f5c
to
a8322b2
Compare
Of course, no problem. Thanks for your time Ondrej, and thanks again for the family of phpstan libraries! |
Thank you! |
@ondrejmirtes @eiriksm Actually this is wrong behavour and conflicts with phpstan/phpstan#3378. The assumption that if a method in a parent class is deprecated, then a method in a child class should also be deprecated is not correct. I have an example. So I suggest to revert this changes. |
Based on feedback from phpstan/phpstan-deprecation-rules#49
Initial bug report on that repo: phpstan/phpstan-deprecation-rules#48