Skip to content

Instantly share code, notes, and snippets.

@jiahong96
Created June 4, 2020 01:16
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 jiahong96/239c6179f2522624b1ef72467a997708 to your computer and use it in GitHub Desktop.
Save jiahong96/239c6179f2522624b1ef72467a997708 to your computer and use it in GitHub Desktop.
php cs fixer rules for Laravel
<?php
return PhpCsFixer\Config::create()
->setRules(array(
'@PSR2' => true,
'concat_space' => array('spacing' => 'none'),
'array_indentation' => true,
'no_unused_imports' => true,
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
'method_separation' => true,
'no_multiline_whitespace_before_semicolons' => true,
'single_quote' => true,
'binary_operator_spaces' => array(
'align_double_arrow' => false,
'align_equals' => false,
),
'braces' => array(
'allow_single_line_closure' => true,
'position_after_functions_and_oop_constructs' => 'next'
),
'declare_equal_normalize' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'include' => true,
'lowercase_cast' => true,
'no_extra_consecutive_blank_lines' => array(
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'throw',
'use',
),
'no_multiline_whitespace_around_double_arrow' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'single_blank_line_before_namespace' => true,
'ternary_operator_spaces' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
'method_chaining_indentation' => true,
))
->setLineEnding("\n")
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment