🔧 PHPCS: add configuration for array double arrow alignment

This configuration makes the sniff less finicky when all array items are multi-line.

It allow allows for cleaner diffs as an array will not need to be reformatted when the array item with the largest key has been removed.

Refs:
* https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#array-alignment-allow-for-new-lines
* https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#array-alignment-allow-non-exact-alignment
* https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#array-alignment-maximum-column
This commit is contained in:
jrfnl 2018-02-27 10:40:49 +01:00
parent 9ff286964b
commit 60071168e5
1 changed files with 11 additions and 0 deletions

View File

@ -75,6 +75,17 @@
as set in the "Requires at least" tag in the readme.txt file. --> as set in the "Requires at least" tag in the readme.txt file. -->
<config name="minimum_supported_wp_version" value="4.5"/> <config name="minimum_supported_wp_version" value="4.5"/>
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
<properties>
<!-- No need to adjust alignment of large arrays when the item with the largest key is removed. -->
<property name="exact" value="false"/>
<!-- Don't align multi-line items if ALL items in the array are multi-line. -->
<property name="alignMultilineItems" value="!=100"/>
<!-- Array assignment operator should always be on the same line as the array key. -->
<property name="ignoreNewlines" value="false"/>
</properties>
</rule>
<!-- <!--
############################################################################# #############################################################################