forked from shopware5/shopware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.phpstan.neon
193 lines (166 loc) · 12.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
includes:
- .phpstan-baseline.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
services:
-
class: \Shopware\Tests\PHPStan\Extension\SmartyClassDynamicReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension
parameters:
level: 8
inferPrivatePropertyTypeFromConstructor: true
reportUnmatchedIgnoredErrors: true
treatPhpDocTypesAsCertain: false
tmpDir: var/cache/phpstan
bootstrapFiles:
- %currentWorkingDirectory%/recovery/common/autoload.php # Additional autoloading for testing classes under recovery/*
symfony:
constantHassers: false
containerXmlPath: 'var/cache/production____REVISION___/container.xml'
consoleApplicationLoader: tests/phpstan-console-application.php
doctrine:
queryBuilderClass: Shopware\Components\Model\QueryBuilder
repositoryClass: Shopware\Components\Model\ModelRepository
objectManagerLoader: tests/phpstan-doctrine-model-manager.php
scanDirectories:
- %currentWorkingDirectory%/var/cache/production____REVISION___/doctrine
- %currentWorkingDirectory%/var/cache/production____REVISION___/proxies
- %currentWorkingDirectory%/engine/Library
paths:
- %currentWorkingDirectory%/engine/Shopware
- %currentWorkingDirectory%/tests
- %currentWorkingDirectory%/engine/Library/Enlight
- %currentWorkingDirectory%/themes/Frontend/Bare/Theme.php
- %currentWorkingDirectory%/themes/Frontend/Responsive/Theme.php
excludePaths:
- %currentWorkingDirectory%/engine/Shopware/Plugins/Community
- %currentWorkingDirectory%/engine/Shopware/Plugins/Local
- %currentWorkingDirectory%/engine/Shopware/Components/DependencyInjection/LegacyPhpDumper.php # is copied from Symfony. To keep it comparable, we don't change it
- %currentWorkingDirectory%/tests/Functional/Components/DependencyInjection/LegacyPhpDumperTest.php
ignoreErrors:
- '#apcu_#'
# Interface / Implementation Switch
- '#expects Shopware\\Bundle\\SearchBundle\\Facet\\[a-zA-Z]+Facet, Shopware\\Bundle\\SearchBundle\\[a-zA-Z]+Interface given#'
- '#expects Shopware\\Bundle\\SearchBundle\\Condition\\[a-zA-Z]+Condition, Shopware\\Bundle\\SearchBundle\\[a-zA-Z]+Interface given#'
# Product/Shopcontext mixup
- '#expects Shopware\\Bundle\\StoreFrontBundle\\Struct\\ProductContextInterface, Shopware\\Bundle\\StoreFrontBundle\\Struct\\ShopContextInterface given#'
# We manually check if the class exists before instantiating / using it
- '#PHPDoc tag \@var for variable \$payPalInstaller contains unknown class SwagPaymentPayPalUnified\\Setup\\FirstRunWizardInstaller#'
- # Config is read out in kernel, so there is a context for $this
message: '#Variable \$this might not be defined#'
path: engine/Shopware/Configs/Default.php
- # Seem to be issues, but need tests to verify changes there
message: '#Negated boolean expression is always false#'
path: 'engine/Shopware/Core/sArticles.php'
-
message: '#Comparison operation ">=" between int<1, max> and 1 is always true#'
path: 'engine/Shopware/Core/sArticles.php'
-
message: '#Comparison operation "<" between \(array\|float\|int\) and 0 results in an error\.#'
path: engine/Shopware/Core/sAdmin.php
-
message: '#Call to static method PHPUnit\\Framework\\Assert::assertIsArray\(\) with false will always evaluate to false\.#'
path: tests/Functional/Core/AdminTest.php
- # We override the method in higher class inheritance to public method
message: '#Call to protected method verifyPage#'
path: tests/Mink/features/bootstrap/SpecialContext.php
- # Every API resource class has those methods, but we cannot put that into an interface or abstract class, because the parameter amount is different
message: '#Call to an undefined method \$this\(Shopware\\Components\\Api\\Resource\\Resource\)&Shopware\\Components\\Api\\BatchInterface::(delete|update|create)\(\)#'
path: engine/Shopware/Components/Api/Resource/Resource.php
- # Overwrite of parent methods to have a proper type declaration of the entity manager
message: '#Method .*::getEntityManager\(\) should return Shopware\\Components\\Model\\ModelManager but returns Doctrine\\ORM\\EntityManagerInterface#'
paths:
- engine/Shopware/Components/Model/ModelRepository.php
- engine/Shopware/Components/Model/QueryBuilder.php
- # Currently not possible to determine the paginator generic type at those places
message: '#return type with generic class Doctrine\\ORM\\Tools\\Pagination\\Paginator does not specify its types: T#'
paths:
- engine/Shopware/Components/Model/ModelManager.php
- engine/Shopware/Controllers/Backend/Search.php
# Some day this should be specified
- '#no value type specified in iterable type Doctrine\\DBAL\\#'
# This method does not exists, but it does not throw an error. Needs to be checked
- '#Call to an undefined method Enlight_Template_Manager::setCompileId\(\)#'
# Needs some improvements in the doctrine PHPStan extensions: see https://github.com/phpstan/phpstan-doctrine/pull/167
- '#Cannot call method fetch.*\(\) on Doctrine\\DBAL\\.*\|int#'
- # This property contains many different repositories, so we do not specify the type
message: '#with generic class Shopware\\Components\\Model\\ModelRepository does not specify its types: TEntityClass#'
path: engine/Shopware/Controllers/Backend/Config.php
- # While cloning entities the ID or foreign key columns need to be set to `null` even if they do not allow that from the database definition
message: '#Property Shopware\\Models\\Emotion\\.*::.*id|Id \(int\) does not accept null#'
paths:
- engine/Shopware/Models/Emotion/Data.php
- engine/Shopware/Models/Emotion/Element.php
- engine/Shopware/Models/Emotion/ElementViewport.php
- engine/Shopware/Models/Emotion/Emotion.php
- engine/Shopware/Models/Emotion/Preset.php
- engine/Shopware/Models/Emotion/PresetTranslation.php
- engine/Shopware/Models/Emotion/Template.php
- # The config stores values as serialized strings, but the getter of the models return the actual type like bool or int
message: '#::\$value type mapping mismatch: database|property can contain #'
paths:
- engine/Shopware/Models/Config/Element.php
- engine/Shopware/Models/Config/Value.php
- # Testing DI container stuff with autowiring services into controller actions. No possibility to teach that to PHPStan
message: '#Service "Shopware\\Tests\\Functional\\Bundle\\ControllerBundle\\TestController\\Test" is not registered in the container#'
path: tests/Functional/Bundle/ControllerBundle/ControllerActionTest.php
-
message: '#Instantiated class TestContainer not found#'
path: tests/Functional/Bundle/ControllerBundle/ControllerActionTest.php
-
message: '#Parameter \#1 \$loader of method Enlight_Controller_Action::setContainer\(\) expects Shopware\\Components\\DependencyInjection\\Container\|null, TestContainer given#'
path: tests/Functional/Bundle/ControllerBundle/ControllerActionTest.php
- # Somehow PHPStan does not recognize the return types correctly
message: '#Call to static method PHPUnit\\Framework\\Assert::assertIsArray\(\) with true|null will always evaluate to false#'
count: 4
path: tests/Functional/Core/BasketTest.php
- # PHPStan has issues to recognize the inheritance of SortingInterface and ConditionInterface
message: '#Parameter \#1 \$criteriaPart of method Shopware\\Bundle\\SearchBundleES\\SortingHandler\\.*SortingHandler::getSorting\(\) expects Shopware\\Bundle\\SearchBundle\\Sorting\\.*Sorting, Shopware\\Bundle\\SearchBundle\\CriteriaPartInterface given#'
path: engine/Shopware/Bundle/SearchBundleES/SortingHandler
-
message: '#Parameter \#1 \$sorting of method Shopware\\Bundle\\SearchBundleDBAL\\SortingHandler\\.*SortingHandler::addSorting\(\) expects Shopware\\Bundle\\SearchBundle\\Sorting\\.*Sorting, Shopware\\Bundle\\SearchBundle\\SortingInterface given#'
path: engine/Shopware/Bundle/SearchBundleDBAL/SortingHandler
-
message: '#Parameter \#1 \$condition of method Shopware\\Bundle\\CustomerSearchBundleDBAL\\ConditionHandler\\.*ConditionHandler::addCondition\(\) expects Shopware\\Bundle\\CustomerSearchBundle\\Condition\\.*Condition, Shopware\\Bundle\\SearchBundle\\ConditionInterface given#'
path: engine/Shopware/Bundle/CustomerSearchBundleDBAL/ConditionHandler
-
message: '#Parameter \#1 \$sorting of method Shopware\\Bundle\\CustomerSearchBundleDBAL\\SortingHandler\\.*SortingHandler::addSorting\(\) expects Shopware\\Bundle\\CustomerSearchBundle\\Sorting\\.*Sorting, Shopware\\Bundle\\SearchBundle\\SortingInterface given#'
path: engine/Shopware/Bundle/CustomerSearchBundleDBAL/SortingHandler
- # For testing it is not necessary to declare the whole basket array correctly
message: '#Parameter \#1 \$basket of method Shopware\\Components\\BasketSignature\\BasketSignatureGenerator::generateSignature\(\) expects array.*, array.* given#'
path: tests/Unit/Components/BasketSignature/BasketSignatureCreatorTest.php
- # Parent setUp method is not called on purpose
message: '#Missing call to parent::setUp\(\) method#'
paths:
- tests/Functional/Core/sCoreTest.php
- tests/Functional/Controllers/Backend/OrderTest.php
- tests/Functional/Controllers/Backend/UserManagerTest.php
- # Some class properties do not have a getter or setter, but they are needed for the Doctrine column declaration
message: '#Property Shopware\\Models\\.*::\$.* is never written, only read#'
path: engine/Shopware/Models
- # Intended overwrite for easier testing
message: '#PHPDoc type string of property Shopware\\Tests\\Functional\\Bundle\\BenchmarkBundle\\Controllers\\Backend\\Mocks\\ViewMock::\$template is not covariant with PHPDoc type Enlight_Template_Default\|null of overridden property Enlight_View_Default::\$template#'
path: tests/Functional/Bundle/BenchmarkBundle/Controllers/Backend/Mocks/ViewMock.php
- # Intended "endless" loop which is interrupted by an exception
message: '#While loop condition is always true#'
count: 1
path: engine/Shopware/Bundle/BenchmarkBundle/Commands/SendStatisticsCommand.php
- # Giving "test" as construct parameter sets up a test storage
message: '#Parameter \#1 \$options of class Enlight_Event_Subscriber_Config constructor expects array\|null, string given#'
path: tests/Unit/Components/Event/SubscriberConfigTest.php
- # The Symfony extension does not correctly recognize the helper type. see: https://github.com/phpstan/phpstan-symfony/issues/239
message: '#Call to an undefined method Symfony\\Component\\Console\\Helper\\HelperInterface::ask\(\)#'
paths:
- engine/Shopware/Bundle/MediaBundle/Commands/MediaOptimizeCommand.php
- engine/Shopware/Commands/ThemeCreateCommand.php
- # For testing purposes the constructor of the price struct gets strings
message: '#Parameter .* of class Shopware\\Components\\Cart\\Struct\\Price constructor expects float.*string given#'
path: tests/Functional/Components/Cart/ProportionalTaxCalculatorTest.php
- # The doctrine extension has problems with detecting the select within an if condition. see https://github.com/phpstan/phpstan-doctrine/issues/331
message: '#Error: Expected Doctrine\\ORM\\Query\\Lexer::T_FROM, got end of string#'
path: engine/Shopware/Components/Api/Resource/EmotionPreset.php
# This is a bleeding edge feature and not working well since now. See https://github.com/phpstan/phpstan-doctrine/issues/332
- '#Parameter .* of method Doctrine\\ORM\\.*::.*\(\) expects .*literal-string.* given#'
- # Doctrine type is integer. PHPStan allows only specific values
message: '#Property Shopware\\Models\\Dispatch\\Dispatch::\$.* type mapping mismatch: database can contain int but property expects 0\|1\|2\|3#'
path: engine/Shopware/Models/Dispatch/Dispatch.php