forked from LycheeOrg/Lychee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php-cs-fixer.php
55 lines (52 loc) · 1.67 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
$finder = array_reduce(
[
__DIR__ . '/app/',
__DIR__ . '/database/',
__DIR__ . '/lang/',
__DIR__ . '/resources/',
__DIR__ . '/routes/',
__DIR__ . '/tests/',
__DIR__ . '/scripts/',
],
function (PhpCsFixer\Finder $finder, $dir) {
return $finder->in($dir);
},
PhpCsFixer\Finder::create()->ignoreUnreadableDirs()
)->notName('*.blade.php');
$rules = [
'@Symfony' => true,
'nullable_type_declaration_for_default_null_value' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'backtick_to_shell_exec' => true,
'increment_style' => ['style' => 'post'],
'indentation_type' => true,
'multiline_comment_opening_closing' => true,
'no_php4_constructor' => true,
'phpdoc_no_empty_return' => false,
'single_blank_line_at_eof' => false,
'yoda_style' => false,
'concat_space' => ['spacing' => 'one'],
'no_superfluous_phpdoc_tags' => false,
'phpdoc_to_comment' => false, // required until https://github.com/phpstan/phpstan/issues/7486 got fixed
'blank_line_between_import_groups' => false, // not PSR-12 compatible, but preserves old behaviour
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => null, // for PSR-12 compatability, this need to be `['class', 'function', 'const']`, but no grouping preserves old behaviour
],
'no_unneeded_control_parentheses' => [
'statements' => ['break', 'clone', 'continue', 'echo_print', 'switch_case', 'yield'],
],
'operator_linebreak' => [
'only_booleans' => true,
'position' => 'end'
],
];
$config = new PhpCsFixer\Config();
$config->setRiskyAllowed(true);
$config->setRules($rules);
$config->setIndent("\t");
$config->setLineEnding("\n");
$config->setFinder($finder);
return $config;