Skip to content

Instantly share code, notes, and snippets.

@orottier
Created October 3, 2017 13:03
Show Gist options
  • Save orottier/88a39c112edf94a590c647ec3c03e784 to your computer and use it in GitHub Desktop.
Save orottier/88a39c112edf94a590c647ec3c03e784 to your computer and use it in GitHub Desktop.
PHP-CS-Fixer settings
<?php
// vim: set ft=php:
$finder = PhpCsFixer\Finder::create()
->exclude('bootstrap')
->exclude('node_modules')
->exclude('public')
->exclude('resources')
->exclude('storage')
->exclude('vendor')
->in(__DIR__);
return PhpCsFixer\Config::create()
->setUsingCache(true)
->setRules([
'@PSR2' => true,
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => false,
'cast_spaces' => ['space' => 'single'],
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'single'],
'function_typehint_space' => true,
'heredoc_to_nowdoc' => true,
'linebreak_after_opening_tag' => true,
'list_syntax' => ['syntax' => 'long'],
'lowercase_cast' => true,
'magic_constant_casing' => true,
'method_argument_space' => ['ensure_fully_multiline' => true],
'method_separation' => true,
'native_function_casing' => true,
'native_function_invocation' => false, // todo?
'new_with_braces' => true,
'no_blank_lines_after_class_opening' => true,
'no_empty_comment' => false,
'no_extra_consecutive_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']],
'no_leading_import_slash' => true,
'no_null_property_initialization' => true,
'no_short_echo_tag' => true,
'no_superfluous_elseif' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_final_method' => true,
'no_unreachable_default_argument_value' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'normalize_index_brace' => true,
'object_operator_without_whitespace' => true,
'ordered_class_elements' => false,
'ordered_imports' => false,
'php_unit_strict' => false,
'php_unit_test_class_requires_covers' => false,
'phpdoc_add_missing_param_annotation' => false,
'phpdoc_order' => false,
'phpdoc_types_order' => false,
'self_accessor' => true,
'semicolon_after_instruction' => true,
'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true,
'single_line_comment_style' => false,
'single_quote' => true,
'space_after_semicolon' => true,
'strict_comparison' => false,
'strict_param' => false,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true,
'whitespace_after_comma_in_array' => true,
])
->setFinder($finder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment