Skip to content

Commit

Permalink
feat: Add array_indentation to PER-CS2.0 ruleset (#7881)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Mar 14, 2024
1 parent 32866fc commit 5cfa1f9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/ruleSets/PER-CS2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Rules
-----

- `@PER-CS1.0 <./PER-CS1.0.rst>`_
- `array_indentation <./../rules/whitespace/array_indentation.rst>`_
- `cast_spaces <./../rules/cast_notation/cast_spaces.rst>`_
- `concat_space <./../rules/operator/concat_space.rst>`_ with config:

Expand Down
1 change: 0 additions & 1 deletion doc/ruleSets/PhpCsFixer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Rules

- `@PER-CS <./PER-CS.rst>`_
- `@Symfony <./Symfony.rst>`_
- `array_indentation <./../rules/whitespace/array_indentation.rst>`_
- `blank_line_before_statement <./../rules/whitespace/blank_line_before_statement.rst>`_ with config:

``['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch', 'throw', 'try', 'yield', 'yield_from']]``
Expand Down
6 changes: 5 additions & 1 deletion doc/rules/whitespace/array_indentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ Example #1
Rule sets
---------

The rule is part of the following rule set:
The rule is part of the following rule sets:

- `@PER <./../../ruleSets/PER.rst>`_
- `@PER-CS <./../../ruleSets/PER-CS.rst>`_
- `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
- `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
- `@Symfony <./../../ruleSets/Symfony.rst>`_

References
----------
Expand Down
1 change: 1 addition & 0 deletions src/RuleSet/Sets/PERCS2x0Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function getRules(): array
{
return [
'@PER-CS1.0' => true,
'array_indentation' => true,
'cast_spaces' => true,
'concat_space' => ['spacing' => 'one'],
'function_declaration' => [
Expand Down
1 change: 0 additions & 1 deletion src/RuleSet/Sets/PhpCsFixerSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public function getRules(): array
return [
'@PER-CS' => true,
'@Symfony' => true,
'array_indentation' => true,
'blank_line_before_statement' => [
'statements' => [
'break',
Expand Down
6 changes: 6 additions & 0 deletions tests/Fixtures/Integration/set/@PER-CS2.0.test-in.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ class Aaa implements

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

$arrayNotMultiline = ['foo' => 'bar', 'foo2' => 'bar'];
$arrayMultiline = [
'foo' => 'bar',
'foo2' => 'bar',
];

?>
6 changes: 6 additions & 0 deletions tests/Fixtures/Integration/set/@PER-CS2.0.test-out.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ class Aaa implements
$c = true ? (int) '1' : 2;

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

$arrayNotMultiline = ['foo' => 'bar', 'foo2' => 'bar'];
$arrayMultiline = [
'foo' => 'bar',
'foo2' => 'bar',
];

0 comments on commit 5cfa1f9

Please sign in to comment.