Skip to content

Commit

Permalink
bug #5552 DX: test relation between function_declaration and method_a…
Browse files Browse the repository at this point in the history
…rgument_space (keradus)

This PR was merged into the 2.18 branch.

Discussion
----------

DX: test relation between function_declaration and method_argument_space

found here: #4085 (comment)

Commits
-------

ca36da5 DX: test relation between function_declaration and method_argument_space
  • Loading branch information
keradus committed Mar 17, 2021
2 parents d46a3ef + ca36da5 commit a1467ec
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Fixer/FunctionNotation/FunctionDeclarationFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ function foo ($bar, $baz)
);
}

/**
* {@inheritdoc}
*
* Must run before MethodArgumentSpaceFixer.
*/
public function getPriority()
{
return 31;
}

/**
* {@inheritdoc}
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/FunctionNotation/MethodArgumentSpaceFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function configure(array $configuration = null)
* {@inheritdoc}
*
* Must run before ArrayIndentationFixer.
* Must run after BracesFixer, CombineNestedDirnameFixer, ImplodeCallFixer, MethodChainingIndentationFixer, NoUselessSprintfFixer, PowToExponentiationFixer.
* Must run after BracesFixer, CombineNestedDirnameFixer, FunctionDeclarationFixer, ImplodeCallFixer, MethodChainingIndentationFixer, NoUselessSprintfFixer, PowToExponentiationFixer.
*/
public function getPriority()
{
Expand Down
1 change: 1 addition & 0 deletions tests/AutoReview/FixerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public function provideFixersPriorityCases()
[$fixers['final_internal_class'], $fixers['protected_to_private']],
[$fixers['final_internal_class'], $fixers['self_static_accessor']],
[$fixers['fully_qualified_strict_types'], $fixers['no_superfluous_phpdoc_tags']],
[$fixers['function_declaration'], $fixers['method_argument_space']],
[$fixers['function_to_constant'], $fixers['native_function_casing']],
[$fixers['function_to_constant'], $fixers['no_extra_blank_lines']],
[$fixers['function_to_constant'], $fixers['no_singleline_whitespace_before_semicolons']],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--TEST--
Integration of fixers: function_declaration,method_argument_space.
--RULESET--
{"function_declaration": true, "method_argument_space": true}
--REQUIREMENTS--
{"php": 80000}
--EXPECT--
<?php
function foo($bar, ) { echo $bar.$baz; };
$a = function () use ($b, $c, ): void { echo $b.$c; };

--INPUT--
<?php
function foo($bar,) { echo $bar.$baz; };
$a = function () use ($b, $c,): void { echo $b.$c; };

0 comments on commit a1467ec

Please sign in to comment.