Skip to content

Commit

Permalink
Merge pull request #21 from odiseoteam/1.8
Browse files Browse the repository at this point in the history
Improvements
  • Loading branch information
bigboss86 committed Apr 25, 2023
2 parents 3f297d5 + a281d1c commit df17baa
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -61,7 +61,7 @@
},
"extra": {
"symfony": {
"require": "^6.0"
"require": "^5.4 || ^6.0"
}
},
"autoload": {
Expand Down
8 changes: 3 additions & 5 deletions src/Controller/VendorSlugController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions src/Event/VendorFormMenuBuilderEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions src/EventListener/VendorLogoUploadListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions src/Fixture/Factory/ProductExampleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -41,8 +40,6 @@ public function __construct(
RepositoryInterface $taxCategoryRepository,
?FileLocatorInterface $fileLocator = null
) {
$this->vendorRepository = $vendorRepository;

$this->optionsResolver = new OptionsResolver();

parent::__construct(
Expand Down
21 changes: 5 additions & 16 deletions src/Fixture/Factory/VendorExampleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
5 changes: 1 addition & 4 deletions src/Form/Type/VendorChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 4 additions & 13 deletions src/Mapping/VendorAwareListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 4 additions & 7 deletions src/Menu/VendorFormMenuBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 6 additions & 18 deletions src/SitemapProvider/VendorUrlProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions src/Uploader/VendorLogoUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit df17baa

Please sign in to comment.