Skip to content

Commit

Permalink
NEXT-39412 - Adjust PHPStan config, so it is not dependent on the loc…
Browse files Browse the repository at this point in the history
…ation of PHPStan itself
  • Loading branch information
mitelg committed Dec 2, 2024
1 parent d60955a commit c314e10
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 282 deletions.
255 changes: 0 additions & 255 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -65,56 +65,16 @@ parameters:
count: 5
path: src/Pos/PosSyncController.php

-
message: "#^Class Swag\\\\PayPal\\\\Pos\\\\Sync\\\\Context\\\\InventoryContext has an uninitialized property \\$salesChannel\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Pos/Sync/Context/InventoryContext.php

-
message: "#^Array method calls \\[\\$this, \"method\"\\] are not allowed\\. Use explicit method instead to help PhpStorm, PHPStan and Rector understand your code$#"
count: 2
path: src/Pos/Sync/Context/InventoryContextFactory.php

-
message: "#^Class Swag\\\\PayPal\\\\Pos\\\\Sync\\\\Inventory\\\\Calculator\\\\LocalWebhookCalculator has an uninitialized property \\$fixedUpdates\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Pos/Sync/Inventory/Calculator/LocalWebhookCalculator.php

-
message: "#^Array method calls \\[\\$this, \"method\"\\] are not allowed\\. Use explicit method instead to help PhpStorm, PHPStan and Rector understand your code$#"
count: 1
path: src/Pos/Sync/Product/DeletedUpdater.php

-
message: "#^Class Swag\\\\PayPal\\\\Pos\\\\Sync\\\\Product\\\\Util\\\\ProductGrouping has an uninitialized property \\$product\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Pos/Sync/Product/Util/ProductGrouping.php

-
message: "#^Access to an uninitialized property Swag\\\\PayPal\\\\Pos\\\\Webhook\\\\WebhookRegistry\\:\\:\\$registeredWebhooks\\.$#"
count: 2
path: src/Pos/Webhook/WebhookRegistry.php

-
message: "#^Class Swag\\\\PayPal\\\\Reporting\\\\DataAbstractionLayer\\\\TransactionReport\\\\TransactionReportEntity has an uninitialized property \\$currencyIso\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Reporting/DataAbstractionLayer/TransactionReport/TransactionReportEntity.php

-
message: "#^Class Swag\\\\PayPal\\\\Reporting\\\\DataAbstractionLayer\\\\TransactionReport\\\\TransactionReportEntity has an uninitialized property \\$orderTransactionId\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Reporting/DataAbstractionLayer/TransactionReport/TransactionReportEntity.php

-
message: "#^Class Swag\\\\PayPal\\\\Reporting\\\\DataAbstractionLayer\\\\TransactionReport\\\\TransactionReportEntity has an uninitialized property \\$orderTransactionVersionId\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Reporting/DataAbstractionLayer/TransactionReport/TransactionReportEntity.php

-
message: "#^Class Swag\\\\PayPal\\\\Reporting\\\\DataAbstractionLayer\\\\TransactionReport\\\\TransactionReportEntity has an uninitialized property \\$totalPrice\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Reporting/DataAbstractionLayer/TransactionReport/TransactionReportEntity.php

-
message: "#^Use explicit names over dynamic ones$#"
count: 7
Expand All @@ -130,61 +90,6 @@ parameters:
count: 2
path: src/Storefront/Data/CheckoutDataSubscriber.php

-
message: "#^Class Swag\\\\PayPal\\\\Util\\\\Availability\\\\AvailabilityContext has an uninitialized property \\$billingCountryCode\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Util/Availability/AvailabilityContext.php

-
message: "#^Class Swag\\\\PayPal\\\\Util\\\\Availability\\\\AvailabilityContext has an uninitialized property \\$currencyCode\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Util/Availability/AvailabilityContext.php

-
message: "#^Class Swag\\\\PayPal\\\\Util\\\\Availability\\\\AvailabilityContext has an uninitialized property \\$hasDigitalProducts\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Util/Availability/AvailabilityContext.php

-
message: "#^Class Swag\\\\PayPal\\\\Util\\\\Availability\\\\AvailabilityContext has an uninitialized property \\$salesChannelId\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Util/Availability/AvailabilityContext.php

-
message: "#^Class Swag\\\\PayPal\\\\Util\\\\Availability\\\\AvailabilityContext has an uninitialized property \\$subscription\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Util/Availability/AvailabilityContext.php

-
message: "#^Class Swag\\\\PayPal\\\\Util\\\\Availability\\\\AvailabilityContext has an uninitialized property \\$totalAmount\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: src/Util/Availability/AvailabilityContext.php

-
message: "#^Access to an uninitialized property Swag\\\\PayPal\\\\Webhook\\\\WebhookRegistry\\:\\:\\$registeredWebhooks\\.$#"
count: 2
path: src/Webhook/WebhookRegistry.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Checkout\\\\Card\\\\AbstractCardValidatorTestCase has an uninitialized property \\$systemConfigService\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Checkout/Card/AbstractCardValidatorTestCase.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Checkout\\\\Card\\\\AbstractCardValidatorTestCase has an uninitialized property \\$validator\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Checkout/Card/AbstractCardValidatorTestCase.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Checkout\\\\Method\\\\AbstractTestSyncAPMHandler has an uninitialized property \\$clientFactory\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Checkout/Method/AbstractTestSyncAPMHandler.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Checkout\\\\Method\\\\PUIHandlerTest has an uninitialized property \\$session\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Checkout/Method/PUIHandlerTest.php

-
message: "#^Mixed variable in a `\\$criteria\\-\\>\\.\\.\\.\\(\\)` can skip important errors\\. Make sure the type is known$#"
count: 1
Expand All @@ -205,26 +110,11 @@ parameters:
count: 1
path: tests/Checkout/Payment/MessageQueue/TransactionStatusSyncMessageHandlerTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Checkout\\\\Payment\\\\PayPalPaymentHandlerTest has an uninitialized property \\$clientFactory\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Checkout/Payment/PayPalPaymentHandlerTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Checkout\\\\Plus\\\\PlusPaymentFinalizeControllerTest has an uninitialized property \\$orderTransactionStateHandler\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Checkout/Plus/PlusPaymentFinalizeControllerTest.php

-
message: "#^Class like namespace \"Swag\\\\PayPal\\\\Test\\\\Installment\\\\Banner\" does not follow PSR\\-4 configuration in composer\\.json$#"
count: 1
path: tests/Installment/Banner/Service/BannerDataServiceTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Mock\\\\PayPal\\\\Client\\\\GuzzleClientMock has an uninitialized property \\$data\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Mock/PayPal/Client/GuzzleClientMock.php

-
message: "#^Mixed variable in a `\\$struct\\-\\>\\.\\.\\.\\(\\)` can skip important errors\\. Make sure the type is known$#"
count: 1
Expand All @@ -240,46 +130,6 @@ parameters:
count: 2
path: tests/OrdersApi/Builder/APMOrderBuilderTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Api\\\\Common\\\\_fixtures\\\\TestStruct has an uninitialized property \\$bar\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Api/Common/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Api\\\\Common\\\\_fixtures\\\\TestStruct has an uninitialized property \\$foo\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Api/Common/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Api\\\\Common\\\\_fixtures\\\\TestStruct has an uninitialized property \\$id\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Api/Common/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Api\\\\Common\\\\_fixtures\\\\TestStruct has an uninitialized property \\$notExistingClass\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Api/Common/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Api\\\\Common\\\\_fixtures\\\\TestStruct has an uninitialized property \\$notExistingCollectionClass\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Api/Common/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Api\\\\Common\\\\_fixtures\\\\TestStruct\\\\Bar has an uninitialized property \\$bar\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Api/Common/_fixtures/TestStruct/Bar.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Api\\\\Common\\\\_fixtures\\\\TestStruct\\\\Foo has an uninitialized property \\$fooBaz\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Api/Common/_fixtures/TestStruct/Foo.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Api\\\\Common\\\\_fixtures\\\\TestStruct\\\\Foo has an uninitialized property \\$fooBoo\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Api/Common/_fixtures/TestStruct/Foo.php

-
message: "#^Provide more specific return type \"GuzzleHttp\\\\Psr7\\\\Response\" over abstract one$#"
count: 1
Expand All @@ -290,11 +140,6 @@ parameters:
count: 1
path: tests/Pos/Mock/MessageBusMock.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Mock\\\\ProductContextMock has an uninitialized property \\$status\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Mock/ProductContextMock.php

-
message: "#^Parameter \\#1 \\$entity of method Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\EntityCollection\\<Shopware\\\\Core\\\\Content\\\\Product\\\\ProductEntity\\>\\:\\:add\\(\\) expects Shopware\\\\Core\\\\Content\\\\Product\\\\ProductEntity, Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Entity given\\.$#"
count: 2
Expand All @@ -310,36 +155,6 @@ parameters:
count: 2
path: tests/Pos/Run/PosSyncControllerTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Util\\\\SettingsControllerTest has an uninitialized property \\$messageBus\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Util/SettingsControllerTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Util\\\\SettingsControllerTest has an uninitialized property \\$productVisibilityRepository\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Util/SettingsControllerTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Util\\\\SettingsControllerTest has an uninitialized property \\$runRepository\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Util/SettingsControllerTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Util\\\\SettingsControllerTest has an uninitialized property \\$runService\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Util/SettingsControllerTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Util\\\\SettingsControllerTest has an uninitialized property \\$salesChannelProductRepository\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Util/SettingsControllerTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Pos\\\\Util\\\\SettingsControllerTest has an uninitialized property \\$salesChannelRepository\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Pos/Util/SettingsControllerTest.php

-
message: "#^Class like namespace \"Swag\\\\PayPal\\\\Test\\\\Pos\\\\Util\" does not follow PSR\\-4 configuration in composer\\.json$#"
count: 1
Expand Down Expand Up @@ -370,61 +185,6 @@ parameters:
count: 2
path: tests/RestApi/PayPalApiStructStructureTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\RestApi\\\\V1\\\\Resource\\\\WebhookResourceTest has an uninitialized property \\$clientFactory\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/RestApi/V1/Resource/WebhookResourceTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\RestApi\\\\_fixtures\\\\TestStruct has an uninitialized property \\$bar\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/RestApi/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\RestApi\\\\_fixtures\\\\TestStruct has an uninitialized property \\$foo\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/RestApi/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\RestApi\\\\_fixtures\\\\TestStruct has an uninitialized property \\$id\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/RestApi/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\RestApi\\\\_fixtures\\\\TestStruct has an uninitialized property \\$notExistingClass\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/RestApi/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\RestApi\\\\_fixtures\\\\TestStruct has an uninitialized property \\$notExistingCollectionClass\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/RestApi/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\RestApi\\\\_fixtures\\\\TestStruct has an uninitialized property \\$scalarArray\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/RestApi/_fixtures/TestStruct.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\RestApi\\\\_fixtures\\\\TestStruct\\\\Bar has an uninitialized property \\$bar\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/RestApi/_fixtures/TestStruct/Bar.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\RestApi\\\\_fixtures\\\\TestStruct\\\\Foo has an uninitialized property \\$fooBaz\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/RestApi/_fixtures/TestStruct/Foo.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Setting\\\\Service\\\\MerchantIntegrationsServiceTest has an uninitialized property \\$clientFactory\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Setting/Service/MerchantIntegrationsServiceTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Setting\\\\Service\\\\MerchantIntegrationsServiceTest has an uninitialized property \\$systemConfigService\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Setting/Service/MerchantIntegrationsServiceTest.php

-
message: "#^Class like namespace \"\" does not follow PSR\\-4 configuration in composer\\.json$#"
count: 1
Expand All @@ -440,11 +200,6 @@ parameters:
count: 4
path: tests/Storefront/Data/CheckoutSubscriberTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Storefront\\\\Data\\\\FundingSubscriberTest has an uninitialized property \\$session\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Storefront/Data/FundingSubscriberTest.php

-
message: "#^Class like namespace \"Shopware\\\\Core\" does not follow PSR\\-4 configuration in composer\\.json$#"
count: 1
Expand All @@ -464,13 +219,3 @@ parameters:
message: "#^Class like namespace \"Swag\\\\PayPal\\\\Test\\\\Util\\\\Lifecycle\" does not follow PSR\\-4 configuration in composer\\.json$#"
count: 1
path: tests/Util/Availability/AvailabilityServiceTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Util\\\\Lifecycle\\\\State\\\\PaymentMethodStateServiceTest has an uninitialized property \\$paymentMethodRepository\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Util/Lifecycle/State/PaymentMethodStateServiceTest.php

-
message: "#^Class Swag\\\\PayPal\\\\Test\\\\Webhook\\\\Handler\\\\SaleRefundedTest has an uninitialized property \\$sale\\. Give it default value or assign it in the constructor\\.$#"
count: 1
path: tests/Webhook/Handler/SaleRefundedTest.php
27 changes: 1 addition & 26 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
includes:
- phpstan-baseline.neon
- %ShopwareRoot%/vendor/phpstan/phpstan/conf/bleedingEdge.neon
- phar://phpstan.phar/conf/bleedingEdge.neon
- %ShopwareRoot%/src/Core/DevOps/StaticAnalyze/PHPStan/extension.neon
- %ShopwareRoot%/src/Core/DevOps/StaticAnalyze/PHPStan/rules.neon

Expand All @@ -11,7 +11,6 @@ parameters:
treatPhpDocTypesAsCertain: false
checkFunctionNameCase: true
checkInternalClassCaseSensitivity: true
checkUninitializedProperties: true
reportUnmatchedIgnoredErrors: true

paths:
Expand Down Expand Up @@ -48,24 +47,6 @@ parameters:
- '#.* generic class Shopware\\Core\\System\\SalesChannel\\Entity\\SalesChannelRepository.*not specify its types: TEntityCollection#'
- '#.* generic class Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\EntitySearchResult.*does not specify its types: TEntityCollection#'

- # Ignore uninitialized property in structs
message: '#Class .* has an uninitialized property .* Give it default value or assign it in the constructor#'
paths:
- src/Checkout/ExpressCheckout/ExpressCheckoutButtonData.php
- src/Checkout/PUI/PUIFraudNetData.php
- src/Checkout/PUI/PUIPaymentInstructionData.php
- src/Checkout/Plus/PlusData.php
- src/Checkout/SPBCheckout/SPBCheckoutButtonData.php
- src/DataAbstractionLayer
- src/Installment/Banner/BannerData.php
- src/RestApi
- src/Setting/Struct
- src/Storefront/Data/Struct
- src/Pos/Api
- src/Pos/DataAbstractionLayer/Entity
- src/Pos/MessageQueue/Message
- src/Pos/Setting/Struct

- # This service gets registered within Cms Extensions
message: '#is not registered in the container#'
path: tests/Checkout/ExpressCheckout/ExpressCheckoutSubscriberTest.php
Expand Down Expand Up @@ -95,10 +76,6 @@ parameters:
- src/Pos/Schedule/AbstractSyncTaskHandler.php
- src/Reporting/ScheduledTask/TurnoverReportingTaskHandler.php

- # The RouteScopeRule seems to be broken if extending a controller
message: '#Method Shopware\\Core\\System\\SystemConfig\\Api\\SystemConfigController::.* has no route scope defined. Please add a route scope to the method or the class#'
path: src/Webhook/Registration/WebhookSystemConfigController.php

- # ignore shopware v6.7 payment handlers refactor deprecations
message: '#tag:v6.7.0 -.*PaymentTransactionStruct#'
paths:
Expand All @@ -123,8 +100,6 @@ parameters:
- # ignore shopware v6.7 payment handlers refactor deprecations
message: '#Swag\\PayPal\\Pos\\Payment\\PosPayment#'
paths:
- src/Pos/Setting/Service/InformationDefaultService.php
- tests/Checkout/CheckoutSubscriberTest.php
- tests/Pos/Util/InformationDefaultServiceTest.php

- # ignore shopware v6.7 native type deprecations
Expand Down
Loading

0 comments on commit c314e10

Please sign in to comment.