Skip to content

Commit

Permalink
Merge branch 'next-39412/update-phpstan' into 'trunk'
Browse files Browse the repository at this point in the history
NEXT-39412 - Use common PHPStan config from core

See merge request shopware/6/services/swagmigrationmagento!254
  • Loading branch information
mitelg committed Dec 2, 2024
2 parents 20dc1c3 + 5e6f1cc commit 1080c12
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 153 deletions.
110 changes: 0 additions & 110 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -755,11 +755,6 @@ parameters:
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/CustomerReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\EnvironmentReader has an uninitialized property \\$connection\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/EnvironmentReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\EnvironmentReader\\:\\:getAdditionalData\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -855,11 +850,6 @@ parameters:
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/NotAssociatedMediaReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\NotAssociatedMediaReader has an uninitialized property \\$sourcePath\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/NotAssociatedMediaReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\NotAssociatedMediaReader\\:\\:dirToArray\\(\\) has parameter \\$result with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -905,31 +895,16 @@ parameters:
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/OrderReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductChildMultiSelectPropertyRelationReader has an uninitialized property \\$productEntityTypeId\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductChildMultiSelectPropertyRelationReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductChildMultiSelectPropertyRelationReader\\:\\:fetchMultiSelectProperties\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductChildMultiSelectPropertyRelationReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductChildMultiSelectTextPropertyRelationReader has an uninitialized property \\$productEntityTypeId\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductChildMultiSelectTextPropertyRelationReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductChildMultiSelectTextPropertyRelationReader\\:\\:fetchMultiSelectProperties\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductChildMultiSelectTextPropertyRelationReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductChildPropertyRelationReader has an uninitialized property \\$productEntityTypeId\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductChildPropertyRelationReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductChildPropertyRelationReader\\:\\:fetchPropertyRelations\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -990,21 +965,11 @@ parameters:
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductCustomFieldReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductMultiSelectPropertyRelationReader has an uninitialized property \\$productEntityTypeId\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductMultiSelectPropertyRelationReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductMultiSelectPropertyRelationReader\\:\\:fetchMultiSelectProperties\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductMultiSelectPropertyRelationReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductMultiSelectTextPropertyRelationReader has an uninitialized property \\$productEntityTypeId\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductMultiSelectTextPropertyRelationReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductMultiSelectTextPropertyRelationReader\\:\\:fetchMultiSelectProperties\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -1015,21 +980,11 @@ parameters:
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductOptionRelationReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductPropertyRelationReader has an uninitialized property \\$productEntityTypeId\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductPropertyRelationReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductPropertyRelationReader\\:\\:fetchPropertyRelations\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductPropertyRelationReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductReader has an uninitialized property \\$productEntityTypeId\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Gateway/Local/Reader/ProductReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Gateway\\\\Local\\\\Reader\\\\ProductReader\\:\\:appendAssociatedData\\(\\) has parameter \\$fetchedProducts with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -1385,31 +1340,6 @@ parameters:
count: 1
path: src/Profile/Magento/Premapping/AdminStoreReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\AdminStoreReader has an uninitialized property \\$choiceUuids\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Premapping/AdminStoreReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\OrderDeliveryStateReader has an uninitialized property \\$choiceUuids\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Premapping/OrderDeliveryStateReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\OrderStateReader has an uninitialized property \\$choiceUuids\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Premapping/OrderStateReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\PaymentMethodReader has an uninitialized property \\$choiceUuids\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Premapping/PaymentMethodReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\PaymentMethodReader has an uninitialized property \\$preselectionDictionary\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Premapping/PaymentMethodReader.php

-
message: "#^Property Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\PaymentMethodReader\\:\\:\\$preselectionDictionary type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -1420,36 +1350,11 @@ parameters:
count: 1
path: src/Profile/Magento/Premapping/SalutationReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\SalutationReader has an uninitialized property \\$choiceUuids\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Premapping/SalutationReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\ShippingMethodReader has an uninitialized property \\$choiceUuids\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Premapping/ShippingMethodReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\ShippingMethodReader has an uninitialized property \\$preselectionDictionary\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Premapping/ShippingMethodReader.php

-
message: "#^Property Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\ShippingMethodReader\\:\\:\\$preselectionDictionary type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Profile/Magento/Premapping/ShippingMethodReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\TaxReader has an uninitialized property \\$choiceUuids\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Premapping/TaxReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\TaxReader has an uninitialized property \\$preselectionDictionary\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento/Premapping/TaxReader.php

-
message: "#^Property Swag\\\\MigrationMagento\\\\Profile\\\\Magento\\\\Premapping\\\\TaxReader\\:\\:\\$preselectionDictionary type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -1790,11 +1695,6 @@ parameters:
count: 1
path: src/Profile/Magento2/Gateway/Local/Reader/Magento2SeoUrlReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento2\\\\Premapping\\\\Magento2CountryReader has an uninitialized property \\$preselectionDictionary\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento2/Premapping/Magento2CountryReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento2\\\\Premapping\\\\Magento2CountryReader\\:\\:getMapping\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -1805,11 +1705,6 @@ parameters:
count: 1
path: src/Profile/Magento2/Premapping/Magento2CountryReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento2\\\\Premapping\\\\Magento2CurrencyReader has an uninitialized property \\$preselectionDictionary\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento2/Premapping/Magento2CurrencyReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento2\\\\Premapping\\\\Magento2CurrencyReader\\:\\:getMapping\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -1820,11 +1715,6 @@ parameters:
count: 1
path: src/Profile/Magento2/Premapping/Magento2CurrencyReader.php

-
message: "#^Class Swag\\\\MigrationMagento\\\\Profile\\\\Magento2\\\\Premapping\\\\Magento2LanguageReader has an uninitialized property \\$preselectionDictionary\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Profile/Magento2/Premapping/Magento2LanguageReader.php

-
message: "#^Method Swag\\\\MigrationMagento\\\\Profile\\\\Magento2\\\\Premapping\\\\Magento2LanguageReader\\:\\:getMapping\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down
44 changes: 1 addition & 43 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
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
- %ShopwareRoot%/src/Core/DevOps/StaticAnalyze/PHPStan/common.neon

parameters:
level: 8
tmpDir: var/cache/phpstan
treatPhpDocTypesAsCertain: false
checkFunctionNameCase: true
checkInternalClassCaseSensitivity: true
checkUninitializedProperties: true
paths:
- src
- tests
Expand All @@ -27,24 +20,12 @@ parameters:
type_perfect:
narrow_return: true
narrow_param: true
no_mixed: true
null_over_false: true

ignoreErrors:
- message: '#Service ".*" is private#'
paths:
- tests/**/*Test.php

- # The properties are never uninitialized. They are assigned in the convert method.
message: '#Class Swag\\MigrationMagento\\Profile\\Magento\\Converter\\.* has an uninitialized property .*. Give it default value or assign it in the constructor.$#'
paths:
- src/Profile/Magento/Converter

- # The properties are never uninitialized. They are assigned in the convert method.
message: '#Class Swag\\MigrationMagento\\Profile\\Magento\\Media.* has an uninitialized property .*. Give it default value or assign it in the constructor.$#'
paths:
- src/Profile/Magento/Media

- # ToDo remove when bumping min shopware version
message: "#^Do not use .* function, use class .* instead\\.$#"
paths:
Expand All @@ -70,11 +51,6 @@ parameters:
- # Ignore undefined function calls on MappingServiceInterface because PHPStan dont get the inheritance
message: '#Call to an undefined method SwagMigrationAssistant\\Migration\\Mapping\\MappingServiceInterface::createListItemMapping|getUuidList\(\)#'


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
Expand All @@ -85,21 +61,3 @@ rules:
- 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

0 comments on commit 1080c12

Please sign in to comment.