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

Move printing functions related functionality to dedicated PrintingFunctionsTrait #2250

Merged
merged 1 commit into from
Jun 16, 2023

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jun 15, 2023

The printing function list is only used by a small set of sniffs, so are better placed in a dedicated trait.

The choice for a trait over a class is due to the public property allowing for adding additional functions to the list.

Moving both the base function list + the public property to the same trait will allow us to encapsulate all the functionality related to the use of this list in one place.

The $printingFunctions property, containing the base lists, has also been made private.

Checking whether or not something is a printing function should now be done by calling the PrintingFunctionsTrait::is_printing_function() method.

Related to #1465

…unctionsTrait`

The printing function list is only used by a small set of sniffs, so are better placed in a dedicated trait.

The choice for a `trait` over a `class` is due to the `public` property allowing for adding additional functions to the list.

Moving both the base function list + the `public` property to the same trait will allow us to encapsulate all the functionality related to the use of this list in one place.

The `$printingFunctions` property, containing the base lists, has also been made `private`.

Checking whether or not something is a printing function should now be done by calling the `PrintingFunctionsTrait::is_printing_function()` method.

Related to 1465
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.

I wanted to leave a comment in the previous PR if these are going to be moved as well, but I kinda had the hunch you already did that 😄

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.

@jrfnl
Copy link
Member Author

jrfnl commented Jun 15, 2023

Just checking @dingo-d @GaryJones: What with you both approving, can this be merged ?

@dingo-d dingo-d merged commit 2e72cd6 into develop Jun 16, 2023
@dingo-d dingo-d deleted the feature/new-printingfunctionstrait branch June 16, 2023 05:10
@jrfnl jrfnl mentioned this pull request Jun 16, 2023
GaryJones added a commit to Automattic/VIP-Coding-Standards that referenced this pull request Jun 20, 2023
GaryJones added a commit to Automattic/VIP-Coding-Standards that referenced this pull request Jun 22, 2023
GaryJones added a commit to Automattic/VIP-Coding-Standards that referenced this pull request Jun 22, 2023
GaryJones added a commit to Automattic/VIP-Coding-Standards that referenced this pull request Jun 22, 2023
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