Skip to content

Instantly share code, notes, and snippets.

@stoneC0der
Forked from pierophp/.php_cs
Last active February 19, 2021 09:26
Show Gist options
  • Select an option

  • Save stoneC0der/7be1b59115a62b43b8b167c62b710467 to your computer and use it in GitHub Desktop.

Select an option

Save stoneC0der/7be1b59115a62b43b8b167c62b710467 to your computer and use it in GitHub Desktop.

Revisions

  1. stoneC0der revised this gist Feb 19, 2021. 1 changed file with 48 additions and 65 deletions.
    113 changes: 48 additions & 65 deletions .php_cs
    Original file line number Diff line number Diff line change
    @@ -1,67 +1,50 @@
    <?php

    $finder = Symfony\Component\Finder\Finder::create()
    ->files()
    ->in(__DIR__)
    ->exclude('vendor')
    ->exclude('resources/views')
    ->exclude('storage')
    ->exclude('public')
    ->notName("*.txt")
    ->ignoreDotFiles(true)
    ->ignoreVCS(true);

    $fixers = [
    '-psr0',
    '-php_closing_tag',
    'blankline_after_open_tag',
    'double_arrow_multiline_whitespaces',
    'duplicate_semicolon',
    'empty_return',
    'extra_empty_lines',
    'include',
    'join_function',
    'list_commas',
    'multiline_array_trailing_comma',
    'namespace_no_leading_whitespace',
    'no_blank_lines_after_class_opening',
    'no_empty_lines_after_phpdocs',
    'object_operator',
    'operators_spaces',
    'phpdoc_indent',
    'phpdoc_no_access',
    'phpdoc_no_package',
    'phpdoc_scalar',
    'phpdoc_short_description',
    'phpdoc_to_comment',
    'phpdoc_trim',
    'phpdoc_type_to_var',
    'phpdoc_var_without_name',
    'remove_leading_slash_use',
    'remove_lines_between_uses',
    'return',
    'self_accessor',
    'single_array_no_trailing_comma',
    'single_blank_line_before_namespace',
    'single_quote',
    'spaces_before_semicolon',
    'spaces_cast',
    'standardize_not_equal',
    'ternary_spaces',
    'trim_array_spaces',
    'unalign_equals',
    'unary_operators_spaces',
    'whitespacy_lines',
    'multiline_spaces_before_semicolon',
    'short_array_syntax',
    'short_echo_tag',
    'concat_with_spaces',
    'no_useless_else',
    'ordered_use',
    ];

    return Symfony\CS\Config\Config::create()
    ->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
    ->fixers($fixers)
    ->finder($finder)
    ->setUsingCache(true);
    return PhpCsFixer\Config::create()
    ->setRiskyAllowed(true)
    ->setRules(
    [
    '@Symfony' => true,
    '@Symfony:risky' => true,
    '@PHP71Migration' => true,
    'array_syntax' => ['syntax' => 'short'],
    'dir_constant' => true,
    'heredoc_to_nowdoc' => true,
    'linebreak_after_opening_tag' => true,
    'modernize_types_casting' => true,
    'no_multiline_whitespace_before_semicolons' => true,
    'no_unreachable_default_argument_value' => true,
    'no_useless_else' => true,
    'no_useless_return' => true,
    'ordered_class_elements' => true,
    'ordered_imports' => true,
    'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
    'phpdoc_order' => true,
    'declare_strict_types' => true,
    'doctrine_annotation_braces' => true,
    'doctrine_annotation_indentation' => true,
    'doctrine_annotation_spaces' => true,
    'psr4' => true,
    'no_php4_constructor' => true,
    'no_short_echo_tag' => true,
    'semicolon_after_instruction' => true,
    'align_multiline_comment' => true,
    'doctrine_annotation_array_assignment' => true,
    'general_phpdoc_annotation_remove' => ['annotations' => ['author', 'package']],
    'list_syntax' => ['syntax' => 'short'],
    'phpdoc_types_order' => ['null_adjustment' => 'always_last'],
    'single_line_comment_style' => true,
    ]
    )
    ->setCacheFile(__DIR__.'/.php_cs.cache')
    ->setFinder(
    PhpCsFixer\Finder::create()
    ->in(__DIR__)
    ->files()
    ->exclude('vendor')
    ->exclude('resources/views')
    ->exclude('storage')
    ->exclude('public')
    ->notName('*.txt')
    ->ignoreDotFiles(true)
    );
  2. stoneC0der revised this gist Feb 19, 2021. No changes.
  3. @pierophp pierophp created this gist Nov 22, 2016.
    67 changes: 67 additions & 0 deletions .php_cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,67 @@
    <?php

    $finder = Symfony\Component\Finder\Finder::create()
    ->files()
    ->in(__DIR__)
    ->exclude('vendor')
    ->exclude('resources/views')
    ->exclude('storage')
    ->exclude('public')
    ->notName("*.txt")
    ->ignoreDotFiles(true)
    ->ignoreVCS(true);

    $fixers = [
    '-psr0',
    '-php_closing_tag',
    'blankline_after_open_tag',
    'double_arrow_multiline_whitespaces',
    'duplicate_semicolon',
    'empty_return',
    'extra_empty_lines',
    'include',
    'join_function',
    'list_commas',
    'multiline_array_trailing_comma',
    'namespace_no_leading_whitespace',
    'no_blank_lines_after_class_opening',
    'no_empty_lines_after_phpdocs',
    'object_operator',
    'operators_spaces',
    'phpdoc_indent',
    'phpdoc_no_access',
    'phpdoc_no_package',
    'phpdoc_scalar',
    'phpdoc_short_description',
    'phpdoc_to_comment',
    'phpdoc_trim',
    'phpdoc_type_to_var',
    'phpdoc_var_without_name',
    'remove_leading_slash_use',
    'remove_lines_between_uses',
    'return',
    'self_accessor',
    'single_array_no_trailing_comma',
    'single_blank_line_before_namespace',
    'single_quote',
    'spaces_before_semicolon',
    'spaces_cast',
    'standardize_not_equal',
    'ternary_spaces',
    'trim_array_spaces',
    'unalign_equals',
    'unary_operators_spaces',
    'whitespacy_lines',
    'multiline_spaces_before_semicolon',
    'short_array_syntax',
    'short_echo_tag',
    'concat_with_spaces',
    'no_useless_else',
    'ordered_use',
    ];

    return Symfony\CS\Config\Config::create()
    ->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
    ->fixers($fixers)
    ->finder($finder)
    ->setUsingCache(true);