Advertisement
Guest User

.php_cs.dist

a guest
May 6th, 2020
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.69 KB | None | 0 0
  1. <?php
  2.  
  3. use PhpCsFixer\Config;
  4. use PhpCsFixer\Finder;
  5.  
  6. $rules = [
  7.     'array_syntax' => ['syntax' => 'short'],
  8.     'binary_operator_spaces' => [
  9.         'default' => 'single_space',
  10.         'operators' => ['=>' => null]
  11.     ],
  12.     'blank_line_after_namespace' => true,
  13.     'blank_line_after_opening_tag' => true,
  14.     'blank_line_before_statement' => [
  15.         'statements' => ['return']
  16.     ],
  17.     'braces' => true,
  18.     'cast_spaces' => true,
  19.     'class_attributes_separation' => [
  20.         'elements' => ['method']
  21.     ],
  22.     'class_definition' => true,
  23.     'concat_space' => [
  24.         'spacing' => 'none'
  25.     ],
  26.     'declare_equal_normalize' => true,
  27.     'elseif' => true,
  28.     'encoding' => true,
  29.     'full_opening_tag' => true,
  30.     'fully_qualified_strict_types' => true, // added by Shift
  31.     'function_declaration' => true,
  32.     'function_typehint_space' => true,
  33.     'heredoc_to_nowdoc' => true,
  34.     'include' => true,
  35.     'increment_style' => ['style' => 'post'],
  36.     'indentation_type' => true,
  37.     'linebreak_after_opening_tag' => true,
  38.     'line_ending' => true,
  39.     'lowercase_cast' => true,
  40.     'lowercase_constants' => true,
  41.     'lowercase_keywords' => true,
  42.     'lowercase_static_reference' => true, // added from Symfony
  43.     'magic_method_casing' => true, // added from Symfony
  44.     'magic_constant_casing' => true,
  45.     'method_argument_space' => true,
  46.     'native_function_casing' => true,
  47.     'no_alias_functions' => true,
  48.     'no_extra_blank_lines' => [
  49.         'tokens' => [
  50.             'extra',
  51.             'throw',
  52.             'use',
  53.             'use_trait',
  54.         ]
  55.     ],
  56.     'no_blank_lines_after_class_opening' => true,
  57.     'no_blank_lines_after_phpdoc' => true,
  58.     'no_closing_tag' => true,
  59.     'no_empty_phpdoc' => true,
  60.     'no_empty_statement' => true,
  61.     'no_leading_import_slash' => true,
  62.     'no_leading_namespace_whitespace' => true,
  63.     'no_mixed_echo_print' => [
  64.         'use' => 'echo'
  65.     ],
  66.     'no_multiline_whitespace_around_double_arrow' => true,
  67.     'multiline_whitespace_before_semicolons' => [
  68.         'strategy' => 'no_multi_line'
  69.     ],
  70.     'no_short_bool_cast' => true,
  71.     'no_singleline_whitespace_before_semicolons' => true,
  72.     'no_spaces_after_function_name' => true,
  73.     'no_spaces_around_offset' => true,
  74.     'no_spaces_inside_parenthesis' => true,
  75.     'no_trailing_comma_in_list_call' => true,
  76.     'no_trailing_comma_in_singleline_array' => true,
  77.     'no_trailing_whitespace' => true,
  78.     'no_trailing_whitespace_in_comment' => true,
  79.     'no_unneeded_control_parentheses' => true,
  80.     'no_unreachable_default_argument_value' => true,
  81.     'no_useless_return' => true,
  82.     'no_whitespace_before_comma_in_array' => true,
  83.     'no_whitespace_in_blank_line' => true,
  84.     'normalize_index_brace' => true,
  85.     'not_operator_with_successor_space' => true,
  86.     'object_operator_without_whitespace' => true,
  87.     'ordered_imports' => ['sortAlgorithm' => 'alpha'],
  88.     'phpdoc_indent' => true,
  89.     'phpdoc_inline_tag' => true,
  90.     'phpdoc_no_access' => true,
  91.      // 'phpdoc_no_package' => true,
  92.     'phpdoc_no_useless_inheritdoc' => true,
  93.     'phpdoc_scalar' => true,
  94.     'phpdoc_single_line_var_spacing' => true,
  95.     'phpdoc_summary' => true,
  96.     'phpdoc_to_comment' => true,
  97.     'phpdoc_trim' => true,
  98.     'phpdoc_types' => true,
  99.     'phpdoc_var_without_name' => true,
  100.     'psr4' => true,
  101.     'self_accessor' => true,
  102.     'short_scalar_cast' => true,
  103.     'simplified_null_return' => true,
  104.     'single_blank_line_at_eof' => true,
  105.     'single_blank_line_before_namespace' => true,
  106.     'single_class_element_per_statement' => true,
  107.     'single_import_per_statement' => true,
  108.     'single_line_after_imports' => true,
  109.     'single_line_comment_style' => [
  110.         'comment_types' => ['hash']
  111.     ],
  112.     'single_quote' => true,
  113.     'space_after_semicolon' => true,
  114.     'standardize_not_equals' => true,
  115.     'switch_case_semicolon_to_colon' => true,
  116.     'switch_case_space' => true,
  117.     'ternary_operator_spaces' => true,
  118.     'trailing_comma_in_multiline_array' => true,
  119.     'trim_array_spaces' => true,
  120.     'unary_operator_spaces' => true,
  121.     'visibility_required' => [
  122.         'elements' => ['method', 'property']
  123.     ],
  124.     'whitespace_after_comma_in_array' => true,
  125. ];
  126.  
  127. $finder = Finder::create()
  128.     ->notPath('bootstrap')
  129.     ->notPath('storage')
  130.     ->notPath('vendor')
  131.     ->notPath('public')
  132.     ->in(getcwd())
  133.     ->name('*.php')
  134.     ->notName('*.blade.php')
  135.     ->notName('*.js')
  136.     ->notName('index.php')
  137.     ->notName('server.php')
  138.     ->ignoreDotFiles(true)
  139.     ->ignoreVCS(true);
  140.  
  141. return Config::create()
  142.     ->setFinder($finder)
  143.     ->setRules($rules)
  144.     ->setRiskyAllowed(true)
  145.     ->setUsingCache(true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement