diff --git a/.gitignore b/.gitignore index b84b42b..d56b7ba 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .DS_Store docker .vscode +.php-cs-fixer.cache \ No newline at end of file diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..6f5c9a6 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,56 @@ +in(__DIR__) + ->exclude(['.github', '.vscode', 'docker', 'vendor']) + ->ignoreDotFiles(false); + +$rules = [ + '@PSR1' => true, + '@PSR2' => true, + '@PSR12' => true, + 'ordered_imports' => [ + 'sort_algorithm' => 'alpha', + 'imports_order' => [ + 'class', + 'function', + 'const' + ] + ], + 'single_line_empty_body' => true, + 'array_indentation' => true, + 'array_syntax' => ['syntax' => 'short'], + 'no_whitespace_in_blank_line' => true, + 'whitespace_after_comma_in_array' => [ + 'ensure_single_space' => true + ], + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'normalize_index_brace' => true, + 'trim_array_spaces' => true, + 'single_class_element_per_statement' => [ + 'elements' => [ + 'const', + 'property' + ] + ], + 'visibility_required' => [ + 'elements' => [ + 'property', + 'method', + 'const' + ] + ], + 'align_multiline_comment' => true +]; + +$config = new Config(); +$config->setFinder($finder); +$config->setRules($rules); +$config->setIndent(' '); +$config->setLineEnding("\n"); + +return $config; diff --git a/composer.json b/composer.json index f227d63..e6e5a67 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ }, "require-dev": { "phpstan/phpstan": "*", + "friendsofphp/php-cs-fixer": "^3.64", "bitexpert/phpstan-magento": "*" }, "autoload": {