Browse Source

docs: Add intersection type to types_spaces rule description (#6479)

LevFlavien 2 years ago
parent
commit
979454b8ec

+ 2 - 2
doc/list.rst

@@ -2954,12 +2954,12 @@ List of Available Rules
    `Source PhpCsFixer\\Fixer\\ArrayNotation\\TrimArraySpacesFixer <./../src/Fixer/ArrayNotation/TrimArraySpacesFixer.php>`_
 -  `types_spaces <./rules/whitespace/types_spaces.rst>`_
 
-   A single space or none should be around union type operator.
+   A single space or none should be around union type and intersection type operators.
 
    Configuration options:
 
    - | ``space``
-     | spacing to apply around union type operator.
+     | spacing to apply around union type and intersection type operators.
      | Allowed values: ``'none'``, ``'single'``
      | Default value: ``'none'``
    - | ``space_multiple_catch``

+ 1 - 1
doc/rules/index.rst

@@ -860,4 +860,4 @@ Whitespace
   Each statement must be indented.
 - `types_spaces <./whitespace/types_spaces.rst>`_
 
-  A single space or none should be around union type operator.
+  A single space or none should be around union type and intersection type operators.

+ 3 - 2
doc/rules/whitespace/types_spaces.rst

@@ -2,7 +2,8 @@
 Rule ``types_spaces``
 =====================
 
-A single space or none should be around union type operator.
+A single space or none should be around union type and intersection type
+operators.
 
 Configuration
 -------------
@@ -10,7 +11,7 @@ Configuration
 ``space``
 ~~~~~~~~~
 
-spacing to apply around union type operator.
+spacing to apply around union type and intersection type operators.
 
 Allowed values: ``'none'``, ``'single'``
 

+ 2 - 2
src/Fixer/Whitespace/TypesSpacesFixer.php

@@ -46,7 +46,7 @@ final class TypesSpacesFixer extends AbstractFixer implements ConfigurableFixerI
     public function getDefinition(): FixerDefinitionInterface
     {
         return new FixerDefinition(
-            'A single space or none should be around union type operator.',
+            'A single space or none should be around union type and intersection type operators.',
             [
                 new CodeSample(
                     "<?php\ntry\n{\n    new Foo();\n} catch (ErrorA | ErrorB \$e) {\necho'error';}\n"
@@ -77,7 +77,7 @@ final class TypesSpacesFixer extends AbstractFixer implements ConfigurableFixerI
     protected function createConfigurationDefinition(): FixerConfigurationResolverInterface
     {
         return new FixerConfigurationResolver([
-            (new FixerOptionBuilder('space', 'spacing to apply around union type operator.'))
+            (new FixerOptionBuilder('space', 'spacing to apply around union type and intersection type operators.'))
                 ->setAllowedValues(['none', 'single'])
                 ->setDefault('none')
                 ->getOption(),