From fd0a1a20d33cd74065d696868ce4231f53b8a18b Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 20 Jul 2019 22:22:53 +0200 Subject: [PATCH] Core: Add upstream Generic.Arrays.DisallowShortArraySyntax sniff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recently a new section has been added to the handbook which forbids the use of short arrays. > Using long array syntax ( array( 1, 2, 3 ) ) for declaring arrays is generally more readable than short array syntax ( [ 1, 2, 3 ] ), particularly for those with vision difficulties. Additionally, it’s much more descriptive for beginners. > > Arrays must be declared using long array syntax. https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#declaring-arrays This PR add an existing upstream sniff which addresses this. Includes auto-fixer. Also see: https://make.wordpress.org/core/2019/07/12/php-coding-standards-changes/ Loosely related to 764 --- WordPress-Core/ruleset.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/WordPress-Core/ruleset.xml b/WordPress-Core/ruleset.xml index 24ceda47b6..714e52e02d 100644 --- a/WordPress-Core/ruleset.xml +++ b/WordPress-Core/ruleset.xml @@ -99,6 +99,16 @@ + + + + +