-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy path.php-cs-fixer.dist.php
More file actions
106 lines (93 loc) · 2.98 KB
/
.php-cs-fixer.dist.php
File metadata and controls
106 lines (93 loc) · 2.98 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
declare(strict_types=1);
$finder = PhpCsFixer\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/bin',
__DIR__ . '/config',
])
->exclude([
'cache',
'vendor',
'var',
])
->notName([
'*.css',
'*.js',
'phpat.php', // PHPat requires specific class name
'reference.php', // Auto-generated by Symfony, will be overwritten
]);
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
// Presets
'@PSR12' => true,
'@PSR12:risky' => true,
'@PHP83Migration' => true,
'@PHP80Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
// Strict types
'declare_strict_types' => true,
'strict_param' => true,
'strict_comparison' => true,
// Arrays
'array_syntax' => ['syntax' => 'short'],
'trailing_comma_in_multiline' => [
'elements' => ['arrays', 'arguments', 'parameters'],
],
// Classes
'final_internal_class' => true,
'protected_to_private' => true,
'self_static_accessor' => true,
// Imports
'ordered_imports' => [
'imports_order' => ['class', 'function', 'const'],
'sort_algorithm' => 'alpha',
],
'no_unused_imports' => true,
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
// PHPDoc
'phpdoc_order' => true,
'phpdoc_align' => ['align' => 'vertical'],
'phpdoc_add_missing_param_annotation' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
'allow_unused_params' => false,
],
'phpdoc_to_comment' => false,
// Return types
'void_return' => true,
'return_type_declaration' => ['space_before' => 'none'],
// Modern PHP
'use_arrow_functions' => true,
'static_lambda' => true,
'ternary_to_null_coalescing' => true,
'get_class_to_class_keyword' => true,
// Operators
'binary_operator_spaces' => ['default' => 'single_space'],
'concat_space' => ['spacing' => 'one'],
'logical_operators' => true,
// Native functions/constants optimization
'native_function_invocation' => [
'include' => ['@compiler_optimized'],
'scope' => 'namespaced',
'strict' => true,
],
'native_constant_invocation' => true,
// Modernization
'modernize_strpos' => true,
'modernize_types_casting' => true,
'is_null' => true,
'no_alias_functions' => true,
'pow_to_exponentiation' => true,
'random_api_migration' => true,
'simplified_null_return' => true,
])
->setFinder($finder)
->setCacheFile(__DIR__ . '/var/.php-cs-fixer.cache');