|
| 1 | +<?php |
| 2 | +/* |
| 3 | + * This document has been generated with |
| 4 | + * https://mlocati.github.io/php-cs-fixer-configurator/#version:3.0.0|configurator |
| 5 | + * you can change this configuration by importing this file. |
| 6 | + */ |
| 7 | +$config = new PhpCsFixer\Config(); |
| 8 | + |
| 9 | +return $config |
| 10 | + ->setRiskyAllowed(true) |
| 11 | + ->setRules([ |
| 12 | + '@DoctrineAnnotation' => true, |
| 13 | + '@PHP70Migration' => true, |
| 14 | + '@PHP71Migration' => true, |
| 15 | + '@PSR2' => true, |
| 16 | + '@Symfony' => true, |
| 17 | + '@PHP73Migration' => true, |
| 18 | + // Each line of multi-line DocComments must have an asterisk [PSR-5] and must be aligned with the first one. |
| 19 | + 'align_multiline_comment' => true, |
| 20 | + // Each element of an array must be indented exactly once. |
| 21 | + 'array_indentation' => true, |
| 22 | + // PHP arrays should be declared using the configured syntax. |
| 23 | + 'array_syntax' => ['syntax' => 'short'], |
| 24 | + // Binary operators should be surrounded by space as configured. |
| 25 | + 'binary_operator_spaces' => ['default' => 'align_single_space_minimal'], |
| 26 | + // An empty line feed must precede any configured statement. |
| 27 | + 'blank_line_before_statement' => true, |
| 28 | + // The body of each structure MUST be enclosed by braces. Braces should be properly placed. Body of braces should be properly indented. |
| 29 | + 'braces' => ['position_after_anonymous_constructs' => 'next', 'position_after_control_structures' => 'next', 'position_after_functions_and_oop_constructs' => 'next'], |
| 30 | + // Using `isset($var) &&` multiple times should be done in one call. |
| 31 | + 'combine_consecutive_issets' => true, |
| 32 | + // Calling `unset` on multiple items should be done in one call. |
| 33 | + 'combine_consecutive_unsets' => true, |
| 34 | + // Replace multiple nested calls of `dirname` by only one call with second `$level` parameter. Requires PHP >= 7.0. |
| 35 | + 'combine_nested_dirname' => true, |
| 36 | + // Remove extra spaces in a nullable typehint. |
| 37 | + 'compact_nullable_typehint' => true, |
| 38 | + // Equal sign in declare statement should be surrounded by spaces or not following configuration. |
| 39 | + 'declare_equal_normalize' => ['space' => 'single'], |
| 40 | + // Replaces `dirname(__FILE__)` expression with equivalent `__DIR__` constant. |
| 41 | + 'dir_constant' => true, |
| 42 | + // Replace deprecated `ereg` regular expression functions with `preg`. |
| 43 | + 'ereg_to_preg' => true, |
| 44 | + // Add curly braces to indirect variables to make them clear to understand. Requires PHP >= 7.0. |
| 45 | + 'explicit_indirect_variable' => true, |
| 46 | + // Converts implicit variables into explicit ones in double-quoted strings or heredoc syntax. |
| 47 | + 'explicit_string_variable' => true, |
| 48 | + // Replace core functions calls returning constants with the constants. |
| 49 | + 'function_to_constant' => true, |
| 50 | + // Convert `heredoc` to `nowdoc` where possible. |
| 51 | + 'heredoc_to_nowdoc' => true, |
| 52 | + // Ensure there is no code on the same line as the PHP open tag. |
| 53 | + 'linebreak_after_opening_tag' => true, |
| 54 | + // Method chaining MUST be properly indented. Method chaining with different levels of indentation is not supported. |
| 55 | + 'method_chaining_indentation' => true, |
| 56 | + // Replaces `intval`, `floatval`, `doubleval`, `strval` and `boolval` function calls with according type casting operator. |
| 57 | + 'modernize_types_casting' => true, |
| 58 | + // 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. |
| 59 | + 'multiline_comment_opening_closing' => true, |
| 60 | + // Forbid multi-line whitespace before the closing semicolon or move the semicolon to the new line for chained calls. |
| 61 | + 'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'], |
| 62 | + // Add leading `\` before function invocation to speed up resolving. |
| 63 | + 'native_function_invocation' => true, |
| 64 | + // Master functions shall be used instead of aliases. |
| 65 | + 'no_alias_functions' => true, |
| 66 | + // Replace control structure alternative syntax to use braces. |
| 67 | + 'no_alternative_syntax' => true, |
| 68 | + // Properties MUST not be explicitly initialized with `null` except when they have a type declaration (PHP 7.4). |
| 69 | + 'no_null_property_initialization' => true, |
| 70 | + // Variables must be set `null` instead of using `(unset)` casting. |
| 71 | + 'no_unset_cast' => true, |
| 72 | + // There should not be an empty `return` statement at the end of a function. |
| 73 | + 'no_useless_return' => true, |
| 74 | + // Logical NOT operators (`!`) should have leading and trailing whitespaces. |
| 75 | + 'not_operator_with_space' => true, |
| 76 | + // Adds or removes `?` before type declarations for parameters with a default `null` value. |
| 77 | + 'nullable_type_declaration_for_default_null_value' => true, |
| 78 | + // Orders the elements of classes/interfaces/traits. |
| 79 | + 'ordered_class_elements' => true, |
| 80 | + // Ordering `use` statements. |
| 81 | + 'ordered_imports' => true, |
| 82 | + // All PHPUnit test classes should be marked as internal. |
| 83 | + 'php_unit_internal_class' => true, |
| 84 | + // Enforce camel (or snake) case for PHPUnit test methods, following configuration. |
| 85 | + 'php_unit_method_casing' => true, |
| 86 | + // Adds a default `@coversNothing` annotation to PHPUnit test classes that have no `@covers*` annotation. |
| 87 | + 'php_unit_test_class_requires_covers' => true, |
| 88 | + // PHPDoc should contain `@param` for all params. |
| 89 | + 'phpdoc_add_missing_param_annotation' => true, |
| 90 | + // `@return void` and `@return null` annotations should be omitted from PHPDoc. |
| 91 | + 'phpdoc_no_empty_return' => true, |
| 92 | + // Annotations in PHPDoc should be ordered so that `@param` annotations come first, then `@throws` annotations, then `@return` annotations. |
| 93 | + 'phpdoc_order' => true, |
| 94 | + // `@var` and `@type` annotations must have type and name in the correct order. |
| 95 | + 'phpdoc_var_annotation_correct_order' => true, |
| 96 | + // Local, dynamic and directly referenced variables should not be assigned and directly returned by a function or method. |
| 97 | + 'return_assignment' => true, |
| 98 | + // Converts explicit variables in double-quoted strings and heredoc syntax from simple to complex format (`${` to `{$`). |
| 99 | + 'simple_to_complex_string_variable' => true, |
| 100 | + // Simplify `if` control structures that return the boolean result of their condition. |
| 101 | + 'simplified_if_return' => true, |
| 102 | + // A return statement wishing to return `void` should not return `null`. |
| 103 | + 'simplified_null_return' => true, |
| 104 | + ]) |
| 105 | + ->setFinder( |
| 106 | + PhpCsFixer\Finder::create() |
| 107 | + ->exclude('vendor') |
| 108 | + ->in(__DIR__) |
| 109 | + ) |
| 110 | +; |
0 commit comments