-
Notifications
You must be signed in to change notification settings - Fork 2
/
.php_cs
88 lines (79 loc) · 2.61 KB
/
.php_cs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/*
* (c) 2016 by Cyberhouse GmbH
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the MIT License (MIT)
*
* For the full copyright and license information see
* <https://opensource.org/licenses/MIT>
*/
use Cyberhouse\Phpstyle\Fixer\LowerHeaderCommentFixer;
use Cyberhouse\Phpstyle\Fixer\NamespaceFirstFixer;
use Cyberhouse\Phpstyle\Fixer\SingleEmptyLineFixer;
use PhpCsFixer\Config;
use Symfony\Component\Finder\Finder;
if (PHP_SAPI !== 'cli') {
die('Nope');
}
$header = 'This file is (c) ' . date('Y') . ' by Cyberhouse GmbH
It is free software; you can redistribute it and/or
modify it under the terms of the GPLv3 license
For the full copyright and license information see
<https://www.gnu.org/licenses/gpl-3.0.html>';
LowerHeaderCommentFixer::setHeader($header);
$finder = Finder::create()
->name('/\.php$/')
->exclude('vendor')
->exclude('bin')
->in(__DIR__);
return Config::create()
->setUsingCache(true)
->registerCustomFixers([
new LowerHeaderCommentFixer(),
new NamespaceFirstFixer(),
new SingleEmptyLineFixer(),
])
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'Cyberhouse/lower_header_comment' => true,
'Cyberhouse/namespace_first' => true,
'Cyberhouse/single_empty_line' => true,
'encoding' => true,
'cast_spaces' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
'binary_operator_spaces' => [
'align_double_arrow' => true,
'align_equals' => false,
],
'braces' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => true,
'dir_constant' => true,
'ereg_to_preg' => true,
'hash_to_slash_comment' => true,
'include' => true,
'line_ending' => true,
'lowercase_cast' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'new_with_braces' => true,
'no_leading_import_slash' => true,
'no_php4_constructor' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'psr0' => false,
'short_scalar_cast' => true,
'single_quote' => true,
'standardize_not_equals' => true,
'strict_comparison' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_order' => true,
])
->setFinder($finder);