Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more php-cs-fixer rules and cleanup accordingly
- add additional rules and sort all alphabetically - fix code broken by new rules - cleanup .php_cs.dist file and align with cs standards - add .php_cs.cache to .gitignore
- Loading branch information
1 parent
597f204
commit 2c62b7f
Showing
5 changed files
with
89 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
/.idea/ | ||
/.php_cs.cache | ||
/bin/ | ||
/phpunit.xml | ||
/composer.lock | ||
/composer.phar | ||
/vendor/ | ||
/Tests/Functional/app/web/media/cache | ||
/phpunit.xml | ||
/Tests/Functional/app/public/media/cache | ||
/.idea/ | ||
/Tests/Functional/app/web/media/cache | ||
/var/ | ||
/vendor/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,86 @@ | ||
<?php | ||
|
||
$fileHeaderComment = <<<COMMENT | ||
/* | ||
* This file is part of the `liip/LiipImagineBundle` project. | ||
* | ||
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use PhpCsFixer\Config; | ||
use PhpCsFixer\Finder; | ||
|
||
$header = <<<HEADER | ||
This file is part of the `liip/LiipImagineBundle` project. | ||
(c) https://github.com/liip/LiipImagineBundle/graphs/contributors | ||
For the full copyright and license information, please view the LICENSE.md | ||
file that was distributed with this source code. | ||
COMMENT; | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__) | ||
->ignoreDotFiles(true) | ||
->ignoreVCS(true) | ||
->exclude(array('build', 'vendor')) | ||
->files() | ||
->name('*.php') | ||
; | ||
HEADER; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setFinder($finder) | ||
return Config::create() | ||
->setUsingCache(true) | ||
->setRiskyAllowed(true) | ||
->setFinder((new Finder())->in(__DIR__)) | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'@PHPUnit57Migration:risky' => true, | ||
'array_syntax' => [ | ||
'syntax' => 'short' | ||
], | ||
'combine_consecutive_issets' => true, | ||
'combine_consecutive_unsets' => true, | ||
'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'], | ||
'escape_implicit_backslashes' => true, | ||
'explicit_indirect_variable' => true, | ||
'final_internal_class' => true, | ||
'header_comment' => [ | ||
'header' => $header, | ||
'separate' => 'both' | ||
], | ||
'heredoc_to_nowdoc' => true, | ||
'linebreak_after_opening_tag' => true, | ||
'list_syntax' => [ | ||
'syntax' => 'short', | ||
], | ||
'mb_str_functions' => true, | ||
'multiline_whitespace_before_semicolons' => [ | ||
'strategy' => 'no_multi_line', | ||
], | ||
'no_php4_constructor' => true, | ||
'no_short_echo_tag' => true, | ||
'no_unreachable_default_argument_value' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'ordered_class_elements' => [ | ||
'order' => [ | ||
'use_trait', | ||
'constant_public', | ||
'constant_protected', | ||
'constant_private', | ||
'property_public', | ||
'property_protected', | ||
'property_private', | ||
'construct', | ||
'destruct', | ||
'magic', | ||
'phpunit', | ||
'method_public', | ||
'method_protected', | ||
'method_private' | ||
], | ||
], | ||
'ordered_imports' => true, | ||
'php_unit_strict' => true, | ||
'php_unit_no_expectation_annotation' => true, | ||
'php_unit_test_class_requires_covers' => true, | ||
'phpdoc_order' => true, | ||
'phpdoc_summary' => false, | ||
'psr4' => true, | ||
'semicolon_after_instruction' => true, | ||
'strict_comparison' => true, | ||
'strict_param' => true, | ||
]) | ||
->setFinder($finder) | ||
->setUsingCache(true) | ||
; | ||
]); |
This file contains 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
This file contains 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
This file contains 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