diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa478d4..f56a82e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: fail-fast: false matrix: php: ["8.0", "8.1"] - symfony: ["^6.0"] + symfony: ["5.4.*", "^6.0"] sylius: ["^1.12"] node: ["14.x", "16.x", "18.x"] mysql: ["5.7", "8.0"] diff --git a/composer.json b/composer.json index 0cd54a9..75fa0dc 100644 --- a/composer.json +++ b/composer.json @@ -37,12 +37,12 @@ "phpunit/phpunit": "^9.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "sylius-labs/coding-standard": "^4.2", - "symfony/browser-kit": "^6.0", - "symfony/debug-bundle": "^6.0", - "symfony/dotenv": "^6.0", + "symfony/browser-kit": "^5.4 || ^6.0", + "symfony/debug-bundle": "^5.4 || ^6.0", + "symfony/dotenv": "^5.4 || ^6.0", "symfony/flex": "^2.2.2", - "symfony/intl": "^6.0", - "symfony/web-profiler-bundle": "^6.0", + "symfony/intl": "^5.4 || ^6.0", + "symfony/web-profiler-bundle": "^5.4 || ^6.0", "vimeo/psalm": "5.9.0" }, "conflict": { @@ -61,7 +61,7 @@ }, "extra": { "symfony": { - "require": "^6.0" + "require": "^5.4 || ^6.0" } }, "autoload": { diff --git a/src/Controller/VendorSlugController.php b/src/Controller/VendorSlugController.php index f930a63..015ab0c 100644 --- a/src/Controller/VendorSlugController.php +++ b/src/Controller/VendorSlugController.php @@ -11,11 +11,9 @@ final class VendorSlugController { - private SlugGeneratorInterface $slugGenerator; - - public function __construct(SlugGeneratorInterface $slugGenerator) - { - $this->slugGenerator = $slugGenerator; + public function __construct( + private SlugGeneratorInterface $slugGenerator + ) { } public function generate(Request $request): Response diff --git a/src/Event/VendorFormMenuBuilderEvent.php b/src/Event/VendorFormMenuBuilderEvent.php index c42001f..3f12041 100644 --- a/src/Event/VendorFormMenuBuilderEvent.php +++ b/src/Event/VendorFormMenuBuilderEvent.php @@ -11,13 +11,12 @@ class VendorFormMenuBuilderEvent extends MenuBuilderEvent { - private VendorInterface $vendor; - - public function __construct(FactoryInterface $factory, ItemInterface $menu, VendorInterface $vendor) - { + public function __construct( + FactoryInterface $factory, + ItemInterface $menu, + private VendorInterface $vendor + ) { parent::__construct($factory, $menu); - - $this->vendor = $vendor; } public function getVendor(): VendorInterface diff --git a/src/EventListener/VendorLogoUploadListener.php b/src/EventListener/VendorLogoUploadListener.php index 22a5432..58c1508 100644 --- a/src/EventListener/VendorLogoUploadListener.php +++ b/src/EventListener/VendorLogoUploadListener.php @@ -11,11 +11,9 @@ final class VendorLogoUploadListener { - private VendorLogoUploaderInterface $uploader; - - public function __construct(VendorLogoUploaderInterface $uploader) - { - $this->uploader = $uploader; + public function __construct( + private VendorLogoUploaderInterface $uploader + ) { } public function uploadLogo(GenericEvent $event): void diff --git a/src/Fixture/Factory/ProductExampleFactory.php b/src/Fixture/Factory/ProductExampleFactory.php index 8d19fa3..dd929be 100644 --- a/src/Fixture/Factory/ProductExampleFactory.php +++ b/src/Fixture/Factory/ProductExampleFactory.php @@ -19,11 +19,10 @@ class ProductExampleFactory extends BaseProductExampleFactory { - protected RepositoryInterface $vendorRepository; protected OptionsResolver $optionsResolver; public function __construct( - RepositoryInterface $vendorRepository, + protected RepositoryInterface $vendorRepository, FactoryInterface $productFactory, FactoryInterface $productVariantFactory, FactoryInterface $channelPricing, @@ -41,8 +40,6 @@ public function __construct( RepositoryInterface $taxCategoryRepository, ?FileLocatorInterface $fileLocator = null ) { - $this->vendorRepository = $vendorRepository; - $this->optionsResolver = new OptionsResolver(); parent::__construct( diff --git a/src/Fixture/Factory/VendorExampleFactory.php b/src/Fixture/Factory/VendorExampleFactory.php index f990f30..28e25a4 100644 --- a/src/Fixture/Factory/VendorExampleFactory.php +++ b/src/Fixture/Factory/VendorExampleFactory.php @@ -22,27 +22,16 @@ class VendorExampleFactory implements ExampleFactoryInterface { - protected FactoryInterface $vendorFactory; - protected VendorLogoUploaderInterface $vendorLogoUploader; - protected RepositoryInterface $channelRepository; - protected RepositoryInterface $localeRepository; protected FakerGenerator $faker; - protected ?FileLocatorInterface $fileLocator; protected OptionsResolver $optionsResolver; public function __construct( - FactoryInterface $vendorFactory, - VendorLogoUploaderInterface $vendorLogoUploader, - RepositoryInterface $channelRepository, - RepositoryInterface $localeRepository, - ?FileLocatorInterface $fileLocator = null + protected FactoryInterface $vendorFactory, + protected VendorLogoUploaderInterface $vendorLogoUploader, + protected RepositoryInterface $channelRepository, + protected RepositoryInterface $localeRepository, + protected ?FileLocatorInterface $fileLocator = null ) { - $this->vendorFactory = $vendorFactory; - $this->vendorLogoUploader = $vendorLogoUploader; - $this->channelRepository = $channelRepository; - $this->localeRepository = $localeRepository; - $this->fileLocator = $fileLocator; - $this->faker = Factory::create(); $this->optionsResolver = new OptionsResolver(); diff --git a/src/Form/Type/VendorChoiceType.php b/src/Form/Type/VendorChoiceType.php index 3306f72..d2fd512 100644 --- a/src/Form/Type/VendorChoiceType.php +++ b/src/Form/Type/VendorChoiceType.php @@ -15,12 +15,9 @@ final class VendorChoiceType extends AbstractType { - private VendorRepositoryInterface $vendorRepository; - public function __construct( - VendorRepositoryInterface $vendorRepository + private VendorRepositoryInterface $vendorRepository ) { - $this->vendorRepository = $vendorRepository; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Mapping/VendorAwareListener.php b/src/Mapping/VendorAwareListener.php index 417100b..f9646a8 100644 --- a/src/Mapping/VendorAwareListener.php +++ b/src/Mapping/VendorAwareListener.php @@ -19,21 +19,12 @@ final class VendorAwareListener implements EventSubscriber { - private RegistryInterface $resourceMetadataRegistry; - private string $vendorClass; - private string $productClass; - private string $channelClass; - public function __construct( - RegistryInterface $resourceMetadataRegistry, - string $vendorClass, - string $productClass, - string $channelClass + private RegistryInterface $resourceMetadataRegistry, + private string $vendorClass, + private string $productClass, + private string $channelClass ) { - $this->resourceMetadataRegistry = $resourceMetadataRegistry; - $this->vendorClass = $vendorClass; - $this->productClass = $productClass; - $this->channelClass = $channelClass; } public function getSubscribedEvents(): array diff --git a/src/Menu/VendorFormMenuBuilder.php b/src/Menu/VendorFormMenuBuilder.php index e37a105..3469066 100644 --- a/src/Menu/VendorFormMenuBuilder.php +++ b/src/Menu/VendorFormMenuBuilder.php @@ -12,13 +12,10 @@ final class VendorFormMenuBuilder { - private FactoryInterface $factory; - private EventDispatcherInterface $eventDispatcher; - - public function __construct(FactoryInterface $factory, EventDispatcherInterface $eventDispatcher) - { - $this->factory = $factory; - $this->eventDispatcher = $eventDispatcher; + public function __construct( + private FactoryInterface $factory, + private EventDispatcherInterface $eventDispatcher + ) { } public function createMenu(array $options = []): ItemInterface diff --git a/src/SitemapProvider/VendorUrlProvider.php b/src/SitemapProvider/VendorUrlProvider.php index 20738ac..2948029 100644 --- a/src/SitemapProvider/VendorUrlProvider.php +++ b/src/SitemapProvider/VendorUrlProvider.php @@ -8,8 +8,8 @@ use Odiseo\SyliusVendorPlugin\Entity\VendorInterface; use Odiseo\SyliusVendorPlugin\Entity\VendorTranslation; use Odiseo\SyliusVendorPlugin\Repository\VendorRepositoryInterface; -use SitemapPlugin\Factory\UrlFactoryInterface; use SitemapPlugin\Factory\AlternativeUrlFactoryInterface; +use SitemapPlugin\Factory\UrlFactoryInterface; use SitemapPlugin\Model\ChangeFrequency; use SitemapPlugin\Model\UrlInterface; use SitemapPlugin\Provider\UrlProviderInterface; @@ -21,25 +21,13 @@ final class VendorUrlProvider implements UrlProviderInterface { - private VendorRepositoryInterface $vendorRepository; - private RouterInterface $router; - private UrlFactoryInterface $sitemapUrlFactory; - private AlternativeUrlFactoryInterface $urlAlternativeFactory; - private LocaleContextInterface $localeContext; - private ChannelInterface $channel; - public function __construct( - VendorRepositoryInterface $vendorRepository, - RouterInterface $router, - UrlFactoryInterface $sitemapUrlFactory, - AlternativeUrlFactoryInterface $urlAlternativeFactory, - LocaleContextInterface $localeContext + private VendorRepositoryInterface $vendorRepository, + private RouterInterface $router, + private UrlFactoryInterface $sitemapUrlFactory, + private AlternativeUrlFactoryInterface $urlAlternativeFactory, + private LocaleContextInterface $localeContext ) { - $this->vendorRepository = $vendorRepository; - $this->router = $router; - $this->sitemapUrlFactory = $sitemapUrlFactory; - $this->urlAlternativeFactory = $urlAlternativeFactory; - $this->localeContext = $localeContext; } public function getName(): string diff --git a/src/Uploader/VendorLogoUploader.php b/src/Uploader/VendorLogoUploader.php index c30dd24..2ee573e 100644 --- a/src/Uploader/VendorLogoUploader.php +++ b/src/Uploader/VendorLogoUploader.php @@ -10,12 +10,9 @@ final class VendorLogoUploader implements VendorLogoUploaderInterface { - private FilesystemInterface $filesystem; - public function __construct( - FilesystemInterface $filesystem + private FilesystemInterface $filesystem ) { - $this->filesystem = $filesystem; } public function upload(VendorInterface $vendor): void