We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Idea: Have a way to check if a class contains a particular method.
Class::containsMethod( string $class, string $method_name );
Instead of a string $class, perhaps a $stackPtr could be used instead.
string $class
$stackPtr
The text was updated successfully, but these errors were encountered:
This is related to something I have been thinking about already: a method to retrieve the method names of all methods declared in a class.
The code would then becomes something like:
$methods = Class::getMethodNames($phpcsFile, $stackPtr); if (isset($methods[$targetMethod])) { // Do something. }
Just keep in mind that any utility method which has to walk a large chunk of code is highly inefficient.
So, again, my question is: can you make the use-case more specific ? Can you give some examples of sniffs for which this would be useful ?
It might be better to create an abstract class as a base instead.
Sorry, something went wrong.
@GaryJones Have a look at #592. I believe that PR addressed this request along the lines of the comment I posted before.
Successfully merging a pull request may close this issue.
Idea: Have a way to check if a class contains a particular method.
Instead of a
string $class
, perhaps a$stackPtr
could be used instead.The text was updated successfully, but these errors were encountered: