-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.cs.php
98 lines (96 loc) · 3.92 KB
/
.cs.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
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
<?php
use PhpCsFixer\Config;
// Create a new Config instance
return (new Config())
// Disable the use of cache
->setUsingCache(false)
// Allow risky rules
->setRiskyAllowed(true)
// Set the rules for the PHP-CS-Fixer
->setRules(
[
// PSR-1 coding standard
'@PSR1' => true,
// PSR-2 coding standard
'@PSR2' => true,
// Symfony coding standard
'@Symfony' => true,
// PSR-12 coding standard
'@PSR12' => true,
// Enforce strict param types
'strict_param' => true,
// Enforce PSR autoloading
'psr_autoloading' => true,
// Align multiline comments
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'], // psr-5
// Do not convert PHPDoc to comments
'phpdoc_to_comment' => false,
// Do not remove superfluous PHPDoc tags
'no_superfluous_phpdoc_tags' => false,
// Enforce array indentation
'array_indentation' => true,
// Enforce short array syntax
'array_syntax' => ['syntax' => 'short'],
// No spaces should be present around cast
'cast_spaces' => ['space' => 'none'],
// One space should be present around concatenation
'concat_space' => ['spacing' => 'one'],
// Enforce compact nullable type declaration
'compact_nullable_type_declaration' => true,
// Enforce nullable type declaration
'nullable_type_declaration' => true,
// Enforce nullable type declaration for default null value
'nullable_type_declaration_for_default_null_value' => true,
// Normalize declare equal sign
'declare_equal_normalize' => ['space' => 'single'],
// Do not enforce strict types declaration
'declare_strict_types' => false,
// Post increment style
'increment_style' => ['style' => 'post'],
// Enforce short list syntax
'list_syntax' => ['syntax' => 'short'],
// Enforce long echo tag syntax
'echo_tag_syntax' => ['format' => 'long'],
// Add missing param annotation in PHPDoc
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
// Do not align PHPDoc
'phpdoc_align' => false,
// Do not remove empty return PHPDoc
'phpdoc_no_empty_return' => false,
// Order PHPDoc
'phpdoc_order' => true, // psr-5
// Do not remove useless inheritdoc PHPDoc
'phpdoc_no_useless_inheritdoc' => false,
// Do not change protected to private
'protected_to_private' => false,
// Do not enforce yoda style
'yoda_style' => false,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
// Order imports
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['class', 'const', 'function']
],
// Do not enforce single line throw
'single_line_throw' => false,
// Enforce fully qualified strict types
'fully_qualified_strict_types' => true,
// Do not import global namespace
'global_namespace_import' => false,
]
)
// Set the finder for the PHP-CS-Fixer
->setFinder(
PhpCsFixer\Finder::create()
// Add directories for the finder to look in
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->in(__DIR__ . '/config')
->in(__DIR__ . '/public')
// Only find PHP files
->name('*.php')
// Ignore dot files
->ignoreDotFiles(true)
// Ignore version control system files
->ignoreVCS(true)
);