.php_cs.dist 2.10 KiB
<?php declare(strict_types=1);
$finder = PhpCsFixer\Finder::create()
    ->exclude(['vendor', 'reports', 'node_modules', 'app/cache', 'app/logs', '.phpstan-cache'])
    ->files()
    ->name('*.php')
    ->in(__DIR__.'/.deploy')
    ->in(__DIR__);
$loader = require_once __DIR__ . '/vendor/autoload.php';
try {
    $config = Irstea\CS\Config::create()
        ->setRiskyAllowed(true)
        ->setIndent('    ')
        ->setLineEnding("\n")
        ->setFinder($finder);
    $config->setRules([
            'header_comment' => [
                'header' => <<<EOT
Base de Données des Observatoires en Hydrologie
Copyright (C) 2012-2019 IRSTEA
Copyright (C) 2020-2021 INRAE
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
EOT
            // @TODO: corriger plutôt qu'ignorer
            'declare_strict_types' => false,
            'fopen_flags' => false,
            'function_to_constant' => false,
            'modernize_types_casting' => false,
            'native_constant_invocation' => false,
            'native_function_invocation' => false,
            'no_alias_functions' => false,
            'no_superfluous_phpdoc_tags' => false,
            'random_api_migration' => false,
            'self_accessor' => false,
            'single_line_throw' => false,
            'visibility_required' => false,
            'void_return' => false,
        ]);
    return $config;
} finally {
    // Supprime le loader une fois la config chargée
    // pour éviter des conflits de version de classes.
    $loader->unregister();