Skip to content

Instantly share code, notes, and snippets.

@iraklisg
Created January 22, 2019 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iraklisg/acc4434323d0fb5f051b200198144821 to your computer and use it in GitHub Desktop.
Save iraklisg/acc4434323d0fb5f051b200198144821 to your computer and use it in GitHub Desktop.
php-cs-fixer configuration file
<?php
$finder = PhpCsFixer\Finder::create()
->exclude([
'tests',
'storage',
'node_modules',
'vendor',
])
->in(__DIR__)
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true);
$rules = [
'@PHP56Migration' => true,
'@PSR2' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'array_indentation' => true,
'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => false],
'blank_line_after_namespace' => true,
'blank_line_before_statement' => true,
'braces' => true,
'indentation_type' => true,
'class_definition' => true,
'combine_consecutive_unsets' => true,
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'function_declaration' => true,
'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
'heredoc_to_nowdoc' => true,
'indentation_type' => true,
'line_ending' => true,
'list_syntax' => ['syntax' => 'long'],
'lowercase_constants' => true,
'lowercase_keywords' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'no_break_comment' => true,
'no_closing_tag' => true,
'no_extra_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
'no_short_echo_tag' => true,
'no_spaces_after_function_name' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => ['sortAlgorithm' => 'length'],
'php_unit_strict' => false,
'php_unit_test_class_requires_covers' => false,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_align' => ['align' =>'left'],
'phpdoc_no_empty_return' => true,
'phpdoc_order' => true,
'phpdoc_separation' => false,
'psr0' => false,
'semicolon_after_instruction' => true,
'single_blank_line_at_eof' => true,
'single_class_element_per_statement' => ['elements' => ['property']],
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'strict_comparison' => false,
'strict_param' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'visibility_required' => true,
];
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules($rules)
->setFinder($finder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment