-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php-cs-fixer.php
66 lines (56 loc) · 2.11 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
56
57
58
59
60
61
62
63
64
65
66
<?php
//
// see https://mlocati.github.io/php-cs-fixer-configurator/#version:3.8 for MORE OPTIONS
//
declare(strict_types=1);
$header = <<<'EOF'
This file is part of Homebase 2 PHP Framework - https://github.com/homebase/hb-core
EOF;
$finder = PhpCsFixer\Finder::create()
->ignoreDotFiles(true)
->ignoreVCSIgnored(true)
->exclude('tests')
# ->in(__DIR__.'/src')
;
// ->append([
// __DIR__.'/dev-tools/doc.php',
// __DIR__.'/php-cs-fixer', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message
// ])
$config = new PhpCsFixer\Config();
$config
->setRiskyAllowed(true)
->setRules(array_merge($config->getRules(), [
'@PHPUnit75Migration:risky' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'@PHP81Migration' => true,
'@PHP80Migration:risky' => true,
'@PSR12' => true,
'array_push' => true,
// 'array_syntax' => ['short'],
'heredoc_indentation' => false,
'header_comment' => ['header' => $header],
'modernize_strpos' => true, // needs PHP 8+ or polyfill
'use_arrow_functions' => true,
'heredoc_indentation' => true,
'list_syntax' => ['syntax' => 'short'],
'visibility_required' => ['elements' => ['property']],
'phpdoc_summary' => false, // no useless dots
'explicit_string_variable' => false, // "$a xxx $b" is OK !!
'echo_tag_syntax' => ['format' => 'short'], // "<?= ... " - good and short
'strict_comparison' => false, // can break old code
'yoda_style' => false, // ugly sometimes
#'increment_style' => false, // c++ not ++c
'increment_style' => ['style' => 'post'], // c++ not ++c
'single_line_comment_style' => false, // psalm does not support "//" comments
'phpdoc_to_comment' => false, // psalm does not like this
]))->setFinder($finder)
;
/*
* Deprecated !!
'braces' => [
'position_after_functions_and_oop_constructs' => 'same', // "function () { " same line
'allow_single_line_closure' => true,
],
*/
return $config;