Last active
April 12, 2022 12:16
-
-
Save lucasemanuel/81b4d2ff9a2e911221c13081af99a2eb to your computer and use it in GitHub Desktop.
Fixer php
This file contains hidden or 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 | |
use PhpCsFixer\Config; | |
use PhpCsFixer\Finder; | |
$rules = [ | |
'@PSR12' => true, | |
'array_indentation' => true, | |
'array_push' => true, | |
'array_syntax' => ['syntax' => 'short'], | |
'binary_operator_spaces' => true, | |
'cast_spaces' => ['space' => 'single'], | |
'class_attributes_separation' => [ | |
'elements' => ['method' => 'one'], | |
], | |
'class_reference_name_casing' => true, | |
'clean_namespace' => true, | |
// 'combine_consecutive_issets' => true, | |
// 'combine_consecutive_issets' => false, | |
'concat_space' => ['spacing' => 'one'], | |
'control_structure_continuation_position' => true, | |
'fully_qualified_strict_types' => true, | |
'full_opening_tag' => true, | |
'function_typehint_space' => true, | |
'global_namespace_import' => true, | |
// 'group_import' => true, | |
'heredoc_indentation' => true, | |
'heredoc_to_nowdoc' => true, | |
'integer_literal_case' => true, | |
'linebreak_after_opening_tag' => true, | |
'list_syntax' => ['syntax' => 'short'], | |
'magic_constant_casing' => true, | |
'magic_method_casing' => true, | |
'method_chaining_indentation' => true, | |
'multiline_whitespace_before_semicolons' => true, | |
'native_function_casing' => true, | |
'native_function_type_declaration_casing' => true, | |
'no_alias_functions' => true, | |
'no_empty_comment' => true, | |
'no_empty_phpdoc' => true, | |
'no_empty_statement' => true, | |
'no_extra_blank_lines' => [ | |
'tokens' => [ | |
// 'break', | |
'continue', | |
'curly_brace_block', | |
'extra', | |
'parenthesis_brace_block', | |
'return', | |
'square_brace_block', | |
'throw', | |
'use', | |
'use_trait', | |
'switch', | |
'case', | |
'default' | |
], | |
], | |
'no_leading_namespace_whitespace' => true, | |
'no_multiline_whitespace_around_double_arrow' => true, | |
'no_php4_constructor' => true, | |
'no_short_bool_cast' => true, | |
'no_singleline_whitespace_before_semicolons' => true, | |
'no_spaces_around_offset' => true, | |
'no_trailing_comma_in_list_call' => true, | |
'no_trailing_comma_in_singleline_array' => true, | |
'no_trailing_comma_in_singleline_function_call' => true, | |
'no_unneeded_control_parentheses' => true, | |
'no_unneeded_curly_braces' => true, | |
'no_unused_imports' => true, | |
'no_useless_return' => true, | |
'no_whitespace_before_comma_in_array' => true, | |
'nullable_type_declaration_for_default_null_value' => true, | |
'object_operator_without_whitespace' => true, | |
'operator_linebreak' => ['position' => 'beginning'], | |
'php_unit_method_casing' => true, | |
'self_accessor' => true, | |
'simplified_if_return' => true, | |
'simplified_null_return' => true, | |
'single_line_comment_spacing' => true, | |
'single_quote' => true, | |
'single_space_after_construct' => true, | |
'ternary_to_null_coalescing' => true, | |
'trailing_comma_in_multiline' => false, | |
'trim_array_spaces' => true, | |
'types_spaces' => ['space' => 'single'], | |
'unary_operator_spaces' => true, | |
'whitespace_after_comma_in_array' => true, | |
]; | |
$finder = Finder::create()->in([ | |
__DIR__ . '/app', | |
__DIR__ . '/config', | |
__DIR__ . '/database', | |
__DIR__ . '/lang', | |
__DIR__ . '/resources', | |
__DIR__ . '/routes', | |
__DIR__ . '/tests', | |
]) | |
->name('*.php') | |
->notName('*.blade.php') | |
->ignoreDotFiles(true) | |
->ignoreVCS(true); | |
$config = new Config(); | |
return $config | |
->setFinder($finder) | |
->setRules($rules) | |
->setRiskyAllowed(true) | |
->setUsingCache(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment