-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php-cs-fixer.php
40 lines (35 loc) · 1.12 KB
/
.php-cs-fixer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
$dirs = [
'src', 'migrations', 'tests', 'setup', 'scripts'
];
$finder = PhpCsFixer\Finder::create();
foreach ($dirs as $dir) {
if (file_exists(__DIR__ . '/' . $dir)) {
$finder->in(__DIR__ . '/' . $dir);
}
}
/**
* @param \PhpCsFixer\Finder $finder
* @return \PhpCsFixer\ConfigInterface
*/
function extracted(\PhpCsFixer\Finder $finder): \PhpCsFixer\ConfigInterface
{
$config = new PhpCsFixer\Config();
return $config->setRules(
[
'@PSR12' => true,
'@PSR12:risky' => true,
'@PHP80Migration:risky' => true,
'strict_param' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => true,
'no_unused_imports' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include',
'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch',
'throw', 'try', 'yield', 'yield_from']
]
]
)->setFinder($finder);
}
return extracted($finder);