-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php_cs-fixer.php
110 lines (109 loc) · 6.6 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
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
107
108
109
110
<?php
/*
* This document has been generated with
* https://mlocati.github.io/php-cs-fixer-configurator/#version:3.0.0|configurator
* you can change this configuration by importing this file.
*/
$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
'@PHP70Migration' => true,
'@PHP71Migration' => true,
'@PSR2' => true,
'@Symfony' => true,
'@PHP73Migration' => true,
// Each line of multi-line DocComments must have an asterisk [PSR-5] and must be aligned with the first one.
'align_multiline_comment' => true,
// Each element of an array must be indented exactly once.
'array_indentation' => true,
// PHP arrays should be declared using the configured syntax.
'array_syntax' => ['syntax' => 'short'],
// Binary operators should be surrounded by space as configured.
'binary_operator_spaces' => ['default' => 'align_single_space_minimal'],
// An empty line feed must precede any configured statement.
'blank_line_before_statement' => true,
// The body of each structure MUST be enclosed by braces. Braces should be properly placed. Body of braces should be properly indented.
'braces' => ['position_after_anonymous_constructs' => 'next', 'position_after_control_structures' => 'next', 'position_after_functions_and_oop_constructs' => 'next'],
// Using `isset($var) &&` multiple times should be done in one call.
'combine_consecutive_issets' => true,
// Calling `unset` on multiple items should be done in one call.
'combine_consecutive_unsets' => true,
// Replace multiple nested calls of `dirname` by only one call with second `$level` parameter. Requires PHP >= 7.0.
'combine_nested_dirname' => true,
// Remove extra spaces in a nullable typehint.
'compact_nullable_typehint' => true,
// Equal sign in declare statement should be surrounded by spaces or not following configuration.
'declare_equal_normalize' => ['space' => 'single'],
// Replaces `dirname(__FILE__)` expression with equivalent `__DIR__` constant.
'dir_constant' => true,
// Replace deprecated `ereg` regular expression functions with `preg`.
'ereg_to_preg' => true,
// Add curly braces to indirect variables to make them clear to understand. Requires PHP >= 7.0.
'explicit_indirect_variable' => true,
// Converts implicit variables into explicit ones in double-quoted strings or heredoc syntax.
'explicit_string_variable' => true,
// Replace core functions calls returning constants with the constants.
'function_to_constant' => true,
// Convert `heredoc` to `nowdoc` where possible.
'heredoc_to_nowdoc' => true,
// Ensure there is no code on the same line as the PHP open tag.
'linebreak_after_opening_tag' => true,
// Method chaining MUST be properly indented. Method chaining with different levels of indentation is not supported.
'method_chaining_indentation' => true,
// Replaces `intval`, `floatval`, `doubleval`, `strval` and `boolval` function calls with according type casting operator.
'modernize_types_casting' => true,
// DocBlocks must start with two asterisks, multiline comments must start with a single asterisk, after the opening slash. Both must end with a single asterisk before the closing slash.
'multiline_comment_opening_closing' => true,
// Forbid multi-line whitespace before the closing semicolon or move the semicolon to the new line for chained calls.
'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'],
// Add leading `\` before function invocation to speed up resolving.
'native_function_invocation' => true,
// Master functions shall be used instead of aliases.
'no_alias_functions' => true,
// Replace control structure alternative syntax to use braces.
'no_alternative_syntax' => true,
// Properties MUST not be explicitly initialized with `null` except when they have a type declaration (PHP 7.4).
'no_null_property_initialization' => true,
// Variables must be set `null` instead of using `(unset)` casting.
'no_unset_cast' => true,
// There should not be an empty `return` statement at the end of a function.
'no_useless_return' => true,
// Logical NOT operators (`!`) should have leading and trailing whitespaces.
'not_operator_with_space' => true,
// Adds or removes `?` before type declarations for parameters with a default `null` value.
'nullable_type_declaration_for_default_null_value' => true,
// Orders the elements of classes/interfaces/traits.
'ordered_class_elements' => true,
// Ordering `use` statements.
'ordered_imports' => true,
// All PHPUnit test classes should be marked as internal.
'php_unit_internal_class' => true,
// Enforce camel (or snake) case for PHPUnit test methods, following configuration.
'php_unit_method_casing' => true,
// Adds a default `@coversNothing` annotation to PHPUnit test classes that have no `@covers*` annotation.
'php_unit_test_class_requires_covers' => true,
// PHPDoc should contain `@param` for all params.
'phpdoc_add_missing_param_annotation' => true,
// `@return void` and `@return null` annotations should be omitted from PHPDoc.
'phpdoc_no_empty_return' => true,
// Annotations in PHPDoc should be ordered so that `@param` annotations come first, then `@throws` annotations, then `@return` annotations.
'phpdoc_order' => true,
// `@var` and `@type` annotations must have type and name in the correct order.
'phpdoc_var_annotation_correct_order' => true,
// Local, dynamic and directly referenced variables should not be assigned and directly returned by a function or method.
'return_assignment' => true,
// Converts explicit variables in double-quoted strings and heredoc syntax from simple to complex format (`${` to `{$`).
'simple_to_complex_string_variable' => true,
// Simplify `if` control structures that return the boolean result of their condition.
'simplified_if_return' => true,
// A return statement wishing to return `void` should not return `null`.
'simplified_null_return' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
)
;