diff --git a/.php_cs b/.php-cs-fixer.dist.php similarity index 92% rename from .php_cs rename to .php-cs-fixer.dist.php index 3f2eac7..58f25a9 100644 --- a/.php_cs +++ b/.php-cs-fixer.dist.php @@ -4,10 +4,11 @@ ->files() ->in(__DIR__ . '/src') ->in(__DIR__ . '/test') + ->in(__DIR__ . '/example') ->name('*.php'); -return PhpCsFixer\Config::create() +return (new PhpCsFixer\Config) ->setUsingCache(true) ->setIndent("\t") ->setLineEnding("\n") @@ -103,7 +104,7 @@ ], 'blank_line_before_statement' => [ - 'statements' => [ 'continue', 'try', 'switch', 'die', 'exit', 'throw', 'return', 'yield', 'do' ], + 'statements' => [ 'continue', 'try', 'switch', 'exit', 'throw', 'return', 'yield', 'do' ], ], 'no_superfluous_phpdoc_tags' => [ @@ -113,8 +114,6 @@ 'no_useless_else' => true, - 'compact_nullable_typehint' => true, - 'combine_consecutive_issets' => true, 'escape_implicit_backslashes' => true, 'explicit_indirect_variable' => true, @@ -140,6 +139,7 @@ 'method_chaining_indentation' => true, 'method_argument_space' => [ + 'on_multiline' => 'ignore', 'keep_multiple_spaces_after_comma' => true, ], @@ -156,10 +156,14 @@ 'import_functions' => false, ], - 'trailing_comma_in_multiline_array' => true, + 'trailing_comma_in_multiline' => true, 'single_line_comment_style' => true, + + 'is_null' => true, + 'yoda_style' => [ + 'equal' => false, + 'identical' => false, + ], ] ) ->setFinder($finder); - - diff --git a/Makefile b/Makefile index 9fc0f70..9f31020 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,12 @@ fix: cbf phpstan: vendor/bin/phpstan --memory-limit=2G +.PHONY: php-cs-fixer +php-cs-fixer: + vendor/bin/php-cs-fixer fix --dry-run --diff + .PHONY: test -test: cs phpstan +test: cs php-cs-fixer phpstan vendor/bin/phpunit .PHONY: cs diff --git a/composer.json b/composer.json index d9880e1..ac0e796 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "phpunit/phpunit": "~8.5 | ~9.5", "squizlabs/php_codesniffer": "^3.5", "corpus/coding-standard": "~0.6.0", - "friendsofphp/php-cs-fixer": "^2.17", + "friendsofphp/php-cs-fixer": "^3.95", "phpstan/phpstan": "^2.2" }, "license": "MIT",