pastebin

Paste Search Dynamic
Recent pastes
phpcs
  1. <?php declare(strict_types=1);
  2.  
  3. return PhpCsFixerConfig::create()
  4.                         ->setUsingCache(false)
  5.                         ->setRiskyAllowed(true)
  6.                         ->setRules(
  7.                             [
  8.                                 'align_multiline_comment'                       => [
  9.                                     'comment_type' => 'all_multiline',
  10.                                 ],
  11.                                 'array_indentation'                             => true,
  12.                                 'array_syntax'                                  => [
  13.                                     'syntax' => 'short',
  14.                                 ],
  15.                                 'backtick_to_shell_exec'                        => true,
  16.                                 'binary_operator_spaces'                        => [
  17.                                     'operators' => ['=>' => 'align_single_space_minimal'],
  18.                                 ],
  19.                                 'blank_line_after_namespace'                    => true,
  20.                                 'blank_line_after_opening_tag'                  => false,
  21.                                 'blank_line_before_statement'                   => true,
  22.                                 'braces'                                        => true,
  23.                                 'cast_spaces'                                   => [
  24.                                     'space' => 'single',
  25.                                 ],
  26.                                 'class_attributes_separation'                   => true,
  27.                                 'class_keyword_remove'                          => false,
  28.                                 'combine_consecutive_issets'                    => true,
  29.                                 'combine_consecutive_unsets'                    => true,
  30.                                 'combine_nested_dirname'                        => true,
  31.                                 // 'compact_nullable_typehint'                  => true, // PHP >= 7.1
  32.                                 'concat_space'                                  => [
  33.                                     'spacing' => 'one',
  34.                                 ],
  35.                                 'date_time_immutable'                           => false,
  36.                                 'declare_equal_normalize'                       => true,
  37.                                 'declare_strict_types'                          => false, // some tests need declare_strict_types === 0
  38.                                 'dir_constant'                                  => true,
  39.                                 'elseif'                                        => true,
  40.                                 'encoding'                                      => true,
  41.                                 'ereg_to_preg'                                  => true,
  42.                                 'error_suppression'                             => false,
  43.                                 'escape_implicit_backslashes'                   => false,
  44.                                 'explicit_indirect_variable'                    => true,
  45.                                 'explicit_string_variable'                      => true,
  46.                                 'final_internal_class'                          => true,
  47.                                 'fopen_flag_order'                              => true,
  48.                                 'fopen_flags'                                   => true,
  49.                                 'full_opening_tag'                              => true,
  50.                                 'fully_qualified_strict_types'                  => true,
  51.                                 'function_declaration'                          => true,
  52.                                 'function_to_constant'                          => true,
  53.                                 'function_typehint_space'                       => true,
  54.                                 'general_phpdoc_annotation_remove'              => [
  55.                                     'annotations' => [
  56.                                         'author',
  57.                                         'package',
  58.                                         'version',
  59.                                     ],
  60.                                 ],
  61.                                 'heredoc_to_nowdoc'                             => false,
  62.                                 'implode_call'                                  => false,
  63.                                 'include'                                       => true,
  64.                                 'increment_style'                               => true,
  65.                                 'indentation_type'                              => true,
  66.                                 'line_ending'                                   => true,
  67.                                 'linebreak_after_opening_tag'                   => false,
  68.                                 /*                                                         // Requires PHP >= 7.1
  69.                                 'list_syntax'                                   => [
  70.                                     'syntax' => 'short',
  71.                                 ],
  72.                                 */
  73.                                 'logical_operators'                             => true,
  74.                                 'lowercase_cast'                                => true,
  75.                                 'lowercase_constants'                           => true,
  76.                                 'lowercase_keywords'                            => true,
  77.                                 'lowercase_static_reference'                    => true,
  78.                                 'magic_constant_casing'                         => true,
  79.                                 'magic_method_casing'                           => true,
  80.                                 'method_argument_space'                         => [
  81.                                     'ensure_fully_multiline'           => true,
  82.                                     'keep_multiple_spaces_after_comma' => false,
  83.                                 ],
  84.                                 'method_chaining_indentation'                   => true,
  85.                                 'modernize_types_casting'                       => true,
  86.                                 'multiline_comment_opening_closing'             => true,
  87.                                 'multiline_whitespace_before_semicolons'        => [
  88.                                     'strategy' => 'no_multi_line',
  89.                                 ],
  90.                                 'native_constant_invocation'                    => true,
  91.                                 'native_function_casing'                        => true,
  92.                                 'native_function_invocation'                    => true,
  93.                                 'new_with_braces'                               => true,
  94.                                 'no_alias_functions'                            => true,
  95.                                 'no_alternative_syntax'                         => true,
  96.                                 'no_binary_string'                              => true,
  97.                                 'no_blank_lines_after_class_opening'            => false,
  98.                                 'no_blank_lines_after_phpdoc'                   => true,
  99.                                 'no_blank_lines_before_namespace'               => false,
  100.                                 'no_break_comment'                              => true,
  101.                                 'no_closing_tag'                                => true,
  102.                                 'no_empty_comment'                              => true,
  103.                                 'no_empty_phpdoc'                               => true,
  104.                                 'no_empty_statement'                            => true,
  105.                                 'no_extra_blank_lines'                          => true,
  106.                                 'no_homoglyph_names'                            => true,
  107.                                 'no_leading_import_slash'                       => true,
  108.                                 'no_leading_namespace_whitespace'               => true,
  109.                                 'no_mixed_echo_print'                           => [
  110.                                     'use' => 'echo',
  111.                                 ],
  112.                                 'no_multiline_whitespace_around_double_arrow'   => true,
  113.                                 'no_null_property_initialization'               => true,
  114.                                 'no_php4_constructor'                           => true,
  115.                                 'no_short_bool_cast'                            => true,
  116.                                 'no_short_echo_tag'                             => true,
  117.                                 'no_singleline_whitespace_before_semicolons'    => true,
  118.                                 'no_spaces_after_function_name'                 => true,
  119.                                 'no_spaces_around_offset'                       => true,
  120.                                 'no_spaces_inside_parenthesis'                  => true,
  121.                                 'no_superfluous_elseif'                         => true,
  122.                                 'no_superfluous_phpdoc_tags'                    => false, // maybe add extra description, so keep it ...
  123.                                 'no_trailing_comma_in_list_call'                => true,
  124.                                 'no_trailing_comma_in_singleline_array'         => true,
  125.                                 'no_trailing_whitespace'                        => true,
  126.                                 'no_trailing_whitespace_in_comment'             => true,
  127.                                 'no_unneeded_control_parentheses'               => true,
  128.                                 'no_unneeded_curly_braces'                      => true,
  129.                                 'no_unneeded_final_method'                      => true,
  130.                                 'no_unreachable_default_argument_value'         => false, // do not changes the logic of the code ...
  131.                                 'no_unset_on_property'                          => true,
  132.                                 'no_unused_imports'                             => true,
  133.                                 'no_useless_else'                               => true,
  134.                                 'no_useless_return'                             => true,
  135.                                 'no_whitespace_before_comma_in_array'           => true,
  136.                                 'no_whitespace_in_blank_line'                   => true,
  137.                                 'non_printable_character'                       => false, // needed for some tests
  138.                                 'normalize_index_brace'                         => true,
  139.                                 'not_operator_with_space'                       => false,
  140.                                 'not_operator_with_successor_space'             => false,
  141.                                 'object_operator_without_whitespace'            => true,
  142.                                 'ordered_class_elements'                        => true,
  143.                                 'ordered_imports'                               => true,
  144.                                 'phpdoc_add_missing_param_annotation'           => [
  145.                                     'only_untyped' => true,
  146.                                 ],
  147.                                 'phpdoc_align'                                  => true,
  148.                                 'phpdoc_annotation_without_dot'                 => true,
  149.                                 'phpdoc_indent'                                 => true,
  150.                                 'phpdoc_inline_tag'                             => true,
  151.                                 'phpdoc_no_access'                              => true,
  152.                                 'phpdoc_no_alias_tag'                           => true,
  153.                                 'phpdoc_no_empty_return'                        => false, // allow void
  154.                                 'phpdoc_no_package'                             => true,
  155.                                 'phpdoc_no_useless_inheritdoc'                  => true,
  156.                                 'phpdoc_order'                                  => true,
  157.                                 'phpdoc_return_self_reference'                  => true,
  158.                                 'phpdoc_scalar'                                 => true,
  159.                                 'phpdoc_separation'                             => true,
  160.                                 'phpdoc_single_line_var_spacing'                => true,
  161.                                 'phpdoc_summary'                                => false,
  162.                                 'phpdoc_to_comment'                             => false,
  163.                                 'phpdoc_to_return_type'                         => false,
  164.                                 'phpdoc_trim'                                   => true,
  165.                                 'phpdoc_trim_consecutive_blank_line_separation' => true,
  166.                                 'phpdoc_types'                                  => true,
  167.                                 'phpdoc_types_order'                            => [
  168.                                     'null_adjustment' => 'always_last',
  169.                                     'sort_algorithm'  => 'alpha',
  170.                                 ],
  171.                                 'phpdoc_var_without_name'                       => true,
  172.                                 'php_unit_construct'                            => true,
  173.                                 'php_unit_dedicate_assert'                      => true,
  174.                                 'php_unit_expectation'                          => true,
  175.                                 'php_unit_fqcn_annotation'                      => true,
  176.                                 'php_unit_internal_class'                       => true,
  177.                                 'php_unit_method_casing'                        => true,
  178.                                 'php_unit_mock'                                 => true,
  179.                                 'php_unit_namespaced'                           => true,
  180.                                 'php_unit_no_expectation_annotation'            => true,
  181.                                 'php_unit_ordered_covers'                       => true,
  182.                                 'php_unit_set_up_tear_down_visibility'          => true,
  183.                                 'php_unit_strict'                               => true,
  184.                                 'php_unit_test_annotation'                      => true,
  185.                                 'php_unit_test_case_static_method_calls'        => true,
  186.                                 'php_unit_test_class_requires_covers'           => false,
  187.                                 'pow_to_exponentiation'                         => true,
  188.                                 'pre_increment'                                 => true,
  189.                                 'protected_to_private'                          => true,
  190.                                 'return_assignment'                             => true,
  191.                                 'return_type_declaration'                       => true,
  192.                                 'self_accessor'                                 => true,
  193.                                 'semicolon_after_instruction'                   => true,
  194.                                 'set_type_to_cast'                              => true,
  195.                                 'short_scalar_cast'                             => true,
  196.                                 'silenced_deprecation_error'                    => false,
  197.                                 'simplified_null_return'                        => false, // maybe better for readability, so keep it ...
  198.                                 'single_blank_line_at_eof'                      => true,
  199.                                 'single_class_element_per_statement'            => true,
  200.                                 'single_import_per_statement'                   => true,
  201.                                 'single_line_after_imports'                     => true,
  202.                                 'single_line_comment_style'                     => [
  203.                                     'comment_types' => ['hash'],
  204.                                 ],
  205.                                 'single_quote'                                  => true,
  206.                                 'space_after_semicolon'                         => true,
  207.                                 'standardize_increment'                         => true,
  208.                                 'standardize_not_equals'                        => true,
  209.                                 'static_lambda'                                 => true,
  210.                                 'strict_comparison'                             => true,
  211.                                 'strict_param'                                  => true,
  212.                                 'string_line_ending'                            => false, // bug for e.g. "'<x onxxx=1'"
  213.                                 'switch_case_semicolon_to_colon'                => true,
  214.                                 'switch_case_space'                             => true,
  215.                                 'ternary_operator_spaces'                       => true,
  216.                                 'ternary_to_null_coalescing'                    => true,
  217.                                 'trailing_comma_in_multiline_array'             => true,
  218.                                 'trim_array_spaces'                             => true,
  219.                                 'unary_operator_spaces'                         => true,
  220.                                 'visibility_required'                           => true,
  221.                                 // 'void_return'                                   => true, // PHP >= 7.1
  222.                                 'whitespace_after_comma_in_array'               => true,
  223.                                 'yoda_style'                                    => [
  224.                                     'equal'            => false,
  225.                                     'identical'        => false,
  226.                                     'less_and_greater' => false,
  227.                                 ],
  228.                             ]
  229.                         )
  230.                         ->setIndent("    ")
  231.                         ->setLineEnding("n")
  232.                         ->setFinder(
  233.                             PhpCsFixerFinder::create()
  234.                                              ->in(['src/', 'tests/'])
  235.                                              ->name('*.php')
  236.                                              ->ignoreDotFiles(true)
  237.                                              ->ignoreVCS(true)
  238.                         );
Parsed in 0.737 seconds