-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path.php-cs-fixer.php
More file actions
64 lines (52 loc) · 1.84 KB
/
.php-cs-fixer.php
File metadata and controls
64 lines (52 loc) · 1.84 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
<?php
declare(strict_types=1);
$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->exclude('vendor')
->name('*.php')
->notName('*.blade.php');
$config = new PhpCsFixer\Config();
return $config
->setRules([
'@PSR12' => true,
'@PhpCsFixer' => true,
'@PHP81Migration' => true,
// Code organization
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
'global_namespace_import' => false,
// Code style preferences
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'trailing_comma_in_multiline' => [
'elements' => ['arrays', 'arguments', 'parameters']
],
// Documentation
'phpdoc_align' => ['align' => 'left'],
'phpdoc_summary' => false,
'phpdoc_separation' => true,
'phpdoc_order' => true,
// Strict types
'declare_strict_types' => true,
'strict_param' => true,
'strict_comparison' => true,
// Modern PHP features
'modernize_types_casting' => true,
'nullable_type_declaration_for_default_null_value' => true,
// Security and best practices
'no_php4_constructor' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
'remove_inheritdoc' => false
],
// Exception to allow longer lines for type annotations
'line_ending' => true,
// Disable some overly strict rules
'php_unit_test_class_requires_covers' => false,
'php_unit_internal_class' => false,
'final_internal_class' => false,
'comment_to_phpdoc' => false,
])
->setFinder($finder)
->setRiskyAllowed(true);