CS: enforce consistent array format #13354
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR can be summarized in the following changelog entry:
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:
This is a code-only change and should have no effect on the functionality.