Skip to content

Commit

Permalink
feat: Move single_line_empty_body to @PER-CS2.0 (#7282)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirone committed Sep 9, 2023
1 parent ca99f36 commit 3b18ca7
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion doc/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3008,7 +3008,7 @@ List of Available Rules

Empty body of class, interface, trait, enum or function must be abbreviated as ``{}`` and placed on the same line as the previous symbol, separated by a single space.

Part of rule set `@PhpCsFixer <./ruleSets/PhpCsFixer.rst>`_
Part of rule sets `@PER-CS2.0 <./ruleSets/PER-CS2.0.rst>`_ `@PhpCsFixer <./ruleSets/PhpCsFixer.rst>`_

`Source PhpCsFixer\\Fixer\\Basic\\SingleLineEmptyBodyFixer <./../src/Fixer/Basic/SingleLineEmptyBodyFixer.php>`_
- `single_line_throw <./rules/function_notation/single_line_throw.rst>`_
Expand Down
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,3 +8,4 @@ Rules
-----

- `@PER-CS1.0 <./PER-CS1.0.rst>`_
- `single_line_empty_body <./../rules/basic/single_line_empty_body.rst>`_
3 changes: 1 addition & 2 deletions doc/ruleSets/PhpCsFixer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Rule set as used by the PHP-CS-Fixer development team, highly opinionated.
Rules
-----

- `@PER <./PER.rst>`_
- `@PER-CS2.0 <./PER-CS2.0.rst>`_
- `@Symfony <./Symfony.rst>`_
- `array_indentation <./../rules/whitespace/array_indentation.rst>`_
- `blank_line_before_statement <./../rules/whitespace/blank_line_before_statement.rst>`_ with config:
Expand Down Expand Up @@ -58,7 +58,6 @@ Rules
- `return_assignment <./../rules/return_notation/return_assignment.rst>`_
- `self_static_accessor <./../rules/class_notation/self_static_accessor.rst>`_
- `single_line_comment_style <./../rules/comment/single_line_comment_style.rst>`_
- `single_line_empty_body <./../rules/basic/single_line_empty_body.rst>`_
- `whitespace_after_comma_in_array <./../rules/array_notation/whitespace_after_comma_in_array.rst>`_ with config:

``['ensure_single_space' => true]``
Expand Down
2 changes: 1 addition & 1 deletion doc/ruleSets/PhpCsFixerRisky.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Rule set as used by the PHP-CS-Fixer development team, highly opinionated. This
Rules
-----

- `@PER:risky <./PERRisky.rst>`_
- `@PER-CS2.0:risky <./PER-CS2.0Risky.rst>`_
- `@Symfony:risky <./SymfonyRisky.rst>`_
- `comment_to_phpdoc <./../rules/comment/comment_to_phpdoc.rst>`_
- `final_internal_class <./../rules/class_notation/final_internal_class.rst>`_
Expand Down
3 changes: 2 additions & 1 deletion doc/rules/basic/single_line_empty_body.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Example #1
Rule sets
---------

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

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

2 changes: 1 addition & 1 deletion src/RuleSet/Sets/PERCS2x0RiskySet.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* PER Coding Style v2.0.
*
* @see https://github.com/php-fig/per-coding-style/blob/1.0.0/spec.md
* @see https://github.com/php-fig/per-coding-style/blob/2.0.0/spec.md
*/
final class PERCS2x0RiskySet extends AbstractRuleSetDescription
{
Expand Down
3 changes: 2 additions & 1 deletion src/RuleSet/Sets/PERCS2x0Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* PER Coding Style v2.0.
*
* @see https://github.com/php-fig/per-coding-style/blob/1.0.0/spec.md
* @see https://github.com/php-fig/per-coding-style/blob/2.0.0/spec.md
*/
final class PERCS2x0Set extends AbstractRuleSetDescription
{
Expand All @@ -34,6 +34,7 @@ public function getRules(): array
{
return [
'@PER-CS1.0' => true,
'single_line_empty_body' => true,
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/RuleSet/Sets/PhpCsFixerRiskySet.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class PhpCsFixerRiskySet extends AbstractRuleSetDescription
public function getRules(): array
{
return [
'@PER:risky' => true,
'@PER-CS2.0:risky' => true,
'@Symfony:risky' => true,
'comment_to_phpdoc' => true,
'final_internal_class' => true,
Expand Down
3 changes: 1 addition & 2 deletions src/RuleSet/Sets/PhpCsFixerSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class PhpCsFixerSet extends AbstractRuleSetDescription
public function getRules(): array
{
return [
'@PER' => true,
'@PER-CS2.0' => true,
'@Symfony' => true,
'array_indentation' => true,
'blank_line_before_statement' => [
Expand Down Expand Up @@ -115,7 +115,6 @@ public function getRules(): array
'return_assignment' => true,
'self_static_accessor' => true,
'single_line_comment_style' => true,
'single_line_empty_body' => true,
'single_line_throw' => false,
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
];
Expand Down
4 changes: 1 addition & 3 deletions tests/Fixtures/Integration/set/@PER-CS2.0.test-out.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ final public static function bar()
class Aaa implements
Bbb,
Ccc,
Ddd
{
}
Ddd {}

$a = new Foo();
$b = (bool) 1;
Expand Down

0 comments on commit 3b18ca7

Please sign in to comment.