-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpstan.neon
105 lines (98 loc) · 4.98 KB
/
phpstan.neon
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
parameters:
level: max
paths:
- src
- tests
strictRules:
booleansInConditions: false
ignoreErrors:
# Since it is not possible to disable single subrule of "DisallowedConstructs" the errors thrown by "DisallowedShortTernaryRule" are just ignored
- '#Short ternary operator is not allowed. Use null coalesce operator if applicable or consider using long ternary.#'
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/symplify/phpstan-rules/config/services/services.neon
rules:
- Symplify\PHPStanRules\Rules\BoolishClassMethodPrefixRule
- Symplify\PHPStanRules\Rules\CheckClassNamespaceFollowPsr4Rule
- Symplify\PHPStanRules\Rules\CheckTypehintCallerTypeRule
- Symplify\PHPStanRules\Rules\Complexity\ForbiddenSameNamedNewInstanceRule
- Symplify\PHPStanRules\Rules\Domain\RequireAttributeNamespaceRule
- Symplify\PHPStanRules\Rules\Domain\RequireExceptionNamespaceRule
- Symplify\PHPStanRules\Rules\Enum\RequireUniqueEnumConstantRule
- Symplify\PHPStanRules\Rules\Explicit\NoMixedMethodCallerRule
- Symplify\PHPStanRules\Rules\Explicit\NoMixedPropertyFetcherRule
- Symplify\PHPStanRules\Rules\Explicit\NoRelativeFilePathRule
- Symplify\PHPStanRules\Rules\ForbiddenExtendOfNonAbstractClassRule
- Symplify\PHPStanRules\Rules\ForbiddenMultipleClassLikeInOneFileRule
- Symplify\PHPStanRules\Rules\ForbiddenParamTypeRemovalRule
- Symplify\PHPStanRules\Rules\NarrowType\NarrowPublicClassMethodParamTypeByCallerTypeRule
- Symplify\PHPStanRules\Rules\NoAbstractMethodRule
- Symplify\PHPStanRules\Rules\NoArrayAccessOnObjectRule
- Symplify\PHPStanRules\Rules\NoDynamicNameRule
- Symplify\PHPStanRules\Rules\NoEmptyClassRule
- Symplify\PHPStanRules\Rules\NoInlineStringRegexRule
- Symplify\PHPStanRules\Rules\NoIssetOnObjectRule
- Symplify\PHPStanRules\Rules\NoMissingDirPathRule
- Symplify\PHPStanRules\Rules\NoNullableArrayPropertyRule
- Symplify\PHPStanRules\Rules\NoReferenceRule
- Symplify\PHPStanRules\Rules\NoVoidGetterMethodRule
- Symplify\PHPStanRules\Rules\PreventParentMethodVisibilityOverrideRule
- Symplify\PHPStanRules\Rules\RegexSuffixInRegexConstantRule
- Symplify\PHPStanRules\Rules\RequireAttributeNameRule
- Symplify\PHPStanRules\Rules\UppercaseConstantRule
services:
-
class: Symplify\PHPStanRules\Rules\NoDuplicatedShortClassNameRule
tags: [phpstan.rules.rule]
arguments:
toleratedNestingLevel: 3
-
class: Symplify\PHPStanRules\ObjectCalisthenics\Rules\NoShortNameRule
tags: [phpstan.rules.rule]
arguments:
minNameLength: 3
allowedShortNames: [fd, i, io, j, ts, x, y]
-
class: Symplify\PHPStanRules\Rules\ForbiddenNodeRule
tags: [phpstan.rules.rule]
arguments:
forbiddenNodes:
- PhpParser\Node\Expr\Empty_
- PhpParser\Node\Stmt\Switch_
- PhpParser\Node\Expr\ErrorSuppress
- PhpParser\Node\Scalar\Encapsed
- PhpParser\Node\Scalar\EncapsedStringPart
- PhpParser\Node\Expr\PostInc
- PhpParser\Node\Expr\PostDec
-
class: Symplify\PHPStanRules\Rules\PreferredClassRule
tags: [phpstan.rules.rule]
arguments:
oldToPreferredClasses:
Carbon\Carbon: Carbon\CarbonImmutable
DateTime: DateTimeImmutable
PhpCsFixer\Finder: Symfony\Component\Finder
-
class: Symplify\PHPStanRules\Rules\ForbiddenFuncCallRule
tags: [phpstan.rules.rule]
arguments:
forbiddenFunctions:
compact: 'Explictly assign to keys in the array'
curl_*: 'Use Symfony\Contracts\HttpClient\HttpClientInterface instead'
dd: 'Please remove all debug functions, use a logger if needed'
dump: 'Please remove all debug functions, use a logger if needed'
extract: 'Explictly define variables for the values in the array'
file_get_contents: 'Use Symfony\\Component\\Finder\\SplFileInfo::getContents() instead'
file_put_contents: 'Use Symfony\\Component\\Filesystem::dumpFile() or Symfony\\Component\\Filesystem::appendToFile() instead'
json_decode: 'Use Symfony\\Component\\Serializer\\Encoder\\JsonEncoder::decode() instead'
json_encode: 'Use Symfony\\Component\\Serializer\\Encoder\\JsonEncoder::encode() instead'
method_exists: 'Create an interface instead and add an instanceof check here'
preg_match_all: 'Use Symfony\\Component\\String\\UnicodeString::match() instead'
preg_match: 'Use Symfony\\Component\\String\\UnicodeString::match() instead'
preg_replace_callback: 'Use Symfony\\Component\\String\\UnicodeString::replaceMatches() instead'
preg_replace: 'Use Symfony\\Component\\String\\UnicodeString::replaceMatches() instead'
preg_split: 'Use Symfony\\Component\\String\\UnicodeString::split() instead'
spl_autoload_register: 'Don''t try to handle autoloading yourself'
spl_autoload_unregister: 'Don''t try to handle autoloading yourself'
str_replace: 'Use Symfony\\Component\\String\\UnicodeString::replace() instead'
var_dump: 'Please remove all debug functions, use a logger if needed'