Skip to content

Instantly share code, notes, and snippets.

@antonshell
Created April 7, 2021 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save antonshell/d7a819ab58f0a48c0b29a8d2110f4814 to your computer and use it in GitHub Desktop.
Save antonshell/d7a819ab58f0a48c0b29a8d2110f4814 to your computer and use it in GitHub Desktop.
PHP-CS-Fixer configuration for symfony project. Related post: https://antonshell.me/post/php-cs-fixer
<?php
declare(strict_types=1);
$finder = PhpCsFixer\Finder::create()
->exclude('Migrations')
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests');
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@PHP71Migration:risky' => true,
'concat_space' => ['spacing' => 'one'],
'psr0' => false,
'array_syntax' => ['syntax' => 'short'],
'class_definition' => ['multiLineExtendsEachSingleLine' => true],
'no_useless_else' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'phpdoc_add_missing_param_annotation' => ['only_untyped' => true],
'no_short_echo_tag' => true,
'list_syntax' => ['syntax' => 'short'],
'linebreak_after_opening_tag' => true,
'void_return' => false,
'phpdoc_summary' => false,
'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'],
'visibility_required' => ['property', 'method', 'const'],
])
->setCacheFile(__DIR__ . '/.php_cs.cache')
->setFinder($finder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment