Skip to content

Commit

Permalink
Update php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed May 4, 2021
1 parent f2b4ea4 commit cbb3f4c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 44 deletions.
88 changes: 46 additions & 42 deletions .cs.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,51 @@
<?php

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setUsingCache(false)
->setRiskyAllowed(true)
//->setCacheFile(__DIR__ . '/.php_cs.cache')
->setRules([
'@PSR1' => true,
'@PSR2' => true,
'@Symfony' => true,
'psr4' => true,
// custom rules
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'], // psr-5
'phpdoc_to_comment' => false,
'no_superfluous_phpdoc_tags' => false,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'cast_spaces' => ['space' => 'none'],
'concat_space' => ['spacing' => 'one'],
'compact_nullable_typehint' => true,
'declare_equal_normalize' => ['space' => 'single'],
'increment_style' => ['style' => 'post'],
'list_syntax' => ['syntax' => 'short'],
'no_short_echo_tag' => true,
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
'phpdoc_align' => false,
'phpdoc_no_empty_return' => false,
'phpdoc_order' => true, // psr-5
'phpdoc_no_useless_inheritdoc' => false,
'protected_to_private' => false,
'yoda_style' => false,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['class', 'const', 'function']
],
'single_line_throw' => false,
])
->setFinder(PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->notName('actual.php')
->notName('newtable.php')
->notName('newtable_expected.php')
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true));
->setRules(
[
'@PSR1' => true,
'@PSR2' => true,
'@Symfony' => true,
'psr_autoloading' => true,
// custom rules
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'], // psr-5
'phpdoc_to_comment' => false,
'no_superfluous_phpdoc_tags' => false,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'cast_spaces' => ['space' => 'none'],
'concat_space' => ['spacing' => 'one'],
'compact_nullable_typehint' => true,
'declare_equal_normalize' => ['space' => 'single'],
'increment_style' => ['style' => 'post'],
'list_syntax' => ['syntax' => 'short'],
'echo_tag_syntax' => ['format' => 'long'],
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
'phpdoc_align' => false,
'phpdoc_no_empty_return' => false,
'phpdoc_order' => true, // psr-5
'phpdoc_no_useless_inheritdoc' => false,
'protected_to_private' => false,
'yoda_style' => false,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['class', 'const', 'function']
],
'single_line_throw' => false,
]
)
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->notName('actual.php')
->notName('newtable.php')
->notName('newtable_expected.php')
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true)
);
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"symfony/polyfill-php73": "^1.18"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16 || ^3.0",
"friendsofphp/php-cs-fixer": "^3.0",
"overtrue/phplint": "^1.1 || ^2.0",
"phpstan/phpstan": "^0.12",
"phpunit/phpunit": "^8 || ^9",
Expand Down Expand Up @@ -52,7 +52,7 @@
"@phpstan",
"@test:coverage"
],
"cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --diff-format=udiff --config=.cs.php",
"cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php",
"cs:fix": "php-cs-fixer fix --config=.cs.php",
"lint": "phplint ./ --exclude=vendor --no-interaction --no-cache",
"phpstan": "phpstan analyse src tests --level=max -c phpstan.neon --no-progress --ansi",
Expand Down

0 comments on commit cbb3f4c

Please sign in to comment.