Skip to content

Commit 848a723

Browse files
committed
chore: add .user-guide.php-cs-fixer.dist.php and update composer cs-fix
1 parent d8cfcf4 commit 848a723

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
->append([
3131
__FILE__,
3232
__DIR__ . '/.no-header.php-cs-fixer.dist.php',
33+
__DIR__ . '/.user-guide.php-cs-fixer.dist.php',
3334
__DIR__ . '/rector.php',
3435
__DIR__ . '/spark',
3536
__DIR__ . '/user_guide_src/renumerate.php',

.user-guide.php-cs-fixer.dist.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of CodeIgniter 4 framework.
7+
*
8+
* (c) CodeIgniter Foundation <admin@codeigniter.com>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
use CodeIgniter\CodingStandard\CodeIgniter4;
15+
use Nexus\CsConfig\Factory;
16+
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17+
use Nexus\CsConfig\Fixer\Comment\SpaceAfterCommentStartFixer;
18+
use Nexus\CsConfig\FixerGenerator;
19+
use PhpCsFixer\Finder;
20+
21+
$finder = Finder::create()
22+
->files()
23+
->in([
24+
__DIR__ . '/user_guide_src/source',
25+
])
26+
->notPath([
27+
'ci3sample/',
28+
'libraries/sessions/017.php',
29+
]);
30+
31+
$overrides = [
32+
'echo_tag_syntax' => false,
33+
'php_unit_internal_class' => false,
34+
'no_unused_imports' => false,
35+
'class_attributes_separation' => false,
36+
];
37+
38+
$options = [
39+
'cacheFile' => 'build/.user-guide.php-cs-fixer.cache',
40+
'finder' => $finder,
41+
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
42+
'customRules' => [
43+
NoCodeSeparatorCommentFixer::name() => true,
44+
SpaceAfterCommentStartFixer::name() => true,
45+
],
46+
];
47+
48+
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@
6262
"analyze": "phpstan analyse",
6363
"test": "phpunit",
6464
"cs": [
65+
"php-cs-fixer fix --verbose --dry-run --diff --config=.user-guide.php-cs-fixer.dist.php",
6566
"php-cs-fixer fix --verbose --dry-run --diff --config=.no-header.php-cs-fixer.dist.php",
6667
"php-cs-fixer fix --verbose --dry-run --diff"
6768
],
6869
"cs-fix": [
70+
"php-cs-fixer fix --verbose --diff --config=.user-guide.php-cs-fixer.dist.php",
6971
"php-cs-fixer fix --verbose --diff --config=.no-header.php-cs-fixer.dist.php",
7072
"php-cs-fixer fix --verbose --diff"
7173
]

0 commit comments

Comments
 (0)