Skip to content

Instantly share code, notes, and snippets.

@diego1araujo
Forked from laravel-shift/.php-cs-fixer.php
Last active October 27, 2019 14:52
Show Gist options
  • Save diego1araujo/5ec34838bc49c2c9edae26b11c181651 to your computer and use it in GitHub Desktop.
Save diego1araujo/5ec34838bc49c2c9edae26b11c181651 to your computer and use it in GitHub Desktop.
PHP CS Fixer - Laravel Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'@PSR2' => true,
'@Symfony' => true,
'concat_space' => ['spacing' => 'one'],
'phpdoc_align' => ['align' => 'left'],
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'linebreak_after_opening_tag' => true,
'multiline_whitespace_before_semicolons' => true,
'no_unreachable_default_argument_value' => true,
'not_operator_with_successor_space' => true,
'simplified_null_return' => true,
'array_indentation' => true,
'fully_qualified_strict_types' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'yoda_style' => false,
'no_empty_comment' => false,
'single_trait_insert_per_statement' => false,
'phpdoc_no_empty_return' => false,
'no_unused_imports' => false,
];
$finder = Finder::create()
->notPath('bootstrap')
->notPath('storage')
->notPath('vendor')
->in(getcwd())
->name('*.php')
->notName('*.blade.php')
->notName('index.php')
->notName('server.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
return Config::create()
->setFinder($finder)
->setRules($rules)
->setRiskyAllowed(true)
->setUsingCache(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment