generated from ghostwriter/wip
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phormat.php
62 lines (58 loc) · 2.44 KB
/
phormat.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
declare(strict_types=1);
use Ghostwriter\Phormat\NodeVisitor\AddMissingThrowsDocblock;
use Ghostwriter\Phormat\NodeVisitor\ChangeToShortArrayNodeVisitor;
use Ghostwriter\Phormat\NodeVisitor\DeclareStrictTypesNodeVisitor;
use Ghostwriter\Phormat\NodeVisitor\ImportFullyQualifiedNamesNodeVisitor;
use Ghostwriter\Phormat\NodeVisitor\PERCodingStyle\PsrOneNodeVisitor;
use Ghostwriter\Phormat\NodeVisitor\SortUseStatementsAlphabeticallyNodeVisitor;
use Ghostwriter\Phormat\NodeVisitor\UseArrowFunctionsNodeVisitor;
use Ghostwriter\Phormat\PhormatConfig;
/** @var non-empty-string $workingDirectory */
$workingDirectory = \getcwd() ?: __DIR__;
/**
* @psalm-suppress UncaughtThrowInGlobalScope
*/
return PhormatConfig::new(...[
ImportFullyQualifiedNamesNodeVisitor::class,
PsrOneNodeVisitor::class,
AddMissingThrowsDocblock::class,
// PERCSNodeVisitor::class,
UseArrowFunctionsNodeVisitor::class,
ChangeToShortArrayNodeVisitor::class,
DeclareStrictTypesNodeVisitor::class,
// AddNewlineBetweenNodes::class,
// MakeClosureAndFunctionStaticNodeVisitor::class,
// RemoveNopNodeVisitor::class,
// SortClassLikeMemberStatementsAlphabeticallyNodeVisitor::class,
// SortClassLikeStatementsAlphabeticallyNodeVisitor::class,
// SortMatchExpressionsAlphabeticallyNodeVisitor::class,
// SortMatchExpressionsAlphabeticallyNodeVisitor::class,
// SortNodeVisitor::class,
SortUseStatementsAlphabeticallyNodeVisitor::class,
])
->paths(...\array_filter(
[
__FILE__,
$workingDirectory,
$workingDirectory . '/bin',
$workingDirectory . '/config',
$workingDirectory . '/data',
$workingDirectory . '/docs',
$workingDirectory . '/ecs.php',
$workingDirectory . '/index.php',
$workingDirectory . '/module',
$workingDirectory . '/phormat.php',
$workingDirectory . '/public',
$workingDirectory . '/rector.php',
$workingDirectory . '/resource',
$workingDirectory . '/src',
$workingDirectory . '/test',
$workingDirectory . '/tests',
],
static fn (string $path): bool => \file_exists($path)
))
->skip(...\array_filter(
[$workingDirectory . '/tests/Fixture', $workingDirectory . '/.cache', $workingDirectory . '/vendor'],
static fn (string $path): bool => \file_exists($path)
));