|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the PHPFlasher package. |
| 5 | + * (c) Younes KHOUBZA <younes.khoubza@gmail.com> |
| 6 | + */ |
| 7 | + |
| 8 | +if (!file_exists(__DIR__.'/src')) { |
| 9 | + exit(0); |
| 10 | +} |
| 11 | + |
| 12 | +$header = <<<'EOF' |
| 13 | +This file is part of the PHPFlasher package. |
| 14 | +(c) Younes KHOUBZA <younes.khoubza@gmail.com> |
| 15 | +EOF; |
| 16 | + |
| 17 | +$rules = array( |
| 18 | + '@PSR12' => true, |
| 19 | + '@PSR12:risky' => true, |
| 20 | + '@Symfony' => true, |
| 21 | + '@Symfony:risky' => true, |
| 22 | + '@PhpCsFixer' => true, |
| 23 | + '@PhpCsFixer:risky' => true, |
| 24 | + 'header_comment' => array('header' => $header), |
| 25 | + 'array_syntax' => array('syntax' => 'long'), |
| 26 | + 'ordered_imports' => array( |
| 27 | + 'sort_algorithm' => 'alpha', |
| 28 | + 'imports_order' => array('const', 'class', 'function'), |
| 29 | + ), |
| 30 | + 'no_extra_blank_lines' => array( |
| 31 | + 'tokens' => array('case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw'), |
| 32 | + ), |
| 33 | + 'function_to_constant' => false, |
| 34 | + 'visibility_required' => array('elements' => array('property', 'method')), |
| 35 | + 'self_accessor' => false, |
| 36 | + 'single_trait_insert_per_statement' => true, |
| 37 | + 'linebreak_after_opening_tag' => true, |
| 38 | + 'no_php4_constructor' => true, |
| 39 | + 'no_unreachable_default_argument_value' => true, |
| 40 | + 'no_useless_else' => true, |
| 41 | + 'no_useless_return' => true, |
| 42 | + 'phpdoc_order' => true, |
| 43 | + 'strict_comparison' => true, |
| 44 | + 'strict_param' => true, |
| 45 | + 'phpdoc_line_span' => true, |
| 46 | + 'php_unit_internal_class' => false, |
| 47 | + 'php_unit_test_class_requires_covers' => false, |
| 48 | + 'multiline_whitespace_before_semicolons' => false, |
| 49 | + 'method_chaining_indentation' => false, |
| 50 | + 'phpdoc_no_empty_return' => false, |
| 51 | + 'phpdoc_types_order' => array('null_adjustment' => 'always_last'), |
| 52 | + 'php_unit_test_case_static_method_calls' => array('call_type' => 'this'), |
| 53 | + 'php_unit_strict' => false, |
| 54 | + 'native_constant_invocation' => array('scope' => 'namespaced'), |
| 55 | + 'phpdoc_return_self_reference' => true, |
| 56 | +); |
| 57 | + |
| 58 | +$finder = new PhpCsFixer\Finder(); |
| 59 | +$finder->in(__DIR__)->exclude(__DIR__.'/vendor'); |
| 60 | + |
| 61 | +$config = new PhpCsFixer\Config(); |
| 62 | + |
| 63 | +return $config->setFinder($finder) |
| 64 | + ->setUsingCache(false) |
| 65 | + ->setRiskyAllowed(true) |
| 66 | + ->setRules($rules); |
0 commit comments