-
Notifications
You must be signed in to change notification settings - Fork 27
/
phpstan.neon.dist
130 lines (114 loc) · 6.71 KB
/
phpstan.neon.dist
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
includes:
- phpstan-baseline.neon
- %ShopwareRoot%/vendor/phpstan/phpstan/conf/bleedingEdge.neon
- %ShopwareRoot%/src/Core/DevOps/StaticAnalyze/PHPStan/extension.neon
- %ShopwareRoot%/src/Core/DevOps/StaticAnalyze/PHPStan/rules.neon
parameters:
level: 8
tmpDir: var/cache/phpstan
treatPhpDocTypesAsCertain: false
checkFunctionNameCase: true
checkInternalClassCaseSensitivity: true
checkUninitializedProperties: true
paths:
- src
- tests
excludePaths:
- src/Resources
- tests/Jest
- tests/acceptance
symfony:
constant_hassers: false
# the placeholder "%ShopwareHashedCacheDir%" will be replaced on execution by bin/phpstan-config-generator.php script
container_xml_path: '../../..%ShopwareHashedCacheDir%/%ShopwareKernelClass%DevDebugContainer.xml'
consoleApplicationLoader: %ShopwareRoot%/src/Core/DevOps/StaticAnalyze/console-application.php
type_perfect:
narrow_return: true
narrow_param: true
no_mixed: true
null_over_false: true
ignoreErrors:
- message: '#Service ".*" is private#'
paths:
- tests/**/*Test.php
- # PHPStan does not recognize correctly that the properties are initialized in a private method called in the setUp method
message: '#Access to an uninitialized property SwagMigrationAssistant\\Test.*(mappingService|connection|runId)#'
paths:
- tests/Migration/Controller/StatusControllerTest.php
- tests/Migration/Services/MigrationDataWriterTest.php
- tests/Profile/Shopware/Gateway/Local/
- # Ignore hash functions rule for the following files because we use it in another context
message: '#Do not use .* function, use class Shopware\\Core\\Framework\\Util\\Hasher instead#'
paths:
- src/Migration/Media/Processor/HttpDownloadServiceBase.php
- src/Migration/Service/MigrationDataConverter.php
- src/Profile/Shopware/Converter/OrderConverter.php
- src/Profile/Shopware/Converter/ProductConverter.php
- src/Profile/Shopware/Converter/ProductOptionRelationConverter.php
- src/Profile/Shopware/Converter/ProductPropertyRelationConverter.php
- src/Profile/Shopware/Converter/PropertyGroupOptionConverter.php
- src/Profile/Shopware/Converter/ShippingMethodConverter.php
- src/Profile/Shopware/Media/Strategy/Md5StrategyResolver.php
- src/Migration/Converter/Converter.php
- # The properties are never uninitialized. They are assigned in the convert method.
message: '#Class SwagMigrationAssistant\\Profile\\Shopware6{0,1}\\Converter|Media\\.* has an uninitialized property .*. Give it default value or assign it in the constructor.$#'
paths:
- src/Profile/Shopware/Converter
- src/Profile/Shopware6/Media
- # Entity properties initialized and handled by our DAL.
message: "#^Class SwagMigrationAssistant\\\\.+ has an uninitialized property \\$.+\\. Give it default value or assign it in the constructor\\.$#"
paths:
- src/Migration/Logging/SwagMigrationLoggingEntity.php
- src/Migration/Run/EntityProgress.php
- src/Migration/Run/RunProgress.php
- src/Migration/Run/SwagMigrationRunEntity.php
- src/Migration/Setting/GeneralSettingEntity.php
- src/Migration/Data/SwagMigrationDataEntity.php
- src/Migration/Mapping/SwagMigrationMappingEntity.php
- src/Migration/Media/SwagMigrationMediaFileEntity.php
- # To fix those issues, the AbstractProvider needs a generic type, which could then be used further down in the methods as typehints for other generic typed parameters
message: '#(readTotalFromRepo|readTableFromRepo|cleanupSearchResult)\(\) has parameter .* with generic class#'
path: src/DataProvider/Provider/Data/AbstractProvider.php
# ToDo: fix platform deprecations for v6.7.0.0
- message: """
#^Call to deprecated method getName\\(\\) of class Shopware\\\\Core\\\\System\\\\StateMachine\\\\Aggregation\\\\StateMachineState\\\\StateMachineStateEntity\\:
tag\\:v6\\.7\\.0 \\- reason\\:return\\-type\\-change \\- Will also return null
return type will be \\?string in v6\\.7\\.0\\.0$#
"""
paths:
- src/Profile/Shopware/Premapping/OrderDeliveryStateReader.php
- src/Profile/Shopware/Premapping/OrderStateReader.php
- src/Profile/Shopware/Premapping/TransactionStateReader.php
- message: """
#^Fetching class constant class of deprecated class Shopware\\\\Core\\\\Checkout\\\\Payment\\\\Cart\\\\PaymentHandler\\\\CashPayment:
tag:v6.7.0 - reason:becomes-internal$#
"""
paths:
- src/Profile/Shopware/Premapping/PaymentMethodReader.php
- tests/Profile/Shopware/Premapping/PaymentMethodReaderTest.php
services:
- # register the class, so we can decorate it, but don't tag it as a rule, so only our decorator is used by PHPStan
class: Symplify\PHPStanRules\Rules\NoReturnSetterMethodRule
rules:
# Shopware core rules
- Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Deprecation\DeprecatedMethodsThrowDeprecationRule
- Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Tests\CoversAttributeRule
- Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Tests\MockingSimpleObjectsNotAllowedRule
- Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\FinalClassRule
- Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\DecorationPatternRule
- Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\PackageAnnotationRule
- Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\DomainExceptionRule
- Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\NoAfterStatementRule
# rules from https://github.com/symplify/phpstan-rules
# domain
- Symplify\PHPStanRules\Rules\Enum\RequireUniqueEnumConstantRule
- Symplify\PHPStanRules\Rules\PreventParentMethodVisibilityOverrideRule
# explicit naming
- Symplify\PHPStanRules\Rules\ForbiddenMultipleClassLikeInOneFileRule
- Symplify\PHPStanRules\Rules\Complexity\ForbiddenArrayMethodCallRule
# complexity rules
- Symplify\PHPStanRules\Rules\NoDynamicNameRule
# naming rules
- Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Symplify\NoReturnSetterMethodWithFluentSettersRule
- Symplify\PHPStanRules\Rules\UppercaseConstantRule
- Symplify\PHPStanRules\Rules\CheckClassNamespaceFollowPsr4Rule