Skip to content

Commit 373e1bd

Browse files
committed
Updating php-cs-fixer to be in line with CMS
1 parent 08f2f70 commit 373e1bd

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

.php-cs-fixer.dist.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,29 @@
4949
->setRules(
5050
[
5151
// Basic ruleset is PSR 12
52-
'@PSR12' => true,
52+
'@PSR12' => true,
5353
// Short array syntax
54-
'array_syntax' => ['syntax' => 'short'],
55-
// Lists should not have a trailing comma like list($foo, $bar,) = ...
56-
'no_trailing_comma_in_list_call' => true,
54+
'array_syntax' => ['syntax' => 'short'],
55+
// List of values separated by a comma is contained on a single line should not have a trailing comma like [$foo, $bar,] = ...
56+
'no_trailing_comma_in_singleline' => true,
5757
// Arrays on multiline should have a trailing comma
58-
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
58+
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
5959
// Align elements in multiline array and variable declarations on new lines below each other
60-
'binary_operator_spaces' => ['operators' => ['=>' => 'align_single_space_minimal', '=' => 'align']],
60+
'binary_operator_spaces' => ['operators' => ['=>' => 'align_single_space_minimal', '=' => 'align', '??=' => 'align']],
6161
// The "No break" comment in switch statements
62-
'no_break_comment' => ['comment_text' => 'No break'],
62+
'no_break_comment' => ['comment_text' => 'No break'],
63+
// Remove unused imports
64+
'no_unused_imports' => true,
65+
// Classes from the global namespace should not be imported
66+
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
67+
// Alpha order imports
68+
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
69+
// There should not be useless else cases
70+
'no_useless_else' => true,
71+
// Native function invocation
72+
'native_function_invocation' => ['include' => ['@compiler_optimized']],
73+
// Adds null to type declarations when parameter have a default null value
74+
'nullable_type_declaration_for_default_null_value' => true,
6375
]
6476
)
6577
->setFinder($finder);

0 commit comments

Comments
 (0)