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.

Revisions

  1. tplesnar created this gist Feb 4, 2023.
    45 changes: 45 additions & 0 deletions .php-cs-fixer.dist.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    <?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);