Skip to content

Commit 2821dd2

Browse files
committed
FinalInternalClassFixer - must run before ProtectedToPrivateFixer
1 parent 382e00e commit 2821dd2

File tree

5 files changed

+30
-2
lines changed

5 files changed

+30
-2
lines changed

src/Fixer/ClassNotation/FinalInternalClassFixer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ public function getDefinition()
7272
/**
7373
* {@inheritdoc}
7474
*
75+
* Must run before ProtectedToPrivateFixer.
7576
* Must run after PhpUnitInternalClassFixer.
7677
*/
7778
public function getPriority()
7879
{
79-
return 0;
80+
return 67;
8081
}
8182

8283
/**

src/Fixer/ClassNotation/ProtectedToPrivateFixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ protected function test()
5353
* {@inheritdoc}
5454
*
5555
* Must run before OrderedClassElementsFixer.
56+
* Must run after FinalInternalClassFixer.
5657
*/
5758
public function getPriority()
5859
{

src/Fixer/PhpUnit/PhpUnitInternalClassFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getDefinition()
4949
*/
5050
public function getPriority()
5151
{
52-
return 1;
52+
return 68;
5353
}
5454

5555
/**

tests/AutoReview/FixerFactoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public function provideFixersPriorityCases()
9494
[$fixers['escape_implicit_backslashes'], $fixers['heredoc_to_nowdoc']],
9595
[$fixers['escape_implicit_backslashes'], $fixers['single_quote']],
9696
[$fixers['explicit_string_variable'], $fixers['simple_to_complex_string_variable']],
97+
[$fixers['final_internal_class'], $fixers['protected_to_private']],
9798
[$fixers['fully_qualified_strict_types'], $fixers['no_superfluous_phpdoc_tags']],
9899
[$fixers['function_to_constant'], $fixers['native_function_casing']],
99100
[$fixers['function_to_constant'], $fixers['no_extra_blank_lines']],
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Integration of fixers: final_internal_class,protected_to_private.
3+
--RULESET--
4+
{"final_internal_class": true, "protected_to_private": true}
5+
--EXPECT--
6+
<?php
7+
/**
8+
* @internal
9+
*/
10+
final class Foo
11+
{
12+
private $bar;
13+
private function baz() {}
14+
}
15+
16+
--INPUT--
17+
<?php
18+
/**
19+
* @internal
20+
*/
21+
class Foo
22+
{
23+
protected $bar;
24+
protected function baz() {}
25+
}

0 commit comments

Comments
 (0)