| 1 |
<?php |
| 2 |
$header = <<<'EOF' |
| 3 |
This file is part of PHP CS Fixer. |
| 4 |
(c) Fabien Potencier <fabien@symfony.com> |
| 5 |
Dariusz Rumiński <dariusz.ruminski@gmail.com> |
| 6 |
This source file is subject to the MIT license that is bundled |
| 7 |
with this source code in the file LICENSE. |
| 8 |
EOF; |
| 9 |
$config = PhpCsFixer\Config::create() |
| 10 |
->setIndent(" ") |
| 11 |
->setLineEnding("\n") |
| 12 |
->setUsingCache(false) |
| 13 |
->setRiskyAllowed(true) |
| 14 |
->setRules([ |
| 15 |
'@PHP56Migration' => false, |
| 16 |
'@PHPUnit60Migration:risky' => false, |
| 17 |
'@Symfony' => false, |
| 18 |
'@Symfony:risky' => false, |
| 19 |
'align_multiline_comment' => true, |
| 20 |
'array_syntax' => ['syntax' => 'long'], |
| 21 |
'blank_line_before_statement' => true, |
| 22 |
'combine_consecutive_issets' => true, |
| 23 |
'combine_consecutive_unsets' => true, |
| 24 |
'compact_nullable_typehint' => true, |
| 25 |
'concat_space' => ['spacing' => 'one'], |
| 26 |
'escape_implicit_backslashes' => true, |
| 27 |
'explicit_indirect_variable' => true, |
| 28 |
'explicit_string_variable' => true, |
| 29 |
'final_internal_class' => true, |
| 30 |
'heredoc_to_nowdoc' => true, |
| 31 |
'list_syntax' => ['syntax' => 'long'], |
| 32 |
'method_chaining_indentation' => true, |
| 33 |
'method_argument_space' => ['ensure_fully_multiline' => true, 'keep_multiple_spaces_after_comma' => true], |
| 34 |
'multiline_comment_opening_closing' => true, |
| 35 |
'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']], |
| 36 |
'no_null_property_initialization' => true, |
| 37 |
'no_short_echo_tag' => true, |
| 38 |
'no_superfluous_elseif' => true, |
| 39 |
'no_unneeded_curly_braces' => true, |
| 40 |
'no_unneeded_final_method' => true, |
| 41 |
'no_unreachable_default_argument_value' => true, |
| 42 |
'no_useless_else' => true, |
| 43 |
'no_useless_return' => true, |
| 44 |
'ordered_class_elements' => true, |
| 45 |
'ordered_imports' => true, |
| 46 |
'php_unit_strict' => true, |
| 47 |
'php_unit_test_annotation' => true, |
| 48 |
'php_unit_test_class_requires_covers' => false, |
| 49 |
'phpdoc_add_missing_param_annotation' => true, |
| 50 |
'phpdoc_order' => true, |
| 51 |
'phpdoc_types_order' => true, |
| 52 |
'semicolon_after_instruction' => true, |
| 53 |
'single_line_comment_style' => true, |
| 54 |
'single_quote' => false, |
| 55 |
'strict_comparison' => false, |
| 56 |
'strict_param' => false, |
| 57 |
'yoda_style' => true, |
| 58 |
]) |
| 59 |
->setFinder( |
| 60 |
PhpCsFixer\Finder::create() |
| 61 |
->exclude('tests/Fixtures') |
| 62 |
->in(__DIR__) |
| 63 |
) |
| 64 |
; |
| 65 |
// special handling of fabbot.io service if it's using too old PHP CS Fixer version |
| 66 |
try { |
| 67 |
PhpCsFixer\FixerFactory::create() |
| 68 |
->registerBuiltInFixers() |
| 69 |
->registerCustomFixers($config->getCustomFixers()) |
| 70 |
->useRuleSet(new PhpCsFixer\RuleSet($config->getRules())); |
| 71 |
} catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) { |
| 72 |
$config->setRules([]); |
| 73 |
} catch (UnexpectedValueException $e) { |
| 74 |
$config->setRules([]); |
| 75 |
} catch (InvalidArgumentException $e) { |
| 76 |
$config->setRules([]); |
| 77 |
} |
| 78 |
return $config; |