Last active
June 21, 2017 03:58
-
-
Save ricogoh/9061c4520927089e7b24f41c2146c10e to your computer and use it in GitHub Desktop.
PHP Coding Standards Fixer setting for Laravel 5 on FriendsOfPHP/PHP-CS-Fixer 1.*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP Coding Standards Fixer setting for Laravel 5 on FriendsOfPHP/PHP-CS-Fixer 1.* | |
* Rules with psr1, psr2, phpdoc and some symfony rules. | |
* Remove psr0. | |
* Rules only apply directory and sub-directory inside "app". | |
* | |
* Save script to .php_cs and place .php_cs file in the root of your Laravel project | |
* | |
* Requirement: | |
* composer require FriendsOfPHP/PHP-CS-Fixer@1.* --dev | |
* | |
* Run with command: | |
* ./vendor/bin/php-cs-fixer fix --config-file=.php_cs --verbose | |
* ./vendor/bin/php-cs-fixer fix /path/to/your/file_or_dir --config-file=.php_cs --verbose | |
* | |
* With composer: | |
* Add below lines to composer.json | |
* "scripts": { | |
* "php-fixer": [ | |
* "php-cs-fixer fix --config-file=.php_cs --verbose" | |
* ] | |
* } | |
* | |
* then run | |
* composer run php-fixer | |
*/ | |
$fixers = [ | |
'blankline_after_open_tag', | |
'braces', | |
'class_definition', | |
'concat_without_spaces', | |
'double_arrow_multiline_whitespaces', | |
'duplicate_semicolon', | |
'elseif', | |
'empty_return', | |
'encoding', | |
'eof_ending', | |
'extra_empty_lines', | |
'function_call_space', | |
'function_declaration', | |
'include', | |
'indentation', | |
'join_function', | |
'line_after_namespace', | |
'linefeed', | |
'list_commas', | |
'logical_not_operators_with_successor_space', | |
'lowercase_constants', | |
'lowercase_keywords', | |
'method_argument_space', | |
'multiline_array_trailing_comma', | |
'multiline_spaces_before_semicolon', | |
'multiple_use', | |
'namespace_no_leading_whitespace', | |
'no_blank_lines_after_class_opening', | |
'no_empty_lines_after_phpdocs', | |
'no_trailing_whitespace_in_comment', | |
'object_operator', | |
'operators_spaces', | |
'parenthesis', | |
'php_closing_tag', | |
'phpdoc_indent', | |
'phpdoc_inline_tag', | |
'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', | |
'short_array_syntax', | |
'short_echo_tag', | |
'short_tag', | |
'single_array_no_trailing_comma', | |
'single_blank_line_before_namespace', | |
'single_line_after_imports', | |
'single_quote', | |
'spaces_before_semicolon', | |
'spaces_cast', | |
'standardize_not_equal', | |
'switch_case_semicolon_to_colon', | |
'switch_case_space', | |
'ternary_spaces', | |
'trailing_spaces', | |
'trim_array_spaces', | |
'unalign_equals', | |
'unary_operators_spaces', | |
'unused_use', | |
'visibility', | |
'whitespacy_lines', | |
'-psr0', | |
]; | |
return Symfony\CS\Config::create() | |
->fixers($fixers) | |
->finder( | |
Symfony\CS\Finder::create() | |
->name('*.php') | |
->notName('*.blade.php') | |
->in(__DIR__.'/app/') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment