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

Change the property name in the MinimumWPVersionTrait trait #2113

Closed
dingo-d opened this issue Nov 25, 2022 · 5 comments · Fixed by #2118
Closed

Change the property name in the MinimumWPVersionTrait trait #2113

dingo-d opened this issue Nov 25, 2022 · 5 comments · Fixed by #2118
Assignees
Milestone

Comments

@dingo-d
Copy link
Member

dingo-d commented Nov 25, 2022

Is your feature request related to a problem?

In the MinimumWPVersionTrait trait, we have a public property that can be referenced in the sniffs, called $minimum_supported_version. However, the CLI argument for setting the minimum supported WP version is named minimum_supported_wp_version.

public $minimum_supported_version = '5.1';

And that can cause some confusion when writing sniffs - in the tests and in the sniffs we are using one naming (minimum_supported_version), and when the property should be consumed, either via CLI, or via ruleset, we need to use the other name (minimum_supported_wp_version):

<config name="minimum_supported_wp_version" value="5.4"/>

or

phpcs --runtime-set minimum_supported_wp_version 4.5

Describe the solution you'd like

The solution would be to change this property in the trait to be named $minimum_supported_wp_version. All the sniffs consuming this trait would be affected, and the tests as well, but since we would release this in the 3.0.0 version, this is an allowed BC break.

@dingo-d dingo-d added this to the 3.0.0 milestone Nov 25, 2022
@jrfnl
Copy link
Member

jrfnl commented Nov 25, 2022

I fully support this proposal. What about naming it minimum_wp_version in that case ? I mean, I'm wondering if the supported in the property/CLI name has added value... ?

Historical perspective:

  • IIRC the property was added first and as the property would be added to WP specific sniffs via the ruleset, the minimum_supported_version` name was descriptive enough.
  • At a later point in time, support for setting the property for all sniffs via the command-line was added.
    Now when using minimum_supported_version from the CLI without the context of the specific sniffs, it could be confusing... minimum supported version of what ? Which is why the CLI implementation uses a slightly different name minimum_supported_wp_version.

@GaryJones
Copy link
Member

I'm happy with minimum_wp_version. Would need calling out in 3.0.0 changelogs/docs/wiki. Bit of a pain for consumers to update their PHPCS config files just to help us align a name internally, but the major release is the time to do it :-)

@dingo-d
Copy link
Member Author

dingo-d commented Nov 26, 2022

Yeah, minimum_wp_version sounds best. The aim is to make the naming of the cli argument and the trait property the same to have more consistency.

And since it's a major change we would denote what was changed in the changelog ofc 🙂

@jrfnl jrfnl self-assigned this Nov 26, 2022
@jrfnl
Copy link
Member

jrfnl commented Nov 26, 2022

I'll prepare a PR for this to be pulled after PR #2112 has been merged (and will add information about the change to the WIP upgrade guides and such which I have locally).

@jrfnl
Copy link
Member

jrfnl commented Nov 26, 2022

👉🏻 This will also need a change in the Wiki. Linking to #1917 for visibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants