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

Fail on method calls to deprecated classes #85

Open
gms8994 opened this issue Mar 9, 2023 · 0 comments
Open

Fail on method calls to deprecated classes #85

gms8994 opened this issue Mar 9, 2023 · 0 comments

Comments

@gms8994
Copy link

gms8994 commented Mar 9, 2023

If a class is deprecated, I would expect that any calls to methods in that deprecated class should also trigger a deprecation message.

For example, a change that I implemented locally in CallToDeprecatedMethodRule:

if ($classReflection->isDeprecated()) {
    $description = $methodReflection->getDeprecatedDescription();
    if ($description === null) {
        return [sprintf(
            'Call to method %s() of deprecated class %s.',
            $methodReflection->getName(),
            $methodReflection->getDeclaringClass()->getName()
        )];
    }

    return [sprintf(
        "Call to method %s() of deprecated class %s:\n%s",
        $methodReflection->getName(),
        $methodReflection->getDeclaringClass()->getName(),
        $description
    )];
}

Though maybe this makes more sense as a separate rule within this library, it works well enough for my needs.

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

No branches or pull requests

1 participant