in(__DIR__ . '/src') ->in(__DIR__ . '/tests') ->name('*.php') ->notPath('vendor'); return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) ->setRules([ // PSR-12 compliance '@PSR12' => true, // Additional rules for better code quality 'array_syntax' => ['syntax' => 'short'], 'binary_operator_spaces' => ['default' => 'single_space'], 'blank_line_after_opening_tag' => true, 'blank_line_before_statement' => [ 'statements' => ['return', 'try', 'throw', 'if', 'switch', 'for', 'foreach', 'while', 'do'], ], 'cast_spaces' => true, 'class_attributes_separation' => [ 'elements' => [ 'method' => 'one', 'property' => 'one', 'trait_import' => 'none', ], ], 'concat_space' => ['spacing' => 'one'], 'declare_strict_types' => true, 'fully_qualified_strict_types' => true, 'function_typehint_space' => true, 'general_phpdoc_tag_rename' => true, 'include' => true, 'increment_style' => ['style' => 'post'], 'linebreak_after_opening_tag' => true, 'lowercase_cast' => true, 'magic_constant_casing' => true, 'magic_method_casing' => true, 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], 'native_function_casing' => true, 'native_function_type_declaration_casing' => true, 'new_with_braces' => true, 'no_alias_language_construct_call' => true, 'no_alternative_syntax' => true, 'no_binary_string' => true, 'no_blank_lines_after_phpdoc' => true, 'no_empty_phpdoc' => true, 'no_empty_statement' => true, 'no_extra_blank_lines' => [ 'tokens' => [ 'extra', 'throw', 'use', ], ], 'no_leading_import_slash' => true, 'no_leading_namespace_whitespace' => true, 'no_mixed_echo_print' => true, 'no_multiline_whitespace_around_double_arrow' => true, 'no_short_bool_cast' => true, 'no_singleline_whitespace_before_semicolons' => true, 'no_spaces_around_offset' => true, 'no_trailing_comma_in_singleline_array' => true, 'no_unneeded_control_parentheses' => true, 'no_unneeded_curly_braces' => true, 'no_unused_imports' => true, 'no_whitespace_before_comma_in_array' => true, 'normalize_index_brace' => true, 'object_operator_without_whitespace' => true, 'ordered_imports' => [ 'imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha', ], 'phpdoc_align' => ['align' => 'left'], 'phpdoc_annotation_without_dot' => true, 'phpdoc_indent' => true, 'phpdoc_inline_tag_normalizer' => true, 'phpdoc_no_access' => true, 'phpdoc_no_alias_tag' => true, 'phpdoc_no_empty_return' => true, 'phpdoc_no_package' => true, 'phpdoc_no_useless_inheritdoc' => true, 'phpdoc_order' => true, 'phpdoc_return_self_reference' => true, 'phpdoc_scalar' => true, 'phpdoc_separation' => true, 'phpdoc_single_line_var_spacing' => true, 'phpdoc_summary' => true, 'phpdoc_tag_type' => true, 'phpdoc_to_comment' => true, 'phpdoc_trim' => true, 'phpdoc_trim_consecutive_blank_line_separation' => true, 'phpdoc_types' => true, 'phpdoc_types_order' => ['null_adjustment' => 'always_last'], 'phpdoc_var_without_name' => true, 'return_type_declaration' => true, 'semicolon_after_instruction' => true, 'short_scalar_cast' => true, 'single_blank_line_before_namespace' => true, 'single_class_element_per_statement' => true, 'single_line_comment_style' => true, 'single_quote' => true, 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], 'standardize_increment' => true, 'standardize_not_equals' => true, 'ternary_operator_spaces' => true, 'trailing_comma_in_multiline' => true, 'trim_array_spaces' => true, 'unary_operator_spaces' => true, 'visibility_required' => true, 'whitespace_after_comma_in_array' => true, // Risky rules for better code quality 'strict_comparison' => true, 'strict_param' => true, 'array_push' => true, 'combine_consecutive_issets' => true, 'combine_consecutive_unsets' => true, 'dir_constant' => true, 'function_to_constant' => true, 'is_null' => true, 'modernize_types_casting' => true, 'no_alias_functions' => true, 'no_homoglyph_names' => true, 'non_printable_character' => true, 'php_unit_construct' => true, 'psr_autoloading' => true, 'self_accessor' => true, ]) ->setFinder($finder);