From f0380cf11897655a506179d79fdd9eac37bf3110 Mon Sep 17 00:00:00 2001 From: Lorenzo Ruozzi Date: Mon, 13 May 2024 13:03:41 +0200 Subject: [PATCH] Fix PHPStan --- phpstan.neon | 5 +++-- src/Command/IndexCommand.php | 3 +++ src/Controller/ProductController.php | 3 +++ src/EventSubscriber/ProductEventSubscriber.php | 3 +++ src/EventSubscriber/ProductVariantSubscriber.php | 3 +++ src/MessageHandler/CreateIndexHandler.php | 3 +++ src/MessageHandler/RemoveDocumentIfExistsHandler.php | 3 +++ src/MessageHandler/UpsertDocumentHandler.php | 3 +++ src/Parser/ElasticsearchProductDocumentParser.php | 1 + tests/Behat/Context/Setup/ElasticsearchContext.php | 3 +++ tests/Behat/Context/Setup/ProductAttributeContext.php | 1 + 11 files changed, 29 insertions(+), 2 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 2235744..5852a62 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,12 +1,11 @@ parameters: level: max reportUnmatchedIgnoredErrors: false - checkMissingIterableValueType: false paths: - src - tests/Behat - excludes_analyse: + excludePaths: # Makes PHPStan crash - 'src/DependencyInjection/Configuration.php' @@ -16,3 +15,5 @@ parameters: ignoreErrors: - '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./' + - + identifier: missingType.iterableValue diff --git a/src/Command/IndexCommand.php b/src/Command/IndexCommand.php index f993d30..03120bf 100644 --- a/src/Command/IndexCommand.php +++ b/src/Command/IndexCommand.php @@ -19,6 +19,9 @@ final class IndexCommand extends Command { + /** + * @param ChannelRepositoryInterface $channelRepository + */ public function __construct( private readonly ChannelRepositoryInterface $channelRepository, private readonly MessageBusInterface $messageBus, diff --git a/src/Controller/ProductController.php b/src/Controller/ProductController.php index 5cc6eb8..b818b65 100644 --- a/src/Controller/ProductController.php +++ b/src/Controller/ProductController.php @@ -34,6 +34,9 @@ */ final class ProductController extends AbstractController implements ProductControllerInterface { + /** + * @param TaxonRepositoryInterface $taxonRepository + */ public function __construct( private readonly TaxonRepositoryInterface $taxonRepository, private readonly LocaleContextInterface $localeContext, diff --git a/src/EventSubscriber/ProductEventSubscriber.php b/src/EventSubscriber/ProductEventSubscriber.php index dc5b2b9..b0896b5 100644 --- a/src/EventSubscriber/ProductEventSubscriber.php +++ b/src/EventSubscriber/ProductEventSubscriber.php @@ -18,6 +18,9 @@ final readonly class ProductEventSubscriber implements EventSubscriberInterface { + /** + * @param ChannelRepositoryInterface $channelRepository + */ public function __construct( private MessageBusInterface $messageBus, private LoggerInterface $logger, diff --git a/src/EventSubscriber/ProductVariantSubscriber.php b/src/EventSubscriber/ProductVariantSubscriber.php index c27d02b..257980a 100644 --- a/src/EventSubscriber/ProductVariantSubscriber.php +++ b/src/EventSubscriber/ProductVariantSubscriber.php @@ -19,6 +19,9 @@ final readonly class ProductVariantSubscriber implements EventSubscriberInterface { + /** + * @param ChannelRepositoryInterface $channelRepository + */ public function __construct( private MessageBusInterface $messageBus, private LoggerInterface $logger, diff --git a/src/MessageHandler/CreateIndexHandler.php b/src/MessageHandler/CreateIndexHandler.php index fecc40d..693fbbe 100644 --- a/src/MessageHandler/CreateIndexHandler.php +++ b/src/MessageHandler/CreateIndexHandler.php @@ -13,6 +13,9 @@ final readonly class CreateIndexHandler { + /** + * @param ChannelRepositoryInterface $channelRepository + */ public function __construct( private ChannelRepositoryInterface $channelRepository, private DocumentTypeProviderInterface $documentTypeProvider, diff --git a/src/MessageHandler/RemoveDocumentIfExistsHandler.php b/src/MessageHandler/RemoveDocumentIfExistsHandler.php index 5066411..7cd354b 100644 --- a/src/MessageHandler/RemoveDocumentIfExistsHandler.php +++ b/src/MessageHandler/RemoveDocumentIfExistsHandler.php @@ -13,6 +13,9 @@ final readonly class RemoveDocumentIfExistsHandler { + /** + * @param ChannelRepositoryInterface $channelRepository + */ public function __construct( private ChannelRepositoryInterface $channelRepository, private DocumentTypeProviderInterface $documentTypeProvider, diff --git a/src/MessageHandler/UpsertDocumentHandler.php b/src/MessageHandler/UpsertDocumentHandler.php index 5f4a720..4c5f883 100644 --- a/src/MessageHandler/UpsertDocumentHandler.php +++ b/src/MessageHandler/UpsertDocumentHandler.php @@ -13,6 +13,9 @@ final readonly class UpsertDocumentHandler { + /** + * @param ChannelRepositoryInterface $channelRepository + */ public function __construct( private ChannelRepositoryInterface $channelRepository, private DocumentTypeProviderInterface $documentTypeProvider, diff --git a/src/Parser/ElasticsearchProductDocumentParser.php b/src/Parser/ElasticsearchProductDocumentParser.php index b52a389..7cf5f48 100644 --- a/src/Parser/ElasticsearchProductDocumentParser.php +++ b/src/Parser/ElasticsearchProductDocumentParser.php @@ -40,6 +40,7 @@ final class ElasticsearchProductDocumentParser implements DocumentParserInterfac /** * @param FactoryInterface $productImageFactory + * @param ProductVariantFactoryInterface $productVariantFactory * @param FactoryInterface $channelPricingFactory * @param FactoryInterface $catalogPromotionFactory * @param FactoryInterface $productOptionFactory diff --git a/tests/Behat/Context/Setup/ElasticsearchContext.php b/tests/Behat/Context/Setup/ElasticsearchContext.php index 54b0994..9643153 100644 --- a/tests/Behat/Context/Setup/ElasticsearchContext.php +++ b/tests/Behat/Context/Setup/ElasticsearchContext.php @@ -12,6 +12,9 @@ final readonly class ElasticsearchContext implements Context { + /** + * @param ChannelRepositoryInterface $channelRepository + */ public function __construct( private ChannelRepositoryInterface $channelRepository, private DocumentTypeProviderInterface $documentTypeProvider, diff --git a/tests/Behat/Context/Setup/ProductAttributeContext.php b/tests/Behat/Context/Setup/ProductAttributeContext.php index d6d53ec..e4edf60 100644 --- a/tests/Behat/Context/Setup/ProductAttributeContext.php +++ b/tests/Behat/Context/Setup/ProductAttributeContext.php @@ -24,6 +24,7 @@ * @param RepositoryInterface $productAttributeRepository * @param FactoryInterface $productAttributeValueFactory * @param FactoryInterface $productAttributeTranslationFactory + * @param AttributeFactoryInterface $productAttributeFactory */ public function __construct( private RepositoryInterface $productAttributeRepository,