Skip to content

Commit

Permalink
bug PHP-CS-Fixer#4994 FinalInternalClassFixer - must run before Prote…
Browse files Browse the repository at this point in the history
…ctedToPrivateFixer (kubawerlos)

This PR was merged into the 2.15 branch.

Discussion
----------

FinalInternalClassFixer - must run before ProtectedToPrivateFixer

Commits
-------

2821dd2 FinalInternalClassFixer - must run before ProtectedToPrivateFixer
  • Loading branch information
SpacePossum committed Jun 14, 2020
2 parents 6ce78a0 + 2821dd2 commit 83a4ac3
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Fixer/ClassNotation/FinalInternalClassFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ public function getDefinition()
/**
* {@inheritdoc}
*
* Must run before ProtectedToPrivateFixer.
* Must run after PhpUnitInternalClassFixer.
*/
public function getPriority()
{
return 0;
return 67;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Fixer/ClassNotation/ProtectedToPrivateFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ protected function test()
* {@inheritdoc}
*
* Must run before OrderedClassElementsFixer.
* Must run after FinalInternalClassFixer.
*/
public function getPriority()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function getDefinition()
*/
public function getPriority()
{
return 1;
return 68;
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/AutoReview/FixerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public function provideFixersPriorityCases()
[$fixers['escape_implicit_backslashes'], $fixers['heredoc_to_nowdoc']],
[$fixers['escape_implicit_backslashes'], $fixers['single_quote']],
[$fixers['explicit_string_variable'], $fixers['simple_to_complex_string_variable']],
[$fixers['final_internal_class'], $fixers['protected_to_private']],
[$fixers['fully_qualified_strict_types'], $fixers['no_superfluous_phpdoc_tags']],
[$fixers['function_to_constant'], $fixers['native_function_casing']],
[$fixers['function_to_constant'], $fixers['no_extra_blank_lines']],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
Integration of fixers: final_internal_class,protected_to_private.
--RULESET--
{"final_internal_class": true, "protected_to_private": true}
--EXPECT--
<?php
/**
* @internal
*/
final class Foo
{
private $bar;
private function baz() {}
}

--INPUT--
<?php
/**
* @internal
*/
class Foo
{
protected $bar;
protected function baz() {}
}

0 comments on commit 83a4ac3

Please sign in to comment.