diff --git a/.circleci/config.yml b/.circleci/config.yml index f85604b..6e46a7b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -106,19 +106,29 @@ workflows: - documentation: matrix: parameters: - php-version: ["8.2"] + php-version: + - "8.3" - tests: matrix: parameters: - php-version: ["8.0", "8.1", "8.2"] + php-version: + - "8.1" + - "8.2" + - "8.3" - tests-with-future-mode: matrix: parameters: - php-version: ["8.0", "8.1", "8.2"] + php-version: + - "8.1" + - "8.2" + - "8.3" - tests-with-lowest-dependencies: matrix: parameters: - php-version: ["8.0", "8.1", "8.2"] + php-version: + - "8.1" + - "8.2" + - "8.3" - release-test - release: requires: 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/README.md b/README.md index 6d36aee..08d29ed 100644 --- a/README.md +++ b/README.md @@ -384,12 +384,12 @@ Prohibited functions MUST BE commented on as prohibited ### Available options - - `functions` (*optional*): The function names to be marked how prohibited - - default: `var_dump`, `dump`, `die` - - `comment` (*optional*): The prohibition message to put in the comment - default: `@TODO remove this line` + - `functions` (*optional*): The function names to be marked how prohibited + - default: `var_dump`, `dump`, `die` + ### Configuration examples ```php @@ -511,18 +511,18 @@ If the declaration of a method is too long, the arguments of this method MUST BE ### Available options - - `max-args` (*optional*): The maximum number of arguments allowed with splitting the arguments into several lines (use `false` to disable this feature) - - default: `3` - - - `max-length` (*optional*): The maximum number of characters allowed with splitting the arguments into several lines - - default: `120` - - `automatic-argument-merge` (*optional*): If both conditions are met (the line is not too long and there are not too many arguments), then the arguments are put back inline - default: `true` - `inline-attributes` (*optional*): In the case of a split, the declaration of the attributes of the arguments of the method will be on the same line as the arguments themselves - default: `false` + - `max-args` (*optional*): The maximum number of arguments allowed with splitting the arguments into several lines (use `false` to disable this feature) + - default: `3` + + - `max-length` (*optional*): The maximum number of characters allowed with splitting the arguments into several lines + - default: `120` + ### Configuration examples ```php 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..08fa01f 100755 --- a/bin/doc +++ b/bin/doc @@ -1,7 +1,10 @@ #!/usr/bin/env php 3.59.2" + }, + "minimum-stability": "dev", + "prefer-stable": true, "autoload": { "psr-4": { "PedroTroller\\CS\\Fixer\\": "src/PedroTroller/CS/Fixer" @@ -31,19 +36,17 @@ "dev-master": "3.x-dev" } }, - "minimum-stability": "dev", - "prefer-stable": true, "scripts": { - "tests": [ - "tests\\Runner::run", - "tests\\Orchestra::run", - "phpspec run -fpretty" + "lint": [ + "@php-cs-fixer" ], "php-cs-fixer": [ "php-cs-fixer fix --dry-run -vvv --diff" ], - "lint": [ - "@php-cs-fixer" + "tests": [ + "tests\\Runner::run", + "tests\\Orchestra::run", + "phpspec run -fpretty" ] } } 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,