Skip to content

Instantly share code, notes, and snippets.

@ppshobi
Created April 24, 2023 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppshobi/136350cc8cab46a2b9627765dadf9a0f to your computer and use it in GitHub Desktop.
Save ppshobi/136350cc8cab46a2b9627765dadf9a0f to your computer and use it in GitHub Desktop.
$rules = [
// standard
'@PHP81Migration' => true,
'@PHP80Migration:risky' => true,
'@PSR1' => true,
'@PSR2' => true,
'@PSR12' => true,
'@PSR12:risky' => true,
'@Symfony' => true,
'@PhpCsFixer' => true,
'blank_line_before_statement' => false,
'class_attributes_separation' => true,
'cast_spaces' => ['space' => 'none'],
'concat_space' => ['spacing' => 'one'],
'escape_implicit_backslashes' => ['double_quoted' => true, 'heredoc_syntax' => true, 'single_quoted' => true],
'multiline_whitespace_before_semicolons' => true,
'no_extra_blank_lines' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true],
'single_space_after_construct' => true,
'no_spaces_after_function_name' => false,
'not_operator_with_space' => false,
'nullable_type_declaration_for_default_null_value' => true,
'ordered_class_elements' => false,
'ordered_imports' => true,
'phpdoc_to_comment' => ['ignored_tags' => ['var']],
'php_unit_internal_class' => false,
'php_unit_test_class_requires_covers' => false,
'yoda_style' => false,
'return_assignment' => false,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'braces' => [
'allow_single_line_closure' => true,
'position_after_functions_and_oop_constructs' => 'same',
],
// risky
'function_to_constant' => true,
'is_null' => true,
//'date_time_immutable' => true,§
'declare_strict_types' => false, //TODO://enable it in files one by one
'dir_constant' => true,
'modernize_types_casting' => true,
'no_alias_functions' => true,
'no_homoglyph_names' => true,
'non_printable_character' => ['use_escape_sequences_in_strings' => true],
'no_php4_constructor' => true,
'phpdoc_no_alias_tag' => false,
'php_unit_construct' => true,
'php_unit_dedicate_assert' => ['target' => 'newest'],
'php_unit_expectation' => ['target' => 'newest'],
'php_unit_method_casing' => true,
'php_unit_mock' => ['target' => 'newest'],
'php_unit_mock_short_will_return' => true,
'php_unit_namespaced' => ['target' => 'newest'],
'php_unit_no_expectation_annotation' => ['target' => 'newest'],
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_test_case_static_method_calls' => true,
'pow_to_exponentiation' => true,
'random_api_migration' => true,
'use_arrow_functions' => false,
];
$config = new PhpCsFixer\Config();
return $config->setRules($rules)
->setRiskyAllowed(true)
->setFinder($finder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment