Skip to content

Commit 2c15ddf

Browse files
authored
add phpcs (#27)
1 parent 124f455 commit 2c15ddf

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

.github/workflows/style-fix.yml

Whitespace-only changes.

.php-cs-fixer.dist.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->in([
5+
__DIR__.'/src',
6+
__DIR__.'/tests',
7+
])
8+
->name('*.php')
9+
->notName('*.blade.php')
10+
->ignoreDotFiles(true)
11+
->ignoreVCS(true);
12+
13+
return (new PhpCsFixer\Config())
14+
->setRules([
15+
'@PSR12' => true,
16+
'array_syntax' => ['syntax' => 'short'],
17+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
18+
'no_unused_imports' => true,
19+
'not_operator_with_successor_space' => true,
20+
'trailing_comma_in_multiline' => true,
21+
'phpdoc_scalar' => true,
22+
'unary_operator_spaces' => true,
23+
'binary_operator_spaces' => true,
24+
'blank_line_before_statement' => [
25+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
26+
],
27+
'phpdoc_single_line_var_spacing' => true,
28+
'phpdoc_var_without_name' => true,
29+
'class_attributes_separation' => [
30+
'elements' => [
31+
'method' => 'one',
32+
],
33+
],
34+
'method_argument_space' => [
35+
'on_multiline' => 'ensure_fully_multiline',
36+
'keep_multiple_spaces_after_comma' => true,
37+
],
38+
'single_trait_insert_per_statement' => true,
39+
'php_unit_method_casing' => ['case' => 'snake_case'],
40+
])
41+
->setFinder($finder);

.styleci.yml

-1
This file was deleted.

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
},
2929
"require-dev": {
3030
"orchestra/testbench": "^7.0",
31-
"phpunit/phpunit": "^9.5"
31+
"phpunit/phpunit": "^9.5",
32+
"friendsofphp/php-cs-fixer": "^3.13"
3233
},
3334
"autoload": {
3435
"psr-4": {

0 commit comments

Comments
 (0)