Skip to content

Instantly share code, notes, and snippets.

@nissicreative
Last active April 28, 2023 00:41
Show Gist options
  • Save nissicreative/29a734a751b72ce4cb3a8ffd050979cd to your computer and use it in GitHub Desktop.
Save nissicreative/29a734a751b72ce4cb3a8ffd050979cd to your computer and use it in GitHub Desktop.
~/.php-cs-fixer.php
<?php
return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'@PHP74Migration' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null],
],
'blank_line_before_statement' => [
'statements' => ['return', 'case'],
],
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => [
// 'const' => 'one',
'method' => 'one',
// 'property' => 'one',
// 'trait_import' => 'none',
],
],
'clean_namespace' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'concat_space' => [
'spacing' => 'none',
],
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'function_typehint_space' => true,
'global_namespace_import' => true,
'include' => true,
'increment_style' => [
'style' => 'post',
],
'magic_constant_casing' => true,
'magic_method_casing' => true,
'method_chaining_indentation' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'native_function_casing' => true,
'native_function_type_declaration_casing' => true,
'no_alias_language_construct_call' => true,
'no_alternative_syntax' => true,
'no_extra_blank_lines' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => [
'use' => 'echo',
],
'no_multiline_whitespace_around_double_arrow' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'normalize_index_brace' => true,
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'operator_linebreak' => [
'position' => 'beginning',
],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
],
'phpdoc_inline_tag_normalizer' => true,
'phpdoc_no_access' => true,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_scalar' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'return_assignment' => true,
'simple_to_complex_string_variable' => true,
'simplified_if_return' => true,
'simplified_null_return' => true,
'single_line_throw' => true,
'single_quote' => true,
'single_space_after_construct' => true,
'space_after_semicolon' => true,
'standardize_increment' => true,
'standardize_not_equals' => true,
'switch_continue_to_break' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
// 'visibility_required' => true,
'whitespace_after_comma_in_array' => true,
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment