Skip to content

Commit

Permalink
chore: FullyQualifiedStrictTypesFixer must run before `OrderedInter…
Browse files Browse the repository at this point in the history
…facesFixer` (#7762)
  • Loading branch information
kubawerlos committed Jan 19, 2024
1 parent cff91c0 commit 9167592
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Fixer/ClassNotation/OrderedInterfacesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ public function getDefinition(): FixerDefinitionInterface
);
}

/**
* {@inheritdoc}
*
* Must run after FullyQualifiedStrictTypesFixer.
*/
public function getPriority(): int
{
return 0;
}

public function isCandidate(Tokens $tokens): bool
{
return $tokens->isTokenKindFound(T_IMPLEMENTS)
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/Import/FullyQualifiedStrictTypesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function foo(): \Other\FunctionReturnType
/**
* {@inheritdoc}
*
* Must run before NoSuperfluousPhpdocTagsFixer, OrderedImportsFixer, StatementIndentationFixer.
* Must run before NoSuperfluousPhpdocTagsFixer, OrderedImportsFixer, OrderedInterfacesFixer, StatementIndentationFixer.
* Must run after PhpdocToReturnTypeFixer.
*/
public function getPriority(): int
Expand Down
1 change: 1 addition & 0 deletions tests/AutoReview/FixerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ private static function getFixersPriorityGraph(): array
'fully_qualified_strict_types' => [
'no_superfluous_phpdoc_tags',
'ordered_imports',
'ordered_interfaces',
'statement_indentation',
],
'function_declaration' => [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
Integration of fixers: fully_qualified_strict_types,ordered_interfaces.
--RULESET--
{"fully_qualified_strict_types": true, "ordered_interfaces": true}
--EXPECT--
<?php

namespace Foo;

use Bar\Interface1;
use Bar\Interface2;

class Test implements Interface1, Interface2 {}

--INPUT--
<?php

namespace Foo;

use Bar\Interface1;
use Bar\Interface2;

class Test implements \Bar\Interface2, Interface1 {}

0 comments on commit 9167592

Please sign in to comment.