-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbase.php
37 lines (30 loc) · 1.07 KB
/
base.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
$files = file(__DIR__ . '/../filelist.tmp', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$files = array_map(function ($path) {
return new SplFileInfo($path);
}, $files);
$config = new PhpCsFixer\Config;
$config->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect());
$config->registerCustomFixers([
new NetteCodingStandard\Fixer\ClassNotation\ClassAndTraitVisibilityRequiredFixer,
new NetteCodingStandard\Fixer\FunctionNotation\MethodArgumentSpaceFixer,
new NetteCodingStandard\Fixer\FunctionNotation\FunctionDeclarationFixer,
]);
$config->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers);
$config->setUsingCache(false);
$config->setIndent("\t");
$config->setLineEnding(PHP_EOL);
$config->setRiskyAllowed(true);
$config->setFinder($files);
$customRules = [];
$root = getcwd();
while (!is_file("$root/ncs.php") && substr_count($root, DIRECTORY_SEPARATOR) > 1) {
$root = dirname($root);
}
if (is_file($file = "$root/ncs.php")) {
echo "used $file\n";
$customRules = require $file;
}
$config->setRules([]);
return $config;