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

PrefixAllGlobals + ValidFunctionName: ignore deprecated methods by design #1806

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Oct 4, 2019

Sniff: add new is_function_deprecated() utility function

This new function:

  • Tries to find a function docblock, if it exists.
  • If found, checks if the docblock contains at least one @deprecated tag.

Returns boolean true/false.

Note: this method is static to allow the ValidFunctionName sniff which extends an upstream sniff to use the method as well.

ValidFunctionName: ignore deprecated functions

Check the function docblock for a @deprecated tag and if found, bow out.

Includes unit tests.

PrefixAllGlobals: ignore deprecated functions

Check the function docblock for a @deprecated tag and if found, bow out.

Includes unit tests.

Note: the same should probably also be done for classes/interfaces/traits/constants marked as deprecated, but that's for another PR.


Fixes #1797

This new function:
* Tries to find a function docblock, if it exists.
* If found, checks if the docblock contains at least one `@deprecated` tag.

Returns boolean true/false.

Note: this method is `static` to allow the `ValidFunctionName` sniff which extends an upstream sniff to use the method as well.
Check the function docblock for a `@deprecated` tag and if found, bow out.

Includes unit tests.

Fixes 1797
Copy link
Member

@GaryJones GaryJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Member

@dingo-d dingo-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some minor comments 🙂

@jrfnl jrfnl force-pushed the feature/1797-ignore-deprecated-functions-for-namechecks branch from 677171a to d5640f8 Compare October 4, 2019 20:39
Check the function docblock for a `@deprecated` tag and if found, bow out.

Includes unit tests.

Fixes 1797

Note: the same should probably also be done for classes/interfaces/traits/constants marked as deprecated, but that's for another PR.
Copy link
Member

@dingo-d dingo-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@dingo-d dingo-d merged commit e7bfc16 into develop Oct 4, 2019
@dingo-d dingo-d deleted the feature/1797-ignore-deprecated-functions-for-namechecks branch October 4, 2019 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValidFunctionName: ignore deprecated methods by design
3 participants