diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index fdb4fa6..c1ab6a4 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -4,14 +4,16 @@ use PedroTroller\CS\Fixer\Fixers; use PedroTroller\CS\Fixer\RuleSetFactory; +use PhpCsFixer\Config; +use PhpCsFixer\Finder; -return (new PhpCsFixer\Config()) +return (new Config()) ->setRiskyAllowed(true) ->setRules( RuleSetFactory::create() ->per(2, true) ->phpCsFixer(true) - ->php(8.0, true) + ->php(8.1, true) ->pedrotroller(true) ->enable('align_multiline_comment') ->enable('array_indentation') @@ -34,7 +36,7 @@ ->setUsingCache(false) ->registerCustomFixers(new Fixers()) ->setFinder( - PhpCsFixer\Finder::create() + Finder::create() ->in(__DIR__) ->append([__FILE__, __DIR__.'/bin/doc']) ) diff --git a/bin/Utils.php b/bin/Utils.php index 913820e..b21abba 100644 --- a/bin/Utils.php +++ b/bin/Utils.php @@ -4,7 +4,7 @@ final class Utils { - public static function arrayToString(array $array = null) + public static function arrayToString(?array $array = null) { if (null === $array) { return; diff --git a/bin/doc b/bin/doc index 09dd9df..3c8887a 100755 --- a/bin/doc +++ b/bin/doc @@ -1,7 +1,10 @@ #!/usr/bin/env php =3.59.3" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.28", "phpspec/phpspec": "^7.0", "sebastian/diff": "^4.0", "twig/twig": "^3.3", diff --git a/src/PedroTroller/CS/Fixer/AbstractFixer.php b/src/PedroTroller/CS/Fixer/AbstractFixer.php index 549e599..d2d8b74 100644 --- a/src/PedroTroller/CS/Fixer/AbstractFixer.php +++ b/src/PedroTroller/CS/Fixer/AbstractFixer.php @@ -45,7 +45,7 @@ public function getDefinition(): FixerDefinitionInterface return new FixerDefinition( $this->getDocumentation(), array_map( - fn (array $configutation = null) => new CodeSample($this->getSampleCode(), $configutation), + fn (?array $configutation = null) => new CodeSample($this->getSampleCode(), $configutation), $this->getSampleConfigurations() ) ); diff --git a/src/PedroTroller/CS/Fixer/RuleSetFactory.php b/src/PedroTroller/CS/Fixer/RuleSetFactory.php index 6e75b76..dc2d0d9 100644 --- a/src/PedroTroller/CS/Fixer/RuleSetFactory.php +++ b/src/PedroTroller/CS/Fixer/RuleSetFactory.php @@ -55,7 +55,7 @@ public static function create(array $rules = []): self ); } - public function per(int|float $version = null, bool $risky = false): self + public function per(null|float|int $version = null, bool $risky = false): self { $candidates = null !== $version ? ['@PER-CS'.number_format($version, 1, '.', '')] @@ -198,7 +198,7 @@ public function pedrotroller(bool $risky = false): self )); } - public function enable(string $name, array $config = null): self + public function enable(string $name, ?array $config = null): self { return self::create(array_merge( $this->rules, diff --git a/tests/TokensAnalyzerIntegration/MethodArguments.php b/tests/TokensAnalyzerIntegration/MethodArguments.php index c307cbe..872a4a4 100644 --- a/tests/TokensAnalyzerIntegration/MethodArguments.php +++ b/tests/TokensAnalyzerIntegration/MethodArguments.php @@ -67,7 +67,7 @@ public function assertions(TokensAnalyzer $analyzer, Tokens $tokens): void $arguments, [ ($theFunction + 5) => [ - 'type' => 'Domain\\Model\\User', + 'type' => 'Domain\Model\User', 'name' => '$user', 'nullable' => false, 'asDefault' => false,