Skip to content

Instantly share code, notes, and snippets.

@dib258
Created February 4, 2022 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dib258/9d6a3e8dddf9e0fbdba250a890c3b700 to your computer and use it in GitHub Desktop.
Save dib258/9d6a3e8dddf9e0fbdba250a890c3b700 to your computer and use it in GitHub Desktop.
PHP-CS-Fixer Remote config file to lint with Github Action
<?php
$rules = [
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
'single_trait_insert_per_statement' => true,
];
$finder = Symfony\Component\Finder\Finder::create()
->notPath('bootstrap/*')
->notPath('storage/*')
->notPath('vendor')
->in([
__DIR__ . '/app',
__DIR__ . '/tests',
__DIR__ . '/database',
__DIR__ . '/config',
__DIR__ . '/routes',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
return (new PhpCsFixer\Config())
->setUsingCache(false)
->setRules($rules)
->setIndent(' ')
->setLineEnding("\n")
->setFinder($finder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment