Skip to content

Commit

Permalink
PLUG-130: Configure automatic code formatting (#31)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexandru Lighezan <[email protected]>
  • Loading branch information
artyom-jaksov-tl and lighe authored Oct 17, 2024
1 parent 1ed15d9 commit 14c6870
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.DS_Store
docker
.vscode
.php-cs-fixer.cache
56 changes: 56 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->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;
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"require-dev": {
"phpstan/phpstan": "*",
"friendsofphp/php-cs-fixer": "^3.64",
"bitexpert/phpstan-magento": "*"
},
"autoload": {
Expand Down

0 comments on commit 14c6870

Please sign in to comment.