|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +// Return a Code Sniffing configuration using |
| 6 | +// all sniffers needed for PER |
| 7 | +// and additionally: |
| 8 | +// - Remove leading slashes in use clauses. |
| 9 | +// - PHP single-line arrays should not have trailing comma. |
| 10 | +// - Single-line whitespace before closing semicolon are prohibited. |
| 11 | +// - Remove unused use statements in the PHP source code |
| 12 | +// - Ensure Concatenation to have at least one whitespace around |
| 13 | +// - Remove trailing whitespace at the end of blank lines. |
| 14 | +return (new \PhpCsFixer\Config()) |
| 15 | + ->setFinder( |
| 16 | + (new PhpCsFixer\Finder()) |
| 17 | + ->ignoreVCSIgnored(true) |
| 18 | + ->in(__DIR__) |
| 19 | + ) |
| 20 | + ->setRiskyAllowed(true) |
| 21 | + ->setRules([ |
| 22 | + '@DoctrineAnnotation' => true, |
| 23 | + '@PER' => true, |
| 24 | + 'array_syntax' => ['syntax' => 'short'], |
| 25 | + 'cast_spaces' => ['space' => 'none'], |
| 26 | + 'concat_space' => ['spacing' => 'one'], |
| 27 | + 'declare_equal_normalize' => ['space' => 'none'], |
| 28 | + 'declare_parentheses' => true, |
| 29 | + 'dir_constant' => true, |
| 30 | + 'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']], |
| 31 | + 'function_typehint_space' => true, |
| 32 | + 'modernize_strpos' => true, |
| 33 | + 'modernize_types_casting' => true, |
| 34 | + 'native_function_casing' => true, |
| 35 | + 'no_alias_functions' => true, |
| 36 | + 'no_blank_lines_after_phpdoc' => true, |
| 37 | + 'no_empty_phpdoc' => true, |
| 38 | + 'no_empty_statement' => true, |
| 39 | + 'no_extra_blank_lines' => true, |
| 40 | + 'no_leading_namespace_whitespace' => true, |
| 41 | + 'no_null_property_initialization' => true, |
| 42 | + 'no_short_bool_cast' => true, |
| 43 | + 'no_singleline_whitespace_before_semicolons' => true, |
| 44 | + 'no_superfluous_elseif' => true, |
| 45 | + 'no_trailing_comma_in_singleline' => true, |
| 46 | + 'no_unneeded_control_parentheses' => true, |
| 47 | + 'no_unused_imports' => true, |
| 48 | + 'no_useless_else' => true, |
| 49 | + 'no_useless_nullsafe_operator' => true, |
| 50 | + 'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'], |
| 51 | + 'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']], |
| 52 | + 'php_unit_mock_short_will_return' => true, |
| 53 | + 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], |
| 54 | + 'phpdoc_no_access' => true, |
| 55 | + 'phpdoc_no_empty_return' => true, |
| 56 | + 'phpdoc_no_package' => true, |
| 57 | + 'phpdoc_scalar' => true, |
| 58 | + 'phpdoc_trim' => true, |
| 59 | + 'phpdoc_types' => true, |
| 60 | + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], |
| 61 | + 'return_type_declaration' => ['space_before' => 'none'], |
| 62 | + 'single_quote' => true, |
| 63 | + 'single_space_around_construct' => true, |
| 64 | + 'single_line_comment_style' => ['comment_types' => ['hash']], |
| 65 | + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], |
| 66 | + 'whitespace_after_comma_in_array' => ['ensure_single_space' => true], |
| 67 | + 'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], |
| 68 | + ]); |
0 commit comments