/
.php_cs
46 lines (42 loc) · 1.28 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
<?php
$path = getcwd();
$args = array_slice($_SERVER['argv'], array_search('fix', $_SERVER['argv'], true) + 1);
$args = array_filter($args, function($arg) { return strpos($arg, '-') !== 0;});
$args = array_filter($args, 'file_exists');
if (count($args)) {
$path = getcwd() . DIRECTORY_SEPARATOR . $args[0];
}
$finder = Symfony\CS\Finder\DefaultFinder::create();
if (is_dir($path)) {
$finder->name('*.php')->in($path);
} else {
$finder->path($path);
}
if (file_exists(__DIR__ . '/.gitignore')) {
foreach (file(__DIR__ . '/.gitignore') as $ignore) {
$ignore = trim($ignore);
if (is_dir(__DIR__ . '/' . trim($ignore, '/'))) {
$finder->exclude(trim($ignore, '/'));
} else {
$finder->notName(trim($ignore, '/'));
}
}
}
return Symfony\CS\Config\Config::create()
->setUsingCache(true)
->finder($finder)
->level(\Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers([
'phpdoc_order',
'align_double_arrow',
'align_equals',
'concat_with_spaces',
'ereg_to_preg',
'multiline_spaces_before_semicolon',
'newline_after_open_tag',
'ordered_use',
'header_comment',
'short_array_syntax',
// 'php4_constructor',
// 'phpdoc_var_to_type',
]);