33namespace MessagePack ;
44
55use PhpCsFixer \Config ;
6+ use PhpCsFixer \Fixer \ConfigurableFixerInterface ;
67use PhpCsFixer \Fixer \ConstantNotation \NativeConstantInvocationFixer ;
7- use PhpCsFixer \Fixer \FixerInterface ;
88use PhpCsFixer \Fixer \FunctionNotation \NativeFunctionInvocationFixer ;
9+ use PhpCsFixer \FixerConfiguration \FixerConfigurationResolver ;
10+ use PhpCsFixer \FixerDefinition \FixerDefinition ;
11+ use PhpCsFixer \FixerDefinition \FixerDefinitionInterface ;
912use PhpCsFixer \Tokenizer \Tokens ;
1013
11- final class FilterableFixer implements FixerInterface
14+ final class FilterableFixer implements ConfigurableFixerInterface
1215{
13- private $ fixer ;
14- private $ pathRegex ;
16+ private FixerInterface $ fixer ;
17+ private string $ pathRegex ;
1518
1619 public function __construct (FixerInterface $ fixer , string $ pathRegex )
1720 {
1821 $ this ->fixer = $ fixer ;
1922 $ this ->pathRegex = $ pathRegex ;
2023 }
2124
25+ public function configure (array $ configuration ): void
26+ {
27+ if ($ this ->fixer instanceof ConfigurableFixerInterface) {
28+ $ this ->fixer ->configure ($ configuration );
29+ }
30+ }
31+
32+ public function getConfigurationDefinition (): FixerConfigurationResolver
33+ {
34+ if ($ this ->fixer instanceof ConfigurableFixerInterface) {
35+ return $ this ->fixer ->getConfigurationDefinition ();
36+ }
37+
38+ return new FixerConfigurationResolver ([]);
39+ }
40+
2241 public function isCandidate (Tokens $ tokens ) : bool
2342 {
2443 return $ this ->fixer ->isCandidate ($ tokens );
@@ -52,7 +71,12 @@ public function supports(\SplFileInfo $file) : bool
5271
5372 return $ this ->fixer ->supports ($ file );
5473 }
55- };
74+
75+ public function getDefinition () : FixerDefinitionInterface
76+ {
77+ return $ this ->fixer ->getDefinition ();
78+ }
79+ }
5680
5781$ header = <<<EOF
5882This file is part of the rybakit/msgpack.php package.
@@ -63,7 +87,7 @@ public function supports(\SplFileInfo $file) : bool
6387file that was distributed with this source code.
6488EOF ;
6589
66- return Config:: create ( )
90+ return ( new Config () )
6791 ->setUsingCache (false )
6892 ->setRiskyAllowed (true )
6993 ->registerCustomFixers ([
@@ -75,7 +99,7 @@ public function supports(\SplFileInfo $file) : bool
7599 '@Symfony:risky ' => true ,
76100 'array_syntax ' => ['syntax ' => 'short ' ],
77101 'binary_operator_spaces ' => ['operators ' => ['= ' => null , '=> ' => null ]],
78- 'is_null ' => false , // https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4015
102+ 'is_null ' => false ,
79103 'native_constant_invocation ' => false ,
80104 'native_function_invocation ' => false ,
81105 'FilterableFixer/native_constant_invocation ' => true ,
0 commit comments