-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: ability to align array arrows when in new line
To configure that we need to set (for example): ``` // configuration of double arrow alignment WebimpressCodingStandard.Arrays.DoubleArrow.maxPadding = 50 WebimpressCodingStandard.Arrays.DoubleArrow.ignoreNewLineArrayArrow = false // ignore indent or double arrow when at the beggining of the line WebimpressCodingStandard.WhiteSpace.ScopeIndent.ignoreNewLineArrayArrow = true // ignore spacing before double arrow (so we can have more than one space) WebimpressCodingStandard.WhiteSpace.OperatorAndKeywordSpacing.ignoreSpacingBeforeAssignments = true ``` Fixes #29
- Loading branch information
1 parent
1206d91
commit 645adfd
Showing
12 changed files
with
193 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
$array = [ | ||
'key' => 'value', | ||
'k' | ||
=> 'value', | ||
'k1' => 'value', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
$array = [ | ||
'key' => 'value', | ||
'k' | ||
=> 'value', | ||
'k1' => 'value', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="Webimpress Coding Standard"> | ||
<rule ref="../../src/WebimpressCodingStandard/ruleset.xml"/> | ||
|
||
<rule ref="WebimpressCodingStandard.Arrays.DoubleArrow"> | ||
<properties> | ||
<property name="maxPadding" value="30"/> | ||
<property name="ignoreNewLineArrayArrow" value="false"/> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="WebimpressCodingStandard.WhiteSpace.ScopeIndent"> | ||
<properties> | ||
<property name="ignoreNewLineArrayArrow" value="true"/> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="WebimpressCodingStandard.WhiteSpace.OperatorAndKeywordSpacing"> | ||
<properties> | ||
<property name="ignoreSpacingBeforeAssignments" value="true"/> | ||
</properties> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
// @phpcs:set WebimpressCodingStandard.Arrays.DoubleArrow maxPadding 30 | ||
// @phpcs:set WebimpressCodingStandard.Arrays.DoubleArrow ignoreNewLineArrayArrow false | ||
|
||
$m = [ | ||
'foo' => 'bar', | ||
'very-long-key' | ||
=> 'value', | ||
'foo-bar' => 'baz', | ||
]; | ||
|
||
$x = [ | ||
'1' => 1, | ||
'1_____' => 1, | ||
'1__' => 1, | ||
'2_____________________________________________________' => 2, | ||
'3' => 3, | ||
'3____' => 3, | ||
'3_' => 3, | ||
'3_______' => 3, | ||
'3____________________' => 3, | ||
'3___' | ||
=> 'value in new line does not break aligning group', | ||
'3__' => 3, | ||
'3_____' => 3, | ||
'value without index breaks aligning group', | ||
'4___' => 4, | ||
'4' => 4, | ||
|
||
'5_' => 'empty line breaks alignment group', | ||
// comment | ||
'6_____' => 'comment breaks alignment group', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
// @phpcs:set WebimpressCodingStandard.Arrays.DoubleArrow maxPadding 30 | ||
// @phpcs:set WebimpressCodingStandard.Arrays.DoubleArrow ignoreNewLineArrayArrow false | ||
|
||
$m = [ | ||
'foo' => 'bar', | ||
'very-long-key' | ||
=> 'value', | ||
'foo-bar' => 'baz', | ||
]; | ||
|
||
$x = [ | ||
'1' => 1, | ||
'1_____' => 1, | ||
'1__' => 1, | ||
'2_____________________________________________________' => 2, | ||
'3' => 3, | ||
'3____' => 3, | ||
'3_' => 3, | ||
'3_______' => 3, | ||
'3____________________' => 3, | ||
'3___' | ||
=> 'value in new line does not break aligning group', | ||
'3__' => 3, | ||
'3_____' => 3, | ||
'value without index breaks aligning group', | ||
'4___' => 4, | ||
'4' => 4, | ||
|
||
'5_' => 'empty line breaks alignment group', | ||
// comment | ||
'6_____' => 'comment breaks alignment group', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters