generated from mimmi20/template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
phpstan.neon
178 lines (135 loc) · 6.24 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
parameters:
level: 8
phpVersion: 80300 # PHP 8.3
parallel:
maximumNumberOfProcesses: 1
processTimeout: 200.0
paths:
- src
- tests
scanFiles:
- %currentWorkingDirectory%/vendor/autoload.php
- %currentWorkingDirectory%/vendor/squizlabs/php_codesniffer/autoload.php
- %currentWorkingDirectory%/vendor/squizlabs/php_codesniffer/src/Util/Tokens.php
# reports occurrences of type-checking functions always evaluated to true
checkAlwaysTrueCheckTypeFunctionCall: true
# reports instanceof occurrences always evaluated to true
checkAlwaysTrueInstanceof: true
# reports === and !== occurrences always evaluated to true
checkAlwaysTrueStrictComparison: true
# enable stricter analysis of benevolent union types
checkBenevolentUnionTypes: true
# reports use of dynamic properties as undefined
checkDynamicProperties: true
# reports code paths with missing return statement in functions and methods with @return mixed PHPDoc
checkExplicitMixedMissingReturn: true
# reports function and method calls with incorrect name case
checkFunctionNameCase: true
# be strict about values with an unspecified (implicit mixed) type
checkImplicitMixed: false # todo: fix
# reports references to built-in classes with incorrect name case
checkInternalClassCaseSensitivity: true
# require that callable signatures are specified
checkMissingCallableSignature: true
# checks for missing typehints in iterables
checkMissingIterableValueType: true
# reports return typehints that could be narrowed down because some of the listed types are never returned
checkTooWideReturnTypesInProtectedAndPublicMethods: true
# reports properties with native types that weren’t initialized in the class constructor
checkUninitializedProperties: true
# reports missing #[\Override] attribute
checkMissingOverrideMethodAttribute: true
# doesn’t require typehints for properties if the types can be inferred from constructor injection
inferPrivatePropertyTypeFromConstructor: false
# prevents reading key and value variables set in foreach when iterating over a non-empty array
polluteScopeWithAlwaysIterableForeach: false
# prevents reading variables set in for loop initial statement and while loop condition after the loop
polluteScopeWithLoopInitialAssignments: false
# report always true last condition in a series of elseif branches and match expression arms
reportAlwaysTrueInLastCondition: true
# reports violations of parameter type contravariance and return type covariance
reportMaybesInMethodSignatures: false # todo: fix
# reports violations of property type invariance
reportMaybesInPropertyPhpDocTypes: true
# reports violations of parameter type contravariance and return type covariance in static methods
reportStaticMethodSignatures: true
#
reportWrongPhpDocTypeInVarTag: true
# differentiate between PHPDoc and native types (if false)
treatPhpDocTypesAsCertain: false
tipsOfTheDay: false
exceptions:
implicitThrows: false
checkedExceptionRegexes:
- '#Exception#'
- '#Throwable#'
check:
missingCheckedExceptionInThrows: true
tooWideThrowType: true
cognitive_complexity:
class: 26
function: 26
type_coverage:
return_type: 99.9
param_type: 92.3
property_type: 100
constant_type: 100
# also, how many files has declare strict types
declare: 100
unused_public:
methods: true
properties: true
constants: true
local_methods: false
type_perfect:
null_over_false: true
no_mixed: false
narrow_param: true
ignoreErrors:
- '~Call to an undefined method Laminas\\ModuleManager\\ModuleManagerInterface::getEvent~'
- '~MongoDB\\Client~'
- '~Call to deprecated method getType\(\) of class Monolog\\Formatter\\ElasticaFormatter~'
- '~Parameter #1 \$stream of class Monolog\\Handler\\StreamHandler constructor expects~'
- '~overridden property~'
- '~Elasticsearch\\(Client(Builder)?|Common)~'
- '~CMDISP\\MonologMicrosoftTeams\\TeamsLogHandler~'
- '~PhpAmqpLib\\Channel\\AMQPChannel~'
- '~(Swift_Mailer|Swift_Message)~'
- '~Rollbar\\(Config|RollbarLogger)~'
- '~MongoDB\\Collection~'
- '~Parameter #3 \$options of callable Mimmi20\\MonologFactory\\Processor\\UidProcessorFactory expects array{length\?: int<1, 32>}\|null, array{length: (0|33)} given~'
- '~PHPDoc tag @param for parameter .* contains unresolvable type~'
- '~Fetching class constant class of deprecated class~'
- '~Monolog\\(Formatter|Handler)\\Flowdock(Formatter|Handler)~'
- '~Call to static method PHPUnit\\Framework\\Assert::assert.*\(\) with .* will always evaluate to true~'
- '~no value type specified in iterable type~'
# - '~PHPDoc tag @throws with type .*Psr\\Container\\ContainerExceptionInterface.* is not subtype of Throwable~'
- '~deprecated class Laminas\\ServiceManager\\Config~'
rules:
# code complexity
- Symplify\PHPStanRules\Rules\NoDynamicNameRule
# - Symplify\PHPStanRules\Rules\NoReturnArrayVariableListRule # todo: fix
- Symplify\PHPStanRules\Rules\ForbiddenExtendOfNonAbstractClassRule
# domain
- Symplify\PHPStanRules\Rules\Domain\RequireExceptionNamespaceRule
- Symplify\PHPStanRules\Rules\Domain\RequireAttributeNamespaceRule
- Symplify\PHPStanRules\Rules\Enum\RequireUniqueEnumConstantRule
- Symplify\PHPStanRules\Rules\PreventParentMethodVisibilityOverrideRule
# paths
- Symplify\PHPStanRules\Rules\NoReferenceRule
# explicit naming
- Symplify\PHPStanRules\Rules\ForbiddenMultipleClassLikeInOneFileRule
- Symplify\PHPStanRules\Rules\Complexity\ForbiddenArrayMethodCallRule
# - Symplify\PHPStanRules\Rules\CheckRequiredInterfaceInContractNamespaceRule
# naming
- Symplify\PHPStanRules\Rules\RequireAttributeNameRule
# regexes
- Symplify\PHPStanRules\Rules\AnnotateRegexClassConstWithRegexLinkRule
- Symplify\PHPStanRules\Rules\NoInlineStringRegexRule
- Symplify\PHPStanRules\Rules\RegexSuffixInRegexConstantRule
# naming
- Symplify\PHPStanRules\Rules\Explicit\ExplicitClassPrefixSuffixRule
- Symplify\PHPStanRules\Rules\NoReturnSetterMethodRule
- Symplify\PHPStanRules\Rules\UppercaseConstantRule
- Symplify\PHPStanRules\Rules\ClassNameRespectsParentSuffixRule
- Symplify\PHPStanRules\Rules\CheckClassNamespaceFollowPsr4Rule