Skip to content

Commit

Permalink
升级php-cs-fixer到v2版本
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiaopei committed Mar 23, 2017
1 parent d63f56a commit de5bd3b
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 92 deletions.
88 changes: 27 additions & 61 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

$header = <<<'EOF'
This file is part of slim-swoole.
This file is part of PHP CS Fixer.
(c) kcloze <[email protected]>
This source file is subject to the MIT license that is bundled
Expand All @@ -12,69 +10,37 @@ EOF;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'header_comment' => ['header' => $header, 'separate' => 'none'],
'binary_operator_spaces' => [
'align_double_arrow' => true,
'align_equals' => true,
],
'braces' => true,
'concat_space' => ['spacing' => 'one'],
'no_empty_statement' => true,
'elseif' => true,
'simplified_null_return' => true,
'encoding' => true,
'single_blank_line_at_eof' => true,
'no_extra_consecutive_blank_lines' => true,
'no_spaces_after_function_name' => true,
'function_declaration' => true,
'indentation_type' => true,
'no_alias_functions' => true,
'blank_line_after_namespace' => true,
'line_ending' => true,
'no_trailing_comma_in_list_call' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true,
'method_argument_space' => true,
'single_import_per_statement' => true,
'no_leading_namespace_whitespace' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_spaces_inside_parenthesis' => true,
'no_closing_tag' => true,
'phpdoc_indent' => true,
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_align' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'no_extra_consecutive_blank_lines' => ['use'],
'blank_line_before_return' => true,
'self_accessor' => true,
'array_syntax' => ['syntax' => 'short'],
'full_opening_tag' => true,
'single_line_after_imports' => true,
'single_quote' => true,
'no_singleline_whitespace_before_semicolons' => true,
'cast_spaces' => true,
'ternary_operator_spaces' => true,
'no_trailing_whitespace' => true,
'trim_array_spaces' => true,
'no_unused_imports' => true,
'visibility_required' => true,
'no_whitespace_in_blank_line' => true,

'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
// one should use PHPUnit methods to set up expected exception instead of annotations
'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
'header_comment' => ['header' => $header],
'heredoc_to_nowdoc' => true,
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'psr4' => true,
'strict_comparison' => false,
'strict_param' => true,
'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
'concat_space' => ['spacing' => 'one'],
'no_empty_statement' => true,
'simplified_null_return' => true,
'no_extra_consecutive_blank_lines' => true,
'pre_increment' => false
])
->setFinder(
PhpCsFixer\Finder::create()
->files()
->exclude('vendor')
->in(__DIR__)
->name('*.php')
)
->setUsingCache(false)
;
3 changes: 1 addition & 2 deletions app/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
3 changes: 1 addition & 2 deletions app/Controllers/DefaultController.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
3 changes: 1 addition & 2 deletions app/Library/XUtils.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
3 changes: 1 addition & 2 deletions app/Models/BaseModel.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
3 changes: 1 addition & 2 deletions app/Models/Tutorial.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
3 changes: 1 addition & 2 deletions app/config/dependencies.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
3 changes: 1 addition & 2 deletions app/config/middleware.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
3 changes: 1 addition & 2 deletions app/config/routes.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
5 changes: 2 additions & 3 deletions app/config/settings.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand All @@ -28,7 +27,7 @@

//db settings
'db' => [
'database_type' => 'mysql',
'database_type' => 'mysql',
'database_name' => 'test',
'server' => '127.0.0.1',
'username' => 'root',
Expand Down
3 changes: 1 addition & 2 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
3 changes: 1 addition & 2 deletions public/server.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
3 changes: 1 addition & 2 deletions tests/functional/BaseTestCase.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
3 changes: 1 addition & 2 deletions tests/functional/HomepageTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
Expand Down
6 changes: 2 additions & 4 deletions tests/functional/TestCs.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<?php

/*
* This file is part of slim-swoole.
*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/



//before
/*$params = [
'code' => $code,
Expand Down

0 comments on commit de5bd3b

Please sign in to comment.