Skip to content

Commit a858b51

Browse files
committed
Add custom rules/script for php-cs-fixer
1 parent 77668db commit a858b51

2 files changed

Lines changed: 37 additions & 6 deletions

File tree

.php_cs.dist

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
<?php
22
$finder = PhpCsFixer\Finder::create()
33
->in(__DIR__ . '/src')
4-
->in(__DIR__ . '/tests')
5-
;
4+
->in(__DIR__ . '/tests');
65

76
return PhpCsFixer\Config::create()
87
->setRules([
98
'@PSR2' => true,
10-
'array_syntax' => ['syntax' => 'short'],
9+
'@PhpCsFixer' => true,
10+
'array_syntax' => [
11+
'syntax' => 'short',
12+
],
13+
'blank_line_after_opening_tag' => false,
14+
'blank_line_before_statement' => [
15+
'statements' => [],
16+
],
17+
'concat_space' => [
18+
'spacing' => 'one',
19+
],
20+
'increment_style' => [
21+
'style' => 'post',
22+
],
23+
'no_multiline_whitespace_before_semicolons' => true,
24+
'no_superfluous_phpdoc_tags' => true,
25+
'ordered_class_elements' => false,
26+
'php_unit_internal_class' => false,
27+
'php_unit_test_class_requires_covers' => false,
28+
'phpdoc_align' => [
29+
'align' => 'left',
30+
],
31+
'phpdoc_separation' => false,
32+
'phpdoc_to_comment' => false,
33+
'phpdoc_var_without_name' => false,
34+
'single_blank_line_before_namespace' => false,
35+
'yoda_style' => false,
1136
])
12-
->setFinder($finder)
13-
;
37+
->setFinder($finder);

composer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
"friendsofphp/php-cs-fixer": "^2.14"
3838
},
3939
"scripts": {
40-
"tests": "phpunit tests --stop-on-failure && phpcs -n --standard=phpcs.xml src"
40+
"test": "phpunit tests --stop-on-failure",
41+
"cs": "phpcs -n --standard=phpcs.xml src",
42+
"fix": "php-cs-fixer fix",
43+
"tests": [
44+
"@test",
45+
"@cs",
46+
"@fix"
47+
]
4148
}
4249
}

0 commit comments

Comments
 (0)