Skip to content

Commit c18b692

Browse files
committed
Split config files into which has headers or not
1 parent a6cfb8c commit c18b692

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

.no-header.php-cs-fixer.dist.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Nexus\CsConfig\Factory;
6+
use PhpCsFixer\Finder;
7+
use Utils\PhpCsFixer\CodeIgniter4;
8+
9+
$finder = Finder::create()
10+
->files()
11+
->in([
12+
__DIR__ . '/admin',
13+
__DIR__ . '/app',
14+
__DIR__ . '/public',
15+
]);
16+
17+
$overrides = [
18+
'no_blank_lines_after_phpdoc' => false,
19+
];
20+
21+
$options = [
22+
'cacheFile' => 'build/.no-header.php-cs-fixer.cache',
23+
'finder' => $finder,
24+
];
25+
26+
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();

.php-cs-fixer.dist.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
$finder = Finder::create()
1010
->files()
1111
->in([
12-
__DIR__ . '/admin', // @todo relocate when `header_comment` is enabled
13-
__DIR__ . '/app', // @todo relocate when `header_comment` is enabled
14-
__DIR__ . '/public', // @todo relocate when `header_comment` is enabled
1512
__DIR__ . '/system',
1613
__DIR__ . '/tests',
1714
__DIR__ . '/utils',
@@ -20,6 +17,7 @@
2017
->notName('#Foobar.php$#')
2118
->append([
2219
__FILE__,
20+
__DIR__ . '/.no-header.php-cs-fixer.dist.php',
2321
__DIR__ . '/rector.php',
2422
__DIR__ . '/spark',
2523
]);
@@ -31,5 +29,8 @@
3129
'finder' => $finder,
3230
];
3331

34-
// @todo change to `forLibrary()` when `header_comment` is enabled
35-
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
32+
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
33+
'CodeIgniter 4 framework',
34+
'CodeIgniter Foundation',
35+
36+
);

utils/PhpCsFixer/CodeIgniter4.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct()
2020
$this->rules = [
2121
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'],
2222
'array_indentation' => true,
23-
'array_push' => true, // risky
23+
'array_push' => true,
2424
'array_syntax' => ['syntax' => 'short'],
2525
'backtick_to_shell_exec' => true,
2626
'binary_operator_spaces' => [
@@ -196,7 +196,7 @@ public function __construct()
196196
'no_alternative_syntax' => false,
197197
'no_binary_string' => true,
198198
'no_blank_lines_after_class_opening' => true,
199-
'no_blank_lines_after_phpdoc' => false, // @todo enable fully when `header_comment` is required
199+
'no_blank_lines_after_phpdoc' => true,
200200
'no_blank_lines_before_namespace' => false, // conflicts with `single_blank_line_before_namespace`
201201
'no_break_comment' => ['comment_text' => 'no break'],
202202
'no_closing_tag' => true,

0 commit comments

Comments
 (0)