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

Some simplifications of sniffs extending the WPCS AbstractArrayAssignmentRestrictionsSniff #758

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Jun 24, 2023

Some simplifications of sniffs extending the WPCS AbstractArrayAssignmentRestrictionsSniff

The WPCS AbstractArrayAssignmentRestrictionsSniff expects an array from getGroups() which includes a 'message' key.
The callback() method subsequently allows to override that message with a higher priority message if needed in specific circumstances.

None of these sniffs, however, have a need to override the message, so the callback() method can just use the default behaviour of returning true or false and use the 'message' as declared in the group.

Remove some extraneous comments

... from these same sniffs. These comments are copy/paste documentation from the abstract and not specific to the actual sniff.

…nmentRestrictionsSniff`

The WPCS `AbstractArrayAssignmentRestrictionsSniff` expects an array from `getGroups()` which includes a `'message'` key.
The `callback()` method subsequently allows to override that message with a higher priority message if needed in specific circumstances.

None of these sniffs, however, have a need to override the message, so the `callback()` method can just use the default behaviour of returning `true` or `false` and use the `'message'` as declared in the group.
... from these same sniffs. These comments are copy/paste documentation from the abstract and not specific to the actual sniff.
@jrfnl jrfnl requested a review from a team as a code owner June 24, 2023 03:05
Copy link
Contributor

@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 added this to the 2.3.4 milestone Jun 24, 2023
@GaryJones GaryJones merged commit df070e7 into develop Jun 24, 2023
@GaryJones GaryJones deleted the feature/various-improvements-to-sniff-extending-abstractarrayassignment branch June 24, 2023 09:52
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.

2 participants