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

Forbidden and deprecated functions #141

Merged
merged 2 commits into from
Apr 14, 2021

Conversation

stronk7
Copy link
Member

@stronk7 stronk7 commented Apr 11, 2021

This comes with 2 commits, first one slightly modifying/modernizing our ForbiddenFunctions Sniff, adding also some comments bout why we are using it.

And then a second commit where our new DeprecatedFunctions is introduced, really similar to the ForbiddenFunctions one, able to detect both PHP own deprecated functions and our ones, with alternatives where available.

Note that we have had to implement the DeprecatedFunctions->addError() method because the Generic.DeprecatedFunctions one is missing support to show the alternatives. I've created squizlabs/PHP_CodeSniffer#3295 about that. If accepted upstream, we'll be able to remove that implementation from our Sniff.

Covered with tests (that hopefully will be all green soon) and implements #137.

Ciao :-)

stronk7 added 2 commits April 11, 2021 18:09
Nothing important, just switching from constructor to
properties and adding some explanations about why we
have that Sniff extending the Generic one instead of
reusing it.
To be able to add our own deprecations and messages we have
extended the existing Generic DeprecatedFunctions Sniff.

This version shows the alternatives and is able to process
together both the internal (PHP) deprecated functions and
our own ones (print_error).

Covered with tests. This fixes moodlehq#137
Copy link
Member

@sarjona sarjona left a comment

Choose a reason for hiding this comment

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

Thanks for working on this Eloy! The patch looks good (and has helped me to understand a little bit more how code checker works) :-)

@sarjona sarjona merged commit 46b5d10 into moodlehq:master Apr 14, 2021
@stronk7
Copy link
Member Author

stronk7 commented Apr 14, 2021

Thanks!

@stronk7 stronk7 deleted the forbidden_and_deprecated_functions branch April 14, 2021 17:03
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

Successfully merging this pull request may close these issues.

2 participants