Skip to content

Commit b679711

Browse files
committed
Depend on main config
1 parent e9f3369 commit b679711

File tree

3 files changed

+28
-51
lines changed

3 files changed

+28
-51
lines changed

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

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
* the LICENSE file that was distributed with this source code.
1212
*/
1313

14-
use CodeIgniter\CodingStandard\CodeIgniter4;
15-
use Nexus\CsConfig\Factory;
16-
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17-
use Nexus\CsConfig\FixerGenerator;
14+
use PhpCsFixer\ConfigInterface;
1815
use PhpCsFixer\Finder;
1916

17+
/** @var ConfigInterface $config */
18+
$config = require __DIR__ . '/.php-cs-fixer.dist.php';
19+
2020
$finder = Finder::create()
2121
->files()
2222
->in([
@@ -29,15 +29,11 @@
2929
__DIR__ . '/admin/starter/builds',
3030
]);
3131

32-
$overrides = [];
33-
34-
$options = [
35-
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
36-
'finder' => $finder,
37-
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
38-
'customRules' => [
39-
NoCodeSeparatorCommentFixer::name() => true,
40-
],
32+
$overrides = [
33+
'header_comment' => false,
4134
];
4235

43-
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
36+
return $config
37+
->setFinder($finder)
38+
->setCacheFile('build/.php-cs-fixer.no-header.cache')
39+
->setRules(array_merge($config->getRules(), $overrides));

.php-cs-fixer.tests.php

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,29 @@
1111
* the LICENSE file that was distributed with this source code.
1212
*/
1313

14-
use CodeIgniter\CodingStandard\CodeIgniter4;
15-
use Nexus\CsConfig\Factory;
16-
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17-
use Nexus\CsConfig\FixerGenerator;
14+
use PhpCsFixer\ConfigInterface;
1815
use PhpCsFixer\Finder;
1916

17+
/** @var ConfigInterface $config */
18+
$config = require __DIR__ . '/.php-cs-fixer.dist.php';
19+
2020
$finder = Finder::create()
2121
->files()
2222
->in([
2323
__DIR__ . '/tests',
2424
])
25-
->exclude([
26-
])
2725
->notPath([
2826
'_support/View/Cells/multiplier.php',
2927
'_support/View/Cells/colors.php',
3028
'_support/View/Cells/addition.php',
3129
])
32-
->notName('#Foobar.php$#')
33-
->append([
34-
]);
30+
->notName('#Foobar.php$#');
3531

3632
$overrides = [
3733
'void_return' => true,
3834
];
3935

40-
$options = [
41-
'cacheFile' => 'build/.php-cs-fixer.tests.cache',
42-
'finder' => $finder,
43-
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
44-
'customRules' => [
45-
NoCodeSeparatorCommentFixer::name() => true,
46-
],
47-
];
48-
49-
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
50-
'CodeIgniter 4 framework',
51-
'CodeIgniter Foundation',
52-
'admin@codeigniter.com'
53-
);
36+
return $config
37+
->setFinder($finder)
38+
->setCacheFile('build/.php-cs-fixer.tests.cache')
39+
->setRules(array_merge($config->getRules(), $overrides));

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

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
* the LICENSE file that was distributed with this source code.
1212
*/
1313

14-
use CodeIgniter\CodingStandard\CodeIgniter4;
15-
use Nexus\CsConfig\Factory;
16-
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17-
use Nexus\CsConfig\FixerGenerator;
14+
use PhpCsFixer\ConfigInterface;
1815
use PhpCsFixer\Finder;
1916

17+
/** @var ConfigInterface $config */
18+
$config = require __DIR__ . '/.php-cs-fixer.dist.php';
19+
2020
$finder = Finder::create()
2121
->files()
2222
->in([
@@ -32,6 +32,7 @@
3232

3333
$overrides = [
3434
'echo_tag_syntax' => false,
35+
'header_comment' => false,
3536
'php_unit_internal_class' => false,
3637
'no_unused_imports' => false,
3738
'class_attributes_separation' => false,
@@ -41,13 +42,7 @@
4142
],
4243
];
4344

44-
$options = [
45-
'cacheFile' => 'build/.php-cs-fixer.user-guide.cache',
46-
'finder' => $finder,
47-
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
48-
'customRules' => [
49-
NoCodeSeparatorCommentFixer::name() => true,
50-
],
51-
];
52-
53-
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
45+
return $config
46+
->setFinder($finder)
47+
->setCacheFile('build/.php-cs-fixer.user-guide.cache')
48+
->setRules(array_merge($config->getRules(), $overrides));

0 commit comments

Comments
 (0)