diff --git a/README.md b/README.md index 80ef1e6..10910c5 100644 --- a/README.md +++ b/README.md @@ -14,30 +14,32 @@ $ composer require --dev m6web/php-cs-fixer-config ### Configuration -Create a configuration file `.php_cs` in the root of your project: +Create a configuration file `.php-cs-fixer.dist.php` in the root of your project: ```php in( + [ + __DIR__.'/src', + __DIR__.'/tests', + ] + ); -$config->getFinder() - ->in([ - __DIR__.'/src' - ])->exclude([ - 'Tests' - ]); +$config = new M6Web\CS\Config\BedrockStreaming(); +$config->setFinder($finder); return $config; ``` ### Git -Add `.php_cs.cache` (this is the cache file created by `php-cs-fixer`) to `.gitignore`: +Add `.php-cs-fixer.cache` (this is the cache file created by `php-cs-fixer`) to `.gitignore`: ``` vendor/ -.php_cs.cache +.php-cs-fixer.cache ``` ### Makefile @@ -81,7 +83,7 @@ $ make cs-ci ## Credits -Developed by [M6Web](http://tech.m6web.fr/), inspired by [refinery29/php-cs-fixer-config](https://github.com/refinery29/php-cs-fixer-config). +Developed by [Bedrock Streaming](https://tech.bedrockstreaming.com), inspired by [refinery29/php-cs-fixer-config](https://github.com/refinery29/php-cs-fixer-config). ## License diff --git a/composer.json b/composer.json index 5fa8982..3e66cda 100644 --- a/composer.json +++ b/composer.json @@ -6,13 +6,14 @@ "license": "MIT", "authors": [ { - "name": "M6Web", - "email": "opensource@m6web.fr", - "homepage": "http://tech.m6web.fr/" + "name": "Bedrock", + "email": "opensource@bedrockstreaming.com", + "homepage": "https://tech.bedrockstreaming.com/" } ], "require": { - "friendsofphp/php-cs-fixer": "^2.16.1" + "php": "^7.1.3 || ^8.0", + "friendsofphp/php-cs-fixer": "^3.0" }, "autoload": { "psr-4": { diff --git a/src/BedrockStreaming.php b/src/BedrockStreaming.php new file mode 100644 index 0000000..78a3b29 --- /dev/null +++ b/src/BedrockStreaming.php @@ -0,0 +1,46 @@ +setRiskyAllowed(true); + } + + public function getRules(): array + { + $rules = [ + '@Symfony' => true, + 'array_syntax' => [ + 'syntax' => 'short', + ], + 'braces' => [ + 'allow_single_line_closure' => true, + ], + 'global_namespace_import' => [ + 'import_classes' => false, + 'import_constants' => false, + 'import_functions' => false, + ], + 'heredoc_to_nowdoc' => false, + 'increment_style' => ['style' => 'post'], + 'no_unreachable_default_argument_value' => false, + 'ordered_imports' => ['sort_algorithm' => 'alpha'], + 'phpdoc_line_span' => [ + 'property' => 'single', + 'const' => 'single', + ], + 'phpdoc_summary' => false, + 'single_line_throw' => false, + 'yoda_style' => false, + ]; + + return $rules; + } +} diff --git a/src/Php71.php b/src/Php71.php index bde92bc..bfaa3ea 100644 --- a/src/Php71.php +++ b/src/Php71.php @@ -4,6 +4,9 @@ use PhpCsFixer\Config; +/** + * @deprecated Use M6Web\CS\Config\BedrockStreaming + */ final class Php71 extends Config { public function __construct() @@ -13,7 +16,7 @@ public function __construct() $this->setRiskyAllowed(true); } - public function getRules() + public function getRules(): array { $rules = [ '@Symfony' => true, diff --git a/src/Php72.php b/src/Php72.php index 61de10a..ada44c7 100644 --- a/src/Php72.php +++ b/src/Php72.php @@ -4,6 +4,9 @@ use PhpCsFixer\Config; +/** + * @deprecated Use M6Web\CS\Config\BedrockStreaming + */ final class Php72 extends Config { public function __construct() @@ -13,7 +16,7 @@ public function __construct() $this->setRiskyAllowed(true); } - public function getRules() + public function getRules(): array { $rules = [ '@Symfony' => true, diff --git a/src/Php73.php b/src/Php73.php index 4ee08b4..bb0ec48 100644 --- a/src/Php73.php +++ b/src/Php73.php @@ -4,6 +4,9 @@ use PhpCsFixer\Config; +/** + * @deprecated Use M6Web\CS\Config\BedrockStreaming + */ final class Php73 extends Config { public function __construct() @@ -13,7 +16,7 @@ public function __construct() $this->setRiskyAllowed(true); } - public function getRules() + public function getRules(): array { $rules = [ '@Symfony' => true, diff --git a/src/Php74.php b/src/Php74.php index a2f7735..748edd8 100644 --- a/src/Php74.php +++ b/src/Php74.php @@ -4,6 +4,9 @@ use PhpCsFixer\Config; +/** + * @deprecated Use M6Web\CS\Config\BedrockStreaming + */ final class Php74 extends Config { public function __construct() @@ -13,7 +16,7 @@ public function __construct() $this->setRiskyAllowed(true); } - public function getRules() + public function getRules(): array { $rules = [ '@Symfony' => true,