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

Docs: clarify the $matched_content parameter #2280

Merged
merged 1 commit into from
Jul 4, 2023

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jul 4, 2023

When the $matched_content param is passed from the AbstractFunctionRestrictionsSniff or, by extension, from the `AbstractFunctionParameterSniff``, it will always already be in lowercase.

When the $matched_content param is passed from the AbstractClassRestrictionsSniff sniff it will be in its original case.

This commit updates the docs of all involved methods to include information about the case of the content of $matched_content to clarify this.

Includes removing two unnecessary calls to strtolower() in child classes.

Includes overloading the process_matched_token() method in the AbstractClassRestrictionsSniff, not because the code does anything different, but only to ensure the docblock annotates correctly that in child classes of that abstract the $matched_content will be in its original case.

When the `$matched_content` param is passed from the `AbstractFunctionRestrictionsSniff` or, by extension, from the `AbstractFunctionParameterSniff``, it will always already be in lowercase.

When the `$matched_content` param is passed from the `AbstractClassRestrictionsSniff` sniff it will be in its original case.

This commit updates the docs of all involved methods to include information about the case of the content of `$matched_content` to clarify this.

Includes removing two unnecessary calls to `strtolower()` in child classes.

Includes overloading the `process_matched_token()` method in the `AbstractClassRestrictionsSniff`, not because the code does anything different, but only to ensure the docblock annotates correctly that in child classes of that abstract the `$matched_content` will be in its original case.
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.

@GaryJones GaryJones merged commit eaedf44 into develop Jul 4, 2023
35 checks passed
@GaryJones GaryJones deleted the feature/docs-clarify-matched_content-param branch July 4, 2023 11:13
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.

3 participants