Skip to content

Commit 5cfa1f9

Browse files
feat: Add array_indentation to PER-CS2.0 ruleset (#7881)
1 parent 32866fc commit 5cfa1f9

File tree

7 files changed

+19
-3
lines changed

7 files changed

+19
-3
lines changed

doc/ruleSets/PER-CS2.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Rules
88
-----
99

1010
- `@PER-CS1.0 <./PER-CS1.0.rst>`_
11+
- `array_indentation <./../rules/whitespace/array_indentation.rst>`_
1112
- `cast_spaces <./../rules/cast_notation/cast_spaces.rst>`_
1213
- `concat_space <./../rules/operator/concat_space.rst>`_ with config:
1314

doc/ruleSets/PhpCsFixer.rst

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Rules
99

1010
- `@PER-CS <./PER-CS.rst>`_
1111
- `@Symfony <./Symfony.rst>`_
12-
- `array_indentation <./../rules/whitespace/array_indentation.rst>`_
1312
- `blank_line_before_statement <./../rules/whitespace/blank_line_before_statement.rst>`_ with config:
1413

1514
``['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch', 'throw', 'try', 'yield', 'yield_from']]``

doc/rules/whitespace/array_indentation.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ Example #1
2727
Rule sets
2828
---------
2929

30-
The rule is part of the following rule set:
30+
The rule is part of the following rule sets:
3131

32+
- `@PER <./../../ruleSets/PER.rst>`_
33+
- `@PER-CS <./../../ruleSets/PER-CS.rst>`_
34+
- `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
3235
- `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
36+
- `@Symfony <./../../ruleSets/Symfony.rst>`_
3337

3438
References
3539
----------

src/RuleSet/Sets/PERCS2x0Set.php

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function getRules(): array
3434
{
3535
return [
3636
'@PER-CS1.0' => true,
37+
'array_indentation' => true,
3738
'cast_spaces' => true,
3839
'concat_space' => ['spacing' => 'one'],
3940
'function_declaration' => [

src/RuleSet/Sets/PhpCsFixerSet.php

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public function getRules(): array
2626
return [
2727
'@PER-CS' => true,
2828
'@Symfony' => true,
29-
'array_indentation' => true,
3029
'blank_line_before_statement' => [
3130
'statements' => [
3231
'break',

tests/Fixtures/Integration/set/@PER-CS2.0.test-in.php

+6
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,10 @@ class Aaa implements
4343

4444
$fn = fn ($a) => $a;
4545

46+
$arrayNotMultiline = ['foo' => 'bar', 'foo2' => 'bar'];
47+
$arrayMultiline = [
48+
'foo' => 'bar',
49+
'foo2' => 'bar',
50+
];
51+
4652
?>

tests/Fixtures/Integration/set/@PER-CS2.0.test-out.php

+6
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,9 @@ class Aaa implements
5050
$c = true ? (int) '1' : 2;
5151

5252
$fn = fn($a) => $a;
53+
54+
$arrayNotMultiline = ['foo' => 'bar', 'foo2' => 'bar'];
55+
$arrayMultiline = [
56+
'foo' => 'bar',
57+
'foo2' => 'bar',
58+
];

0 commit comments

Comments
 (0)