Skip to content

Instantly share code, notes, and snippets.

@ziadoz ziadoz/.php_cs.dist
Last active Aug 8, 2019

Embed
What would you like to do?
PHP CS Fixer Configuration
<?php declare(strict_types=1);
$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->path('.php_cs.dist')
->in(__DIR__);
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'backtick_to_shell_exec' => true,
'binary_operator_spaces' => ['default' => 'align_single_space_minimal'],
'blank_line_after_opening_tag' => false,
'blank_line_before_statement' => false,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'dir_constant' => true,
'function_to_constant' => true,
'function_typehint_space' => true,
'heredoc_indentation' => true,
'include' => true,
'logical_operators' => true,
'list_syntax' => ['syntax' => 'short'],
'lowercase_cast' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'mb_str_functions' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'method_chaining_indentation' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'native_function_casing' => true,
'native_function_type_declaration_casing' => true,
'new_with_braces' => true,
'no_alternative_syntax' => true,
'no_blank_lines_after_class_opening' => true,
'no_break_comment' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => ['tokens' => ['extra']],
'no_homoglyph_names' => true,
'no_short_echo_tag' => false,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_inside_parenthesis' => true,
'no_superfluous_phpdoc_tags' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_curly_braces' => true,
'no_unset_cast' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'non_printable_character' => false,
'normalize_index_brace' => true,
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'ordered_class_elements' => [
'use_trait',
'constant_public',
'constant_protected',
'constant_private',
'property_public',
'property_protected',
'property_private',
'construct',
'destruct',
'magic',
'phpunit',
],
'ordered_imports' => [
'imports_order' => ['class', 'function', 'const'],
'sort_algorithm' => 'alpha',
],
'php_unit_construct' => true,
'php_unit_expectation' => true,
'php_unit_method_casing' => ['case' => 'camel_case'],
'php_unit_no_expectation_annotation' => true,
'php_unit_ordered_covers' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_strict' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'this'],
'phpdoc_align' => true,
'phpdoc_inline_tag' => true,
'phpdoc_no_alias_tag' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => true,
'phpdoc_var_annotation_correct_order' => true,
'phpdoc_var_without_name' => true,
'psr4' => true,
'return_assignment' => true,
'return_type_declaration' => true,
'self_accessor' => true,
'semicolon_after_instruction' => true,
'set_type_to_cast' => true,
'short_scalar_cast' => true,
'simple_to_complex_string_variable' => true,
'simplified_null_return' => true,
'single_class_element_per_statement' => true,
'single_import_per_statement' => false,
'single_line_comment_style' => true,
'space_after_semicolon' => true,
'standardize_increment' => true,
'standardize_not_equals' => true,
'strict_comparison' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'void_return' => true,
'whitespace_after_comma_in_array' => true,
'yoda_style' => false,
])
->setRiskyAllowed(true)
->setFinder($finder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.