Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add array_indentation to PER-CS2.0 ruleset #7881

Merged
merged 3 commits into from Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/ruleSets/PER-CS2.0.rst
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
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
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
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
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
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
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',
];