123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php
- $header = <<<'EOF'
- This file is part of the Jiannei/lumen-api-starter.
- (c) Jiannei <longjian.huang@foxmail.com>
- This source file is subject to the MIT license that is bundled
- with this source code in the file LICENSE.
- EOF;
- $finder = PhpCsFixer\Finder::create()
- ->exclude('vendor')
- ->exclude('tests/Fixtures')
- ->in(__DIR__)
- ->append([__DIR__.'/php-cs-fixer']);
- $rules = [
- '@PSR2' => true,
-
- 'phpdoc_add_missing_param_annotation' => ['only_untyped'=>false],
-
- 'phpdoc_order' => false,
-
- 'phpdoc_separation' => false,
-
- 'no_binary_string' => 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_comment' => true,
-
- 'no_empty_phpdoc' => true,
-
- 'no_empty_statement' => true,
-
- 'no_extra_blank_lines' => true,
-
- 'no_leading_import_slash' => true,
-
- 'no_leading_namespace_whitespace' => true,
-
- 'no_mixed_echo_print' => true,
-
- 'no_multiline_whitespace_around_double_arrow' => true,
-
- 'no_short_bool_cast' => true,
-
- 'no_short_echo_tag' => true,
-
- 'no_singleline_whitespace_before_semicolons' => true,
-
- 'no_spaces_after_function_name' => true,
-
- 'no_spaces_around_offset' => true,
-
- 'no_spaces_inside_parenthesis' => true,
-
- 'no_superfluous_elseif' => true,
-
- 'array_syntax' => ['syntax'=>'short'],
-
- 'binary_operator_spaces' => true,
-
- 'blank_line_after_namespace' => true,
-
- 'blank_line_after_opening_tag' => true,
-
- 'blank_line_before_statement' => true,
-
- 'braces' => true,
-
- 'cast_spaces' => true,
-
- 'class_attributes_separation' => true,
-
- 'class_definition' => true,
-
- 'concat_space' => true,
-
- 'constant_case' => true,
-
- 'declare_equal_normalize' => ['space'=>'single'],
-
- 'elseif' => true,
-
- 'encoding' => true,
-
- 'align_multiline_comment' => true,
-
- 'array_indentation' => true,
-
- 'combine_consecutive_issets' => true,
-
- 'combine_consecutive_unsets' => true,
-
- 'compact_nullable_typehint' => true,
-
- 'escape_implicit_backslashes' => true,
-
- 'backtick_to_shell_exec' => true,
-
- 'ordered_class_elements' => ['sortAlgorithm'=>'alpha'],
- 'header_comment' => ['header' => $header],
- ];
- $config = PhpCsFixer\Config::create()
- ->setRiskyAllowed(true)
- ->setRules($rules)
- ->setFinder($finder);
- return $config;
|