2021-07-19 21:21:30 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2021-07-19 21:32:33 +08:00
|
|
|
/**
|
|
|
|
* This file is part of CodeIgniter 4 framework.
|
|
|
|
*
|
|
|
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view
|
|
|
|
* the LICENSE file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2021-09-02 12:32:07 +08:00
|
|
|
use CodeIgniter\CodingStandard\CodeIgniter4;
|
2021-07-19 21:21:30 +08:00
|
|
|
use Nexus\CsConfig\Factory;
|
2021-09-03 20:57:36 +08:00
|
|
|
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
|
2021-09-02 12:32:07 +08:00
|
|
|
use Nexus\CsConfig\FixerGenerator;
|
2021-07-19 21:21:30 +08:00
|
|
|
use PhpCsFixer\Finder;
|
|
|
|
|
|
|
|
$finder = Finder::create()
|
|
|
|
->files()
|
|
|
|
->in([
|
|
|
|
__DIR__ . '/admin',
|
|
|
|
__DIR__ . '/app',
|
|
|
|
__DIR__ . '/public',
|
2021-09-02 12:32:07 +08:00
|
|
|
])
|
2022-08-21 14:20:28 +08:00
|
|
|
->exclude(['Views/errors/html'])
|
2021-10-29 18:23:05 +08:00
|
|
|
->append([
|
|
|
|
__DIR__ . '/admin/starter/builds',
|
|
|
|
]);
|
2021-07-19 21:21:30 +08:00
|
|
|
|
2023-07-17 16:30:13 +08:00
|
|
|
$overrides = [
|
2023-07-06 11:44:39 +08:00
|
|
|
'php_unit_data_provider_name' => [
|
|
|
|
'prefix' => 'provide',
|
|
|
|
'suffix' => '',
|
|
|
|
],
|
2023-08-03 18:13:11 +08:00
|
|
|
'php_unit_data_provider_static' => true,
|
2023-07-17 16:30:13 +08:00
|
|
|
'php_unit_data_provider_return_type' => true,
|
2023-07-21 17:58:53 +08:00
|
|
|
'no_extra_blank_lines' => [
|
|
|
|
'tokens' => [
|
|
|
|
'attribute',
|
|
|
|
'break',
|
|
|
|
'case',
|
|
|
|
'continue',
|
|
|
|
'curly_brace_block',
|
|
|
|
'default',
|
|
|
|
'extra',
|
|
|
|
'parenthesis_brace_block',
|
|
|
|
'return',
|
|
|
|
'square_brace_block',
|
|
|
|
'switch',
|
|
|
|
'throw',
|
|
|
|
'use',
|
|
|
|
],
|
|
|
|
],
|
2023-07-17 16:30:13 +08:00
|
|
|
];
|
2021-07-19 21:21:30 +08:00
|
|
|
|
|
|
|
$options = [
|
2023-07-18 17:25:10 +08:00
|
|
|
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
|
|
|
|
'finder' => $finder,
|
2021-07-19 21:21:30 +08:00
|
|
|
];
|
|
|
|
|
2023-07-18 17:25:10 +08:00
|
|
|
$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
|
|
|
|
|
|
|
|
// @TODO: remove this check when support for PHP 7.4 is dropped
|
|
|
|
if (PHP_VERSION_ID >= 80000) {
|
|
|
|
$config
|
|
|
|
->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'))
|
|
|
|
->setRules(array_merge($config->getRules(), [
|
|
|
|
NoCodeSeparatorCommentFixer::name() => true,
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $config;
|