forked from shopware/shopware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpstan.neon
255 lines (227 loc) · 13.7 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
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
includes:
- phpstan-baseline.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters:
phpVersion: 70400
level: 8
treatPhpDocTypesAsCertain: false
checkMissingIterableValueType: false
inferPrivatePropertyTypeFromConstructor: true
reportUnmatchedIgnoredErrors: true # Could be set to false if necessary during PHPStan update
tmpDir: var/cache/phpstan
paths:
- src
- tests
bootstrapFiles:
- src/Core/DevOps/StaticAnalyze/PHPStan/phpstan-bootstrap.php
- vendor/composer/InstalledVersions.php # somehow we are affected by this https://github.com/phpstan/phpstan/issues/4482
# run `php src/Core/DevOps/StaticAnalyze/PHPStan/phpstan-bootstrap.php` to create the container
symfony:
constantHassers: false
containerXmlPath: 'var/cache/phpstan_dev/Shopware_Core_DevOps_StaticAnalyze_StaticAnalyzeKernelPhpstan_devDebugContainer.xml'
consoleApplicationLoader: src/Core/DevOps/StaticAnalyze/PHPStan/console-application.php
excludePaths:
- src/Recovery/*
- src/Docs/Resources/current/60-references-internals/10-core/50-checkout-process/_examples/10-cart-example.php
- src/Docs/Resources/deprecated/2-internals/1-core/50-checkout-process/_examples/10-cart-example.php
# Compatibility fixes for doctrine annotation parser https://github.com/doctrine/annotations/issues/421
- src/Core/Framework/Compatibility/AnnotationReader.php
- src/Core/Framework/Compatibility/DocParser.php
# Symfony interface typehints `Predis\ClientInterface` which is by default not available
- src/Core/Framework/Adapter/Cache/ShopwareRedisAdapter.php
# node_modules
- src/**/node_modules/*
# @deprecated tag:v6.5.0 (replacing production template dev-dependencies is not allowed atm)
- src/Core/Framework/Demodata/DemodataService.php
- src/Core/Framework/Demodata/Generator/MediaGenerator.php
# twig override
- src/Core/Framework/Adapter/Twig/functions.php
ignoreErrors:
# We won't type all arrays/iterables for now
- '#no value type specified in iterable type#'
# The symfony extension checks against the "normal" container, not the test container
# Therefore some services in the tests are not found and the extension can not infer that all private services are public during test execution
-
message: '#Service ".*" is not registered in the container\.#'
paths:
- src/**/*Test.php
- src/Core/Framework/Test/TestCaseBase/*.php
-
message: '#Service ".*" is private#'
paths:
- src/**/*Test.php
- tests/integration/**/*Test.php
# ignore errors caused by static::markTestSkipped
-
message: '#Unreachable statement - code above always terminates.#'
paths:
- src/**/*Test.php
# benchmark tests create db tables on the fly
-
message: '#Query error:#'
paths:
- tests/performance/**/*.php
# Method gets always an EntityCollection
-
message: '#Default value of the parameter \#1 \$elements \(array\) of method Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\EntitySearchResult::createNew\(\) is incompatible with type Shopware\\Core\\Framework\\DataAbstractionLayer\\EntityCollection\.#'
path: src/Core/Framework/DataAbstractionLayer/Search/EntitySearchResult.php
# @feature-deprecated tag:v6.5.0 (flag:FEATURE_NEXT_12455)
-
message: '#Method Shopware\\Storefront\\Framework\\Captcha\\AbstractCaptcha::isValid\(\) invoked with 2 parameters, 1 required\.#'
path: src/Storefront/Framework/Captcha/CaptchaRouteListener.php
# Library wrong type hint
-
message: '#Parameter \#3 \$script of class ONGR\\ElasticsearchDSL\\Aggregation\\Metric\\StatsAggregation constructor expects string\|null, array<string, array\|string> given\.#'
path: src/Elasticsearch/Framework/DataAbstractionLayer/CriteriaParser.php
-
message: '#Parameter \#3 \$script of class ONGR\\ElasticsearchDSL\\Aggregation\\Metric\\StatsAggregation constructor expects string\|null, array<string, array<string, array>\|string> given\.#'
path: src/Elasticsearch/Framework/DataAbstractionLayer/CriteriaParser.php
-
message: '#Parameter \#1 \$firstResult of method Doctrine\\DBAL\\Query\\QueryBuilder::setFirstResult\(\) expects int, null given\.#'
path: src/Core/Framework/DataAbstractionLayer/Dbal/EntitySearcher.php
# To fix this error, the \Shopware\Core\Framework\Struct\Collection::createNew method has to be implemented
# in every implementation of `Collection` and needs to return `new self` instead of `new static`. See https://github.com/phpstan/phpstan/issues/2773
-
message: '#Unsafe usage of new static\(\)#'
path: src/Core/Framework/Struct/Collection.php
# Must be fixed with a custom rule
- '#Cannot call method fetch.*\(\) on Doctrine\\DBAL\\ForwardCompatibility\\Result\|int\|string#'
# Exception for CopyBatch file system plugin. It is called via magic method
- '#Call to an undefined method League\\Flysystem\\FilesystemInterface::copyBatch\(\)\.#'
-
message: '#Access to private property#'
path: src/Core/Framework/Api/Controller/CacheController.php
# @final annotation of internal classes
- '#.*extends @final class Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\EntitySearchResult\.#'
# Invalid phpdoc in OpenAPI Library
-
message: '#Property OpenApi\\Annotations\\PathItem::\$(delete|get|patch|post|put) \(OpenApi\\Annotations\\(Delete|Get|Patch|Post|Put)\) does not accept string#'
path: src/Core/Framework/Api/ApiDefinition/Generator/OpenApi/OpenApiLoader.php
-
message: '#Strict comparison using#'
path: src/Core/Framework/Api/ApiDefinition/Generator/OpenApi/OpenApiLoader.php
# The redis proxy and cluster has a magic __call method which is not considered by phpstan
-
message: '#Call to an undefined method .*RedisProxy.*::.*\(\).*#'
path: src/**/*.php
-
message: '#Cannot call method .* on .*RedisProxy.*#'
path: src/**/*.php
# dynamic hydrator performance
-
message: '#Access to an undefined property Shopware\\Core\\Framework\\DataAbstractionLayer\\Entity#'
path: src/*/*Hydrator.php
-
message: '#Access to protected property *#'
path: src/*/*Hydrator.php
-
message: '#Method Shopware\\Core\\Framework\\DataAbstractionLayer\\Entity::\_\_.*\(\) has.*#'
path: src/Core/Framework/DataAbstractionLayer/Entity.php
# Class behind feature flag - can be removed with feature flag
- '#Shopware\\Core\\Framework\\Api\\Sync\\SyncBehavior#'
-
message: '#^Parameter \#2 \$success of class Shopware\\Core\\Framework\\Api\\Sync\\SyncResult constructor expects bool, array given\.$#'
path: src/Core/Framework/Api/Sync/SyncService.php
# can be removed with feature flag FEATURE_NEXT_12455
-
message: '#Method Shopware\\Core\\Content\\Seo\\SeoUrlRoute\\SeoUrlRouteInterface::prepareCriteria\(\) invoked with 2 parameters, 1 required.#'
path: src/Core/Content/Seo/SeoUrlGenerator.php
-
message: '#Constructor of class Shopware\\Core\\Checkout\\Customer\\Exception\\DuplicateWishlistProductException has an unused parameter \$productId\.#'
path: src/Core/Checkout/Customer/Exception/DuplicateWishlistProductException.php
-
message: '#Constructor of class Shopware\\Core\\Checkout\\Order\\Exception\\LanguageOfOrderDeleteException has an unused parameter \$language\.#'
path: src/Core/Checkout/Order/Exception/LanguageOfOrderDeleteException.php
-
message: '#Constructor of class Shopware\\Core\\Content\\Newsletter\\Exception\\LanguageOfNewsletterDeleteException has an unused parameter \$language\.#'
path: src/Core/Content/Newsletter/Exception/LanguageOfNewsletterDeleteException.php
-
message: '#Parameter \#3 \$length of function substr expects int, int<0, max>\|false given\.#'
path: src/Core/Content/Product/DataAbstractionLayer/ProductExceptionHandler.php
-
message: '#Constructor of class Shopware\\Core\\System\\Language\\Exception\\LanguageForeignKeyDeleteException has an unused parameter \$language\.#'
path: src/Core/System/Language/Exception/LanguageForeignKeyDeleteException.php
-
message: '#Constructor of class Shopware\\Core\\System\\SalesChannel\\Exception\\LanguageOfSalesChannelDomainDeleteException has an unused parameter \$language\.#'
path: src/Core/System/SalesChannel/Exception/LanguageOfSalesChannelDomainDeleteException.php
-
message: '#Method Shopware\\Core\\Checkout\\Cart\\Facade\\.*::getIterator\(\) return type with generic class ArrayIterator does not specify its types: TKey, TValue#'
path: src/Core/Checkout/Cart/Facade/Traits/ItemsIteratorTrait.php
# Can be removed with Symfony 6.0 upgrade
-
message: '#Method Shopware\\Storefront\\Framework\\Twig\\TwigAppVariable::getFlashes\(\) has parameter \$types with no type specified.#'
path: src/Storefront/Framework/Twig/TwigAppVariable.php
-
message: "#^Class Shopware\\\\Core\\\\Content\\\\Mail\\\\Service\\\\MailerTransportFactory extends @final class Symfony\\\\Component\\\\Mailer\\\\Transport\\.$#"
count: 1
path: src/Core/Content/Mail/Service/MailerTransportFactory.php
-
message: "#^Parameter \\#1 \\$min \\(0\\) of function random_int expects lower number than parameter \\#2 \\$max \\(int\\<\\-3, max\\>\\)\\.$#"
count: 1
path: src/Core/Framework/Demodata/Generator/ProductGenerator.php
-
message: "#^Parameter \\#1 \\$min \\(int\\<0, 2\\>\\) of function random_int expects lower number than parameter \\#2 \\$max \\(int\\<0, 4\\>\\)\\.$#"
count: 1
path: src/Core/Framework/Demodata/Generator/ProductGenerator.php
# Is in the new super class nullable as the extended class
-
message: "#^PHPDoc type string\\|null of property Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Field\\\\ReferenceVersionField\\:\\:\\$storageName is not covariant with PHPDoc type string of overridden property Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Field\\\\FkField\\:\\:\\$storageName\\.$#"
count: 1
path: src/Core/Framework/DataAbstractionLayer/Field/ReferenceVersionField.php
# PhpStan cannot follow the referenced cursor
-
message: "#^Variable \\$extensions in empty\\(\\) always exists and is always falsy\\.$#"
count: 1
path: src/Core/Framework/DataAbstractionLayer/VersionManager.php
# Invalid trait usage
-
message: "#^Dead catch \\- ReflectionException is never thrown in the try block\\.$#"
count: 1
path: src/Core/Checkout/Cart/Error/Error.php
-
message: "#^Dead catch \\- ReflectionException is never thrown in the try block\\.$#"
count: 1
path: src/Core/Content/ProductExport/Error/Error.php
# Can be removed with 6.5 release (NEXT-19158)
-
message: "#^PHPDoc tag @param references unknown parameter\\: \\$htmlEscape$#"
count: 1
path: src/Core/Framework/Adapter/Twig/StringTemplateRenderer.php
# Method will get third parameter in 6.5
-
message: "#^Method Shopware\\\\Storefront\\\\Framework\\\\Cache\\\\ReverseProxy\\\\AbstractReverseProxyGateway\\:\\:tag\\(\\) invoked with 3 parameters, 2 required\\.$#"
count: 1
path: src/Storefront/Framework/Cache/ReverseProxy/ReverseProxyCache.php
# Can be removed with 6.5 release (NEXT-20850)
-
message: "#^PHPDoc tag @param references unknown parameter\\: \\$context$#"
count: 1
path: src/Storefront/Theme/ThemeCompiler.php
-
message: "#^Method Shopware\\\\Storefront\\\\Theme\\\\ThemeCompilerInterface\\:\\:compileTheme\\(\\) invoked with 6 parameters, 4\\-5 required\\.$#"
count: 2
path: src/Storefront/Theme/ThemeService.php
# Maybe a bug in phpstan: https://github.com/phpstan/phpstan/issues/7560
- '#Trait .* is used zero times and is not analysed.#'
# Bug in Phpstan Symfony: https://github.com/phpstan/phpstan-symfony/issues/286
-
message: '#Parameter \#1 \$expected of static method PHPUnit\\Framework\\Assert::assertSame\(\) contains unresolvable type#'
count: 4
path: src/Core/Framework/Test/DependencyInjection/CompilerPass/FilesystemConfigMigrationCompilerPassTest.php
services:
-
class: Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Deprecation\DeprecatedMethodsThrowDeprecationRule
tags:
- phpstan.rules.rule
-
class: Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Internal\InternalClassRule
tags:
- phpstan.rules.rule
-
class: Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Internal\InternalMethodRule
tags:
- phpstan.rules.rule
-
class: Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Tests\CoversAnnotationRule
tags:
- phpstan.rules.rule