Last active
April 4, 2023 09:37
-
-
Save fgdaniel/e4cbe69b9d5cc97f101e8c12263025f6 to your computer and use it in GitHub Desktop.
PHP CS Fixer settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return (new PhpCsFixer\Config()) | |
->setRules(array( | |
// '@PSR12' => true, | |
// basic | |
'curly_braces_position' => array( | |
'functions_opening_brace' => 'same_line', | |
'classes_opening_brace' => 'same_line', | |
'anonymous_classes_opening_brace' => 'same_line', | |
'allow_single_line_empty_anonymous_classes' => true, | |
'allow_single_line_anonymous_functions' => true | |
), | |
'no_multiple_statements_per_line' => true, | |
'no_trailing_comma_in_singleline' => array( | |
'elements' => array('arguments', 'array_destructuring', 'array', 'group_import') | |
), | |
// array_notation | |
'array_indentation' => true, | |
'array_syntax' => array('syntax' => 'long'), | |
'class_attributes_separation' => array('elements' => array('method' => 'one')), | |
'no_multiline_whitespace_around_double_arrow' => true, | |
'no_trailing_comma_in_singleline_array' => true, | |
'no_whitespace_before_comma_in_array' => true, | |
'normalize_index_brace' => true, | |
// semicolon | |
'multiline_whitespace_before_semicolons' => array('strategy' => 'no_multi_line'), | |
'no_singleline_whitespace_before_semicolons' => true, | |
'semicolon_after_instruction' => true, | |
// whitespace | |
'blank_line_before_statement' => array( | |
'statements' => array('break', 'continue', 'declare', 'return', 'throw', 'try') | |
), | |
'whitespace_after_comma_in_array' => array('ensure_single_space' => true), | |
'compact_nullable_typehint' => true, | |
'indentation_type' => true, | |
'method_chaining_indentation' => true, | |
'no_spaces_around_offset' => array( | |
'positions' => array('inside', 'outside') | |
), | |
'no_spaces_inside_parenthesis' => false, | |
'no_trailing_whitespace' => true, | |
'statement_indentation' => true, | |
// operator | |
'concat_space' => array('spacing' => 'one'), | |
'increment_style' => array('style' => 'post'), | |
'no_space_around_double_colon' => true, | |
'not_operator_with_space' => true, | |
'object_operator_without_whitespace' => true, | |
'standardize_not_equals' => true, | |
'ternary_operator_spaces' => true, | |
'binary_operator_spaces' => array( | |
'default' => 'align_single_space_minimal_by_scope', | |
'operators' => array( | |
'|' => 'no_space', | |
'=>' => 'align_single_space_minimal_by_scope' | |
) | |
), | |
// namespace notation | |
'clean_namespace' => true, | |
'no_leading_namespace_whitespace' => true, | |
'single_blank_line_before_namespace' => true, | |
// Language construct | |
'combine_consecutive_issets' => true, | |
'combine_consecutive_unsets' => true, | |
// casing | |
'lowercase_keywords' => true, | |
'magic_constant_casing' => true, | |
'native_function_casing' => true, | |
// control structure | |
'no_alternative_syntax' => true, | |
// php tag | |
'echo_tag_syntax' => array('format' => 'long'), | |
'full_opening_tag' => true | |
)) | |
->setIndent("\t"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment