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

CS: enforce consistent array format #13354

Merged
merged 1 commit into from Oct 3, 2019

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Aug 7, 2019

Summary

This PR can be summarized in the following changelog entry:

  • N/A

Relevant technical choices:

WordPressCS will demand long arrays and forbid the use of short arrays as of WPCS 2.2.0.
See: https://make.wordpress.org/core/2019/07/12/php-coding-standards-changes/

For YoastCS, however, a choice has been made to demand short arrays.

For now, while WP 4.9, and therefore PHP 5.2 still needs to be supported, this is only possible in the directories containing files with PHP 5.6+ code.
So in this interim period, we will enforce short arrays in the PHP 5.6+ code and long arrays everywhere else.

Once the minimum supported WP version has moved up to WP 5.2 / PHP 5.6, short arrays will be enforced for all code and the change-over can be done automatically using the auto-fixer included in the relevant sniff.

Test instructions

This PR can be tested by following these steps:

  • N/A
    This is a code-only change and should have no effect on the functionality.

@jrfnl jrfnl force-pushed the JRF/CS/enforce-consistent-array-format branch from 44821d1 to bb396f9 Compare August 7, 2019 03:24
@jrfnl
Copy link
Contributor Author

jrfnl commented Aug 16, 2019

P.S.: Once someone is ready to review this, please ping me as by that time, this PR may be out-of-date and new issues may have been introduced. I can fix that up easily enough, but makes more sense only doing that once this PR will get attention.

@jrfnl jrfnl force-pushed the JRF/CS/enforce-consistent-array-format branch 3 times, most recently from 304bef3 to 91bc006 Compare October 3, 2019 05:26
WordPressCS will demand long arrays and forbid the use of short arrays as of WPCS 2.2.0.
See: https://make.wordpress.org/core/2019/07/12/php-coding-standards-changes/

For YoastCS, however, a choice has been made to demand short arrays.

For now, while WP 4.9, and therefore PHP 5.2 still needs to be supported, this is only possible in the directories containing files with PHP 5.6+ code.
So in this interim period, we will enforce short arrays in the PHP 5.6+ code and long arrays everywhere else.

Once the minimum supported WP version has moved up to WP 5.2 / PHP 5.6, short arrays will be enforced for all code and the change-over can be done automatically using the auto-fixer included in the relevant sniff.
@IreneStr IreneStr added this to the 12.4 milestone Oct 3, 2019
@IreneStr IreneStr added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Oct 3, 2019
@IreneStr IreneStr merged commit 2c10d3f into trunk Oct 3, 2019
@IreneStr IreneStr deleted the JRF/CS/enforce-consistent-array-format branch October 3, 2019 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog yoast cs/qa
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants