Browse Source

feat: Add `single_line_empty_body` to `@PhpCsFixer` (#7266)

Greg Korba 1 year ago
parent
commit
fe9788b55e

+ 2 - 0
doc/list.rst

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

+ 1 - 0
doc/ruleSets/PhpCsFixer.rst

@@ -58,6 +58,7 @@ 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]``

+ 8 - 0
doc/rules/basic/single_line_empty_body.rst

@@ -22,3 +22,11 @@ Example #1
    -{
    -}
    +) {}
+
+Rule sets
+---------
+
+The rule is part of the following rule set:
+
+- `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
+

+ 1 - 3
src/Cache/NullCacheManager.php

@@ -26,7 +26,5 @@ final class NullCacheManager implements CacheManagerInterface
         return true;
     }
 
-    public function setFile(string $file, string $fileContent): void
-    {
-    }
+    public function setFile(string $file, string $fileContent): void {}
 }

+ 1 - 3
src/ConfigurationException/InvalidForEnvFixerConfigurationException.php

@@ -19,6 +19,4 @@ namespace PhpCsFixer\ConfigurationException;
  *
  * @internal
  */
-final class InvalidForEnvFixerConfigurationException extends InvalidFixerConfigurationException
-{
-}
+final class InvalidForEnvFixerConfigurationException extends InvalidFixerConfigurationException {}

+ 1 - 3
src/ConfigurationException/RequiredFixerConfigurationException.php

@@ -19,6 +19,4 @@ namespace PhpCsFixer\ConfigurationException;
  *
  * @internal
  */
-final class RequiredFixerConfigurationException extends InvalidFixerConfigurationException
-{
-}
+final class RequiredFixerConfigurationException extends InvalidFixerConfigurationException {}

+ 2 - 6
src/Console/Output/Progress/NullOutput.php

@@ -21,11 +21,7 @@ use PhpCsFixer\FixerFileProcessedEvent;
  */
 final class NullOutput implements ProgressOutputInterface
 {
-    public function printLegend(): void
-    {
-    }
+    public function printLegend(): void {}
 
-    public function onFixerFileProcessed(FixerFileProcessedEvent $event): void
-    {
-    }
+    public function onFixerFileProcessed(FixerFileProcessedEvent $event): void {}
 }

+ 1 - 3
src/Fixer/PhpUnit/PhpUnitTargetVersion.php

@@ -39,9 +39,7 @@ final class PhpUnitTargetVersion
     public const VERSION_8_4 = '8.4';
     public const VERSION_NEWEST = 'newest';
 
-    private function __construct()
-    {
-    }
+    private function __construct() {}
 
     public static function fulfills(string $candidate, string $target): bool
     {

+ 1 - 3
src/FixerConfiguration/InvalidOptionsForEnvException.php

@@ -21,6 +21,4 @@ use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
  *
  * @internal
  */
-final class InvalidOptionsForEnvException extends InvalidOptionsException
-{
-}
+final class InvalidOptionsForEnvException extends InvalidOptionsException {}

+ 1 - 3
src/Linter/LintingException.php

@@ -21,6 +21,4 @@ namespace PhpCsFixer\Linter;
  *
  * @TODO 4.0 make class "final"
  */
-class LintingException extends \RuntimeException
-{
-}
+class LintingException extends \RuntimeException {}

Some files were not shown because too many files changed in this diff