Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/new rules #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Feature/new rules #2

wants to merge 2 commits into from

Conversation

reed-jones
Copy link
Contributor

No description provided.

@reed-jones
Copy link
Contributor Author

For the curious, new rules can be tested out here: https://mlocati.github.io/php-cs-fixer-configurator/#version:2.16|configurator

copy the following and import to highlight the selected options, most have examples

<?php

return PhpCsFixer\Config::create()
    ->setRules([
        '@PSR2'                                       => true,
        'align_multiline_comment'                     => true,
        'array_indentation'                           => true,
        'array_syntax'                                => ['syntax' => 'short'],
        'backtick_to_shell_exec'                      => true,
        'binary_operator_spaces'                      => ['align_double_arrow' => true, 'align_equals' => false],
        'blank_line_after_namespace'                  => true,
        'blank_line_after_opening_tag'                => true,
        'blank_line_before_statement'                 => true,
        'braces'                                      => ['allow_single_line_closure' => true],
        'cast_spaces'                                 => true,
        'class_attributes_separation'                 => true,
        'class_definition'                            => true,
        'combine_consecutive_issets'                  => true,
        'combine_consecutive_unsets'                  => true,
        'concat_space'                                => ['spacing' => 'one'],
        'declare_equal_normalize'                     => true,
        'elseif'                                      => true,
        'explicit_indirect_variable'                  => true,
        'explicit_string_variable'                    => true,
        'function_declaration'                        => true,
        'function_typehint_space'                     => true,
        'hash_to_slash_comment'                       => true,
        'include'                                     => true,
        'line_ending'                                 => true,
        'list_syntax'                                 => true,
        'lowercase_cast'                              => true,
        'lowercase_keywords'                          => true,
        'lowercase_static_reference'                  => true,
        'magic_constant_casing'                       => true,
        'magic_method_casing'                         => true,
        'method_chaining_indentation'                 => true,
        'method_separation'                           => true,
        'no_alternative_syntax'                       => true,
        'no_blank_lines_after_class_opening'          => true,
        'no_blank_lines_after_phpdoc'                 => true,
        'no_break_comment'                            => true,
        'no_closing_tag'                              => true,
        'no_empty_phpdoc'                             => true,
        'no_empty_statement'                          => true,
        'no_extra_blank_lines'                        => true,
        'no_extra_consecutive_blank_lines'            => ['curly_brace_block', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'throw', 'use'],
        'no_leading_import_slash'                     => true,
        'no_multiline_whitespace_around_double_arrow' => true,
        'no_multiline_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_whitespace_in_comment'           => true,
        'no_unneeded_control_parentheses'             => true,
        'no_whitespace_before_comma_in_array'         => true,
        'no_whitespace_in_blank_line'                 => true,
        'object_operator_without_whitespace'          => true,
        'phpdoc_add_missing_param_annotation'         => ['only_untyped' => false],
        'phpdoc_indent'                               => true,
        'phpdoc_order'                                => true,
        'phpdoc_separation'                           => true,
        'phpdoc_summary'                              => true,
        'phpdoc_trim'                                 => true,
        'phpdoc_types'                                => true,
        'phpdoc_var_annotation_correct_order'         => true,
        'single_blank_line_before_namespace'          => true,
        'single_quote'                                => false,
        'standardize_not_equals'                      => true,
        'ternary_operator_spaces'                     => true,
        'ternary_to_null_coalescing'                  => true,
        'trim_array_spaces'                           => true,
        'unary_operator_spaces'                       => true,
        'whitespace_after_comma_in_array'             => true,
    ])
    ->setFinder(PhpCsFixer\Finder::create()
        ->exclude('vendor')
        ->in(__DIR__)
    );

@ghost
Copy link

ghost commented Dec 31, 2019

@reed-jones After checking out the selections you made -- I like all the ones you picked. These are my additions:

multiline_comment_opening_closing
(force multiline comments to be in multiline syntax)

space_after_semicolon
(Trims space after semicolons)

no_useless_else
(No empty/useless else)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant