Просмотр исходного кода

bug #6122 NoMultilineWhitespaceAroundDoubleArrowFixer - must run before MethodArgumentSpaceFixer (kubawerlos)

This PR was merged into the master branch.

Discussion
----------

NoMultilineWhitespaceAroundDoubleArrowFixer - must run before MethodArgumentSpaceFixer

Commits
-------

d3c1c22fa NoMultilineWhitespaceAroundDoubleArrowFixer must run before MethodArgumentSpaceFixer
SpacePossum 3 лет назад
Родитель
Сommit
3cfb53d5f8

+ 2 - 2
src/Fixer/ArrayNotation/NoMultilineWhitespaceAroundDoubleArrowFixer.php

@@ -42,11 +42,11 @@ final class NoMultilineWhitespaceAroundDoubleArrowFixer extends AbstractFixer
     /**
      * {@inheritdoc}
      *
-     * Must run before BinaryOperatorSpacesFixer, TrailingCommaInMultilineFixer.
+     * Must run before BinaryOperatorSpacesFixer, MethodArgumentSpaceFixer, TrailingCommaInMultilineFixer.
      */
     public function getPriority(): int
     {
-        return 1;
+        return 31;
     }
 
     /**

+ 1 - 1
src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php

@@ -124,7 +124,7 @@ SAMPLE
      * {@inheritdoc}
      *
      * Must run before ArrayIndentationFixer.
-     * Must run after BracesFixer, CombineNestedDirnameFixer, FunctionDeclarationFixer, ImplodeCallFixer, MethodChainingIndentationFixer, NoUselessSprintfFixer, PowToExponentiationFixer.
+     * Must run after BracesFixer, CombineNestedDirnameFixer, FunctionDeclarationFixer, ImplodeCallFixer, MethodChainingIndentationFixer, NoMultilineWhitespaceAroundDoubleArrowFixer, NoUselessSprintfFixer, PowToExponentiationFixer.
      */
     public function getPriority(): int
     {

+ 1 - 0
tests/AutoReview/FixerFactoryTest.php

@@ -182,6 +182,7 @@ final class FixerFactoryTest extends TestCase
             [$fixers['no_extra_blank_lines'], $fixers['blank_line_before_statement']],
             [$fixers['no_leading_import_slash'], $fixers['ordered_imports']],
             [$fixers['no_multiline_whitespace_around_double_arrow'], $fixers['binary_operator_spaces']],
+            [$fixers['no_multiline_whitespace_around_double_arrow'], $fixers['method_argument_space']],
             [$fixers['no_multiline_whitespace_around_double_arrow'], $fixers['trailing_comma_in_multiline']],
             [$fixers['no_php4_constructor'], $fixers['ordered_class_elements']],
             [$fixers['no_short_bool_cast'], $fixers['cast_spaces']],

+ 22 - 0
tests/Fixtures/Integration/priority/no_multiline_whitespace_around_double_arrow,method_argument_space.test

@@ -0,0 +1,22 @@
+--TEST--
+Integration of fixers: no_multiline_whitespace_around_double_arrow,method_argument_space.
+--RULESET--
+{"no_multiline_whitespace_around_double_arrow": true, "method_argument_space": true}
+--EXPECT--
+<?php
+$value = [
+    1 => array_merge(
+        $array1,
+        $array2
+    )
+];
+
+--INPUT--
+<?php
+$value = [
+    1 =>
+        array_merge(
+            $array1,
+            $array2
+        )
+];