Depend on main config

This commit is contained in:
John Paul E. Balandan, CPA 2024-07-09 12:58:32 +08:00
parent e9f3369151
commit b679711915
No known key found for this signature in database
GPG Key ID: 697D84680E3738DA
3 changed files with 28 additions and 51 deletions

View File

@ -11,12 +11,12 @@ declare(strict_types=1);
* the LICENSE file that was distributed with this source code.
*/
use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
use Nexus\CsConfig\FixerGenerator;
use PhpCsFixer\ConfigInterface;
use PhpCsFixer\Finder;
/** @var ConfigInterface $config */
$config = require __DIR__ . '/.php-cs-fixer.dist.php';
$finder = Finder::create()
->files()
->in([
@ -29,15 +29,11 @@ $finder = Finder::create()
__DIR__ . '/admin/starter/builds',
]);
$overrides = [];
$options = [
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
'finder' => $finder,
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
'customRules' => [
NoCodeSeparatorCommentFixer::name() => true,
],
$overrides = [
'header_comment' => false,
];
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
return $config
->setFinder($finder)
->setCacheFile('build/.php-cs-fixer.no-header.cache')
->setRules(array_merge($config->getRules(), $overrides));

View File

@ -11,43 +11,29 @@ declare(strict_types=1);
* the LICENSE file that was distributed with this source code.
*/
use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
use Nexus\CsConfig\FixerGenerator;
use PhpCsFixer\ConfigInterface;
use PhpCsFixer\Finder;
/** @var ConfigInterface $config */
$config = require __DIR__ . '/.php-cs-fixer.dist.php';
$finder = Finder::create()
->files()
->in([
__DIR__ . '/tests',
])
->exclude([
])
->notPath([
'_support/View/Cells/multiplier.php',
'_support/View/Cells/colors.php',
'_support/View/Cells/addition.php',
])
->notName('#Foobar.php$#')
->append([
]);
->notName('#Foobar.php$#');
$overrides = [
'void_return' => true,
];
$options = [
'cacheFile' => 'build/.php-cs-fixer.tests.cache',
'finder' => $finder,
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
'customRules' => [
NoCodeSeparatorCommentFixer::name() => true,
],
];
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
'CodeIgniter 4 framework',
'CodeIgniter Foundation',
'admin@codeigniter.com'
);
return $config
->setFinder($finder)
->setCacheFile('build/.php-cs-fixer.tests.cache')
->setRules(array_merge($config->getRules(), $overrides));

View File

@ -11,12 +11,12 @@ declare(strict_types=1);
* the LICENSE file that was distributed with this source code.
*/
use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
use Nexus\CsConfig\FixerGenerator;
use PhpCsFixer\ConfigInterface;
use PhpCsFixer\Finder;
/** @var ConfigInterface $config */
$config = require __DIR__ . '/.php-cs-fixer.dist.php';
$finder = Finder::create()
->files()
->in([
@ -32,6 +32,7 @@ $finder = Finder::create()
$overrides = [
'echo_tag_syntax' => false,
'header_comment' => false,
'php_unit_internal_class' => false,
'no_unused_imports' => false,
'class_attributes_separation' => false,
@ -41,13 +42,7 @@ $overrides = [
],
];
$options = [
'cacheFile' => 'build/.php-cs-fixer.user-guide.cache',
'finder' => $finder,
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
'customRules' => [
NoCodeSeparatorCommentFixer::name() => true,
],
];
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
return $config
->setFinder($finder)
->setCacheFile('build/.php-cs-fixer.user-guide.cache')
->setRules(array_merge($config->getRules(), $overrides));