From c27927c03d30df7f234042cafd90260c116a5d35 Mon Sep 17 00:00:00 2001 From: Greg Sherwood Date: Fri, 15 Nov 2019 08:10:38 +1100 Subject: [PATCH] Changelog for #2694 + moved some tests around (ref #2695) --- package.xml | 2 ++ .../Tests/Arrays/ArrayIndentUnitTest.inc | 16 +++++++-------- .../Arrays/ArrayIndentUnitTest.inc.fixed | 20 +++++++++---------- .../Tests/Arrays/ArrayIndentUnitTest.php | 9 +++------ 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/package.xml b/package.xml index 6a567593de..f930de2adc 100644 --- a/package.xml +++ b/package.xml @@ -54,6 +54,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> - Fixed bug #2678 : PSR12.Classes.AnonClassDeclaration incorrectly enforcing that closing brace be on a line by itself - Fixed bug #2685 : File::getMethodParameters() setting typeHintEndToken for vars with no type hint -- Thanks to Juliette Reinders Folmer for the patch + - Fixed bug #2694 : AbstractArraySniff produces invalid indices when using ternary operator + -- Thanks to MichaƂ Bundyra for the patch diff --git a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc index 66cafc1e56..d29e57f759 100644 --- a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc +++ b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc @@ -49,14 +49,6 @@ return [ ] ]; -// phpcs:set Generic.Arrays.ArrayIndent indent 2 - -$var = [ -1 => 'one', - 2 => 'two', - /* three */ 3 => 'three', - ]; - $array = [ 'foo' => 'foo', 'bar' => $baz ? @@ -66,3 +58,11 @@ $array = [ ['one'] ?? ['two'], ]; + +// phpcs:set Generic.Arrays.ArrayIndent indent 2 + +$var = [ +1 => 'one', + 2 => 'two', + /* three */ 3 => 'three', + ]; diff --git a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc.fixed b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc.fixed index f98137b6d2..40a3705e66 100644 --- a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc.fixed +++ b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc.fixed @@ -50,6 +50,16 @@ return [ ] ]; +$array = [ + 'foo' => 'foo', + 'bar' => $baz ? + ['abc'] : + ['def'], + 'hey' => $baz ?? + ['one'] ?? + ['two'], +]; + // phpcs:set Generic.Arrays.ArrayIndent indent 2 $var = [ @@ -57,13 +67,3 @@ $var = [ 2 => 'two', /* three */ 3 => 'three', ]; - -$array = [ - 'foo' => 'foo', - 'bar' => $baz ? - ['abc'] : - ['def'], - 'hey' => $baz ?? - ['one'] ?? - ['two'], -]; diff --git a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.php b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.php index 8c14d95c50..730d044906 100644 --- a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.php +++ b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.php @@ -33,13 +33,10 @@ public function getErrorList() 31 => 1, 33 => 1, 41 => 1, - 55 => 1, - 56 => 1, - 57 => 1, - 58 => 1, - 61 => 1, - 62 => 1, 65 => 1, + 66 => 1, + 67 => 1, + 68 => 1, ]; }//end getErrorList()