Repository navigation
Expand file tree
/
Copy pathphpstan.neon
More file actions
212 lines (194 loc) · 14.9 KB
/
Copy pathphpstan.neon
File metadata and controls
212 lines (194 loc) · 14.9 KB
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/spaze/phpstan-disallowed-calls/extension.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters:
checkUninitializedProperties: true
strictRules:
# turn off strict rules
allRules: false
uselessCast: true
requireParentConstructorCall: true
overwriteVariablesWithLoop: true
closureUsesThis: true
numericOperandsInArithmeticOperators: true
#strictCalls: true
# turn on some strict rules parameters
polluteScopeWithLoopInitialAssignments: true
polluteScopeWithAlwaysIterableForeach: true
checkExplicitMixedMissingReturn: false
reportMaybesInMethodSignatures: false
reportStaticMethodSignatures: false
reportMaybesInPropertyPhpDocTypes: false
disallowedFunctionCalls:
-
function: 'print_r()'
message: 'use some logger instead'
allowParamsAnywhere:
2: true
-
function: 'var_dump()'
message: 'use some logger instead'
-
function: 'var_export()'
message: 'use some logger instead'
allowParamsAnywhere:
2: true
ignoreErrors:
-
messages:
- '#^Calling PHPStan\\DependencyInjection\\DerivativeContainerFactory\:\:create\(\) is not covered by backward compatibility promise\. The method might change in a minor PHPStan version\.$#'
- '#^Accessing PHPStan\\Analyser\\FileAnalyser::class is not covered by backward compatibility promise\. The class might change in a minor PHPStan version\.$#'
path: src/Analyser/FileAnalyserFactory.php
-
message: '#^Calling PHPStan\\File\\FileExcluder::isExcludedFromAnalysing\(\) is not covered by backward compatibility promise\. The method might change in a minor PHPStan version\.$#'
path: src/Analyser/AnalysedTemplatesRegistry.php
-
messages:
- '#^Calling PHPStan\\Analyser\\FileAnalyser\:\:analyseFile\(\) is not covered by backward compatibility promise\. The method might change in a minor PHPStan version\.$#'
- '#^Calling PHPStan\\Analyser\\FileAnalyserResult\:\:getErrors\(\) is not covered by backward compatibility promise\. The method might change in a minor PHPStan version\.$#'
- '#^Creating new PHPStan\\Analyser\\Error is not covered by backward compatibility promise\. The class might change in a minor PHPStan version\.$#'
- '#^Creating new PHPStan\\Collectors\\Registry is not covered by backward compatibility promise\. The class might change in a minor PHPStan version\.$#'
path: src/Rule/LatteTemplatesRule.php
-
messages:
- '#^Calling PHPStan\\File\\SimpleRelativePathHelper\:\:getRelativePath\(\) is not covered by backward compatibility promise\. The method might change in a minor PHPStan version\.$#'
- '#^Accessing PHPStan\\Command\\AnalyseCommand::DEFAULT_LEVEL is not covered by backward compatibility promise\. The class might change in a minor PHPStan version\.$#'
- '#^Accessing PHPStan\\Command\\AnalyseCommand::OPTION_LEVEL is not covered by backward compatibility promise\. The class might change in a minor PHPStan version\.$#'
path: src/Error/TableErrorFormatter.php
-
messages:
- '#Parameter \#2 ...\$(arrays|args) of function array_merge expects array, mixed given#'
path: src/LatteContext/Finder/*Finder.php
reportUnmatched: false
-
message: '#^Creating new PHPStan\\Reflection\\Native\\NativeParameterReflection is not covered by backward compatibility promise\. The class might change in a minor PHPStan version\.$#'
path: src/Compiler/Compiler/AbstractCompiler.php
-
message: '#^Call to function is_array\(\) with array{0: string, 1: string, 2\?: string} will always evaluate to true\.$#'
path: src/LinkProcessor/FakePresenterFactory.php
-
messages:
- '#^Call to internal method Nette\\Application\\PresenterFactory::formatPresenterClass\(\) from outside its root namespace Nette\.$#'
- '#^Call to internal method Nette\\Application\\PresenterFactory::unformatPresenterClass\(\) from outside its root namespace Nette\.$#'
- '#^Call to function is_callable\(\) with .* will always evaluate to .*#'
path: src/LinkProcessor/PresenterActionLinkProcessor.php
reportUnmatched: false
-
messages:
- '#^Parameter \#1 \$value of static method PhpParser\\BuilderHelpers\:\:normalizeValue\(\) expects .*, mixed given\.$#'
- '#^Call to static method normalizeValue\(\) of internal class PhpParser\\BuilderHelpers from outside its root namespace PhpParser\.$#'
path: src/LinkProcessor/LinkParamsProcessor.php
reportUnmatched: false
-
messages:
- '#^Method Efabrica\\PHPStanLatte\\Analyser\\LatteContextAnalyser::__construct\(\) has parameter \$collectors with generic class Efabrica\\PHPStanLatte\\LatteContext\\Collector\\AbstractLatteContextCollector but does not specify its types: T#'
- '#^Method Efabrica\\PHPStanLatte\\Analyser\\LatteContextAnalyser::withCollectors\(\) has parameter \$collectors with generic class Efabrica\\PHPStanLatte\\LatteContext\\Collector\\AbstractLatteContextCollector but does not specify its types: T#'
path: src/Analyser/LatteContextAnalyser.php
-
messages:
- '#^Property Efabrica\\PHPStanLatte\\Analyser\\LatteContextCollectorRegistry::\$collectors with generic class Efabrica\\PHPStanLatte\\LatteContext\\Collector\\AbstractLatteContextCollector does not specify its types: T#'
- '#^Property Efabrica\\PHPStanLatte\\Analyser\\LatteContextCollectorRegistry::\$cache with generic class Efabrica\\PHPStanLatte\\LatteContext\\Collector\\AbstractLatteContextCollector does not specify its types: T#'
- '#^Method Efabrica\\PHPStanLatte\\Analyser\\LatteContextCollectorRegistry::__construct\(\) has parameter \$collectors with generic class Efabrica\\PHPStanLatte\\LatteContext\\Collector\\AbstractLatteContextCollector but does not specify its types: T#'
- '#^Method Efabrica\\PHPStanLatte\\Analyser\\LatteContextCollectorRegistry::getCollectorsForNode\(\) return type with generic class Efabrica\\PHPStanLatte\\LatteContext\\Collector\\AbstractLatteContextCollector does not specify its types: T#'
path: src/Analyser/LatteContextCollectorRegistry.php
# Latte version conditions
-
messages:
- '#Comparison operation "(<|>|<=|>=)" between [0-9]{5} and [0-9]{5} is always (true|false).#'
- '#isLatte.*\(\) never returns (true|false) so the return type can be changed to (true|false).#'
path: src/Compiler/LatteVersion.php
reportUnmatched: false
# Errors cause by multiple latte compiler engines
-
messages:
- '#^Property Efabrica\\PHPStanLatte\\Compiler\\Compiler\\CompilerFactory\:\:\$extensions has unknown class Latte\\Extension as its type\.$#'
- '#^Parameter \$extensions of method Efabrica\\PHPStanLatte\\Compiler\\Compiler\\CompilerFactory\:\:__construct\(\) has invalid type Latte\\Extension\.$#'
path: src/Compiler/Compiler/CompilerFactory.php
reportUnmatched: false
-
messages:
- '#^Property Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte2Compiler\:\:\$parser has unknown class Latte\\Parser as its type\.$#'
- '#^Property Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte2Compiler\:\:\$compiler has unknown class Latte\\Compiler as its type\.$#'
- '#^Parameter \$parser of method Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte2Compiler\:\:__construct\(\) has invalid type Latte\\Parser\.$#'
- '#^Parameter \$compiler of method Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte2Compiler\:\:__construct\(\) has invalid type Latte\\Compiler\.$#'
- '#^Parameter \#1 \$compiler of static method .*Macros::install\(\) expects Latte\\Compiler, mixed given\.#'
- '#^Call to method parse\(\) on an unknown class Latte\\Parser\.$#'
- '#^Cannot call method parse\(\) on mixed.$#'
- '#^Call to method compile\(\) on an unknown class Latte\\Compiler\.$#'
- '#^Cannot call method compile\(\) on mixed.$#'
- '#^Call to an undefined method Latte\\Engine::getCompiler\(\).$#'
- '#^Call to an undefined method Latte\\Engine::getParser\(\).$#'
- '#^Call to method parse\(\) on an unknown class Latte\\Parser\.$#'
- '#^Instantiated class Latte\\Runtime\\Defaults not found\.$#'
- '#^Call to method getFilters\(\) on an unknown class Latte\\Runtime\\Defaults\.$#'
- '#^Call to method getFunctions\(\) on an unknown class Latte\\Runtime\\Defaults\.$#'
- '#^Cannot call method getFunctions\(\) on mixed.$#'
- '#^Cannot call method setFunctions\(\) on mixed.$#'
- '#^Cannot call method getLine\(\) on mixed.$#'
- '#^Method Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte2Compiler::getFilters\(\) should return array<string, array\{string, string\}\|string> but returns array<callable\(\): mixed>.#'
- '#^Parameter \$compiler of method Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte2Compiler\:\:installMacros\(\) has invalid type Latte\\Compiler\.$#'
- '#^PHPDoc tag @var references internal class .*#'
- '#^Instantiation of internal class .*#'
- '#^Call to method .* of internal class .* from outside its root namespace .*\.#'
- '#^Parameter \#2 \$name of method Latte\\CompileException::setSource\(\) expects string\|null, int\|null given\.#'
- '#^Parameter \#1 \$phpContent of method Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte2Compiler::fixLines\(\) expects string, mixed given\.#'
path: src/Compiler/Compiler/Latte2Compiler.php
reportUnmatched: false
-
messages:
- '#^Parameter \$extensions of method Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte3Compiler\:\:__construct\(\) has invalid type Latte\\Extension\.$#'
- '#^Parameter \#2 \$extensions of method Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte3Compiler\:\:installExtensions\(\) expects array\<Latte\\Extension\>, array\<Latte\\Essential\\RawPhpExtension\|Latte\\Extension\|Nette\\Bridges\\ApplicationLatte\\UIExtension\|Nette\\Bridges\\FormsLatte\\FormsExtension\> given\.$#'
- '#^Call to an undefined method Latte\\Engine\:\:parse\(\)\.$#'
- '#^Call to an undefined method Latte\\Engine\:\:applyPasses\(\)\.$#'
- '#^Instantiated class Latte\\Compiler\\TemplateGenerator not found\.$#'
- '#^Call to method generate\(\) on an unknown class Latte\\Compiler\\TemplateGenerator\.$#'
- '#^Call to an undefined method Latte\\Engine\:\:getExtensions\(\)\.$#'
- '#^Call to an undefined method Latte\\Engine\:\:getFunctions\(\)\.$#'
- '#^Parameter \$extensions of method Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte3Compiler\:\:installExtensions\(\) has invalid type Latte\\Extension\.$#'
- '#^Call to an undefined method Latte\\Engine\:\:addExtension\(\)\.$#'
- '#^Parameter \#1 \$phpContent of method Efabrica\\PHPStanLatte\\Compiler\\Compiler\\Latte3Compiler::fixLines\(\) expects string, mixed given\.#'
- '#^PHPDoc tag @var with type array<string, callable> is not subtype of type array<string>\.#'
- '#^Parameter \#1 \$object of function get_class expects object, mixed given\.#'
- '#^Call to function is_array\(\) with array<Latte\\Extension> will always evaluate to true\.#'
- '#^Call to function is_object\(\) with Latte\\Extension will always evaluate to true\.#'
path: src/Compiler/Compiler/Latte3Compiler.php
reportUnmatched: false
-
message: '#^Method Latte\\CompileException\:\:setSource\(\) invoked with 3 parameters, 1-2 required\.$#'
path: src/Compiler/Compiler/Latte2Compiler.php
reportUnmatched: false
# is covered by backward compatibility promise
-
messages:
- '#^Although PHPStan\\Node\\InClassNode is covered by backward compatibility promise, this instanceof assumption might break because it''s not guaranteed to always stay the same\.$#'
- '#^Although PHPStan\\Node\\ClassMethod is covered by backward compatibility promise, this instanceof assumption might break because it''s not guaranteed to always stay the same\.$#'
reportUnmatched: false
# to be done later, no idea how to fix it now
-
messages:
- '#^Method Efabrica\\PHPStanLatte\\Collector\\Collector\\AbstractCollector::collectItems\(\) should return array\<A of array\>\|null but returns (array\<int, |list<)array\<string, mixed\>\>\.$#'
- '#^Method Efabrica\\PHPStanLatte\\Collector\\Collector\\AbstractCollector::loadData\(\) should return array<T of Efabrica\\PHPStanLatte\\Collector\\CollectedData\\CollectedValueObject> but returns list<mixed>\.$#'
path: src/Collector/Collector/AbstractCollector.php
reportUnmatched: false
-
messages:
- '#^Doing instanceof PHPStan\\Type\\ObjectType is error-prone and deprecated\. Use Type\:\:isObject\(\) or Type\:\:getObjectClassNames\(\) instead\.$#'
- '#^Doing instanceof PHPStan\\Type\\Generic\\GenericObjectType is error-prone and deprecated\.$#'
path: src/LatteContext/Collector/ComponentCollector.php
-
message: '#^Parameter \#1 \$object of function get_class expects object, mixed given\.$#'
paths:
- src/Compiler/NodeVisitor/ChangeFiltersNodeVisitor.php
- src/Compiler/NodeVisitor/ChangeFunctionsNodeVisitor.php
-
# present only in nette/utils 4
message: '#^PHPDoc tag @var with type SplFileInfo is not subtype of native type Nette\\Utils\\FileInfo\.$#'
reportUnmatched: false
-
message: '#^Parameter \#1 .* of static method .*::fromJson\(\) expects array{.*}, array.* given\.$#'
-
message: '#^Parameter \#1 .* of static method .*::.*FromJson\(\) expects array{.*}, array.* given\.$#'
-
message: '#^Method Efabrica\\PHPStanLatte\\Compiler\\LatteVersion::isLatte.\(\) never returns (true|false) so the return type can be changed to (true|false)\.$#'
reportUnmatched: false