Skip to content

Instantly share code, notes, and snippets.

@tplesnar
Created February 4, 2023 21:02
Show Gist options
  • Save tplesnar/1555c3fc6bf45fbc837fd9dec368c2a6 to your computer and use it in GitHub Desktop.
Save tplesnar/1555c3fc6bf45fbc837fd9dec368c2a6 to your computer and use it in GitHub Desktop.
PHP cs fixer config
<?php
declare(strict_types=1);
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'@PHP74Migration' => true,
'@PHP74Migration:risky' => true,
'@PHPUnit75Migration:risky' => true,
'@PHP80Migration:risky' => true,
'@PHP82Migration' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], // one should use PHPUnit built-in method instead
'modernize_strpos' => true, // needs PHP 8+ or polyfill
'no_useless_concat_operator' => [
'juggle_simple_strings' => true,
],
'declare_parentheses' => true,
'declare_strict_types' => true,
];
$finder = Finder::create()
->in([
__DIR__ . '/app',
__DIR__ . '/config',
__DIR__ . '/database',
__DIR__ . '/resources',
__DIR__ . '/routes',
__DIR__ . '/tests',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
return (new Config())
->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