[Shop][Twig][Component] Replace private with protected constructor parameters

This commit is contained in:
Wojdylak 2024-11-19 15:34:44 +01:00
parent f5b5aeb6cc
commit e51bcc5cc1
No known key found for this signature in database
GPG key ID: 7509E560A6821ABE
18 changed files with 51 additions and 51 deletions

View file

@ -36,8 +36,8 @@ class ChangePasswordFormComponent
/** @param class-string $formClass */
public function __construct(
private readonly FormFactoryInterface $formFactory,
private readonly string $formClass,
protected readonly FormFactoryInterface $formFactory,
protected readonly string $formClass,
) {
}

View file

@ -50,8 +50,8 @@ class FormComponent
FormFactoryInterface $formFactory,
string $resourceClass,
string $formClass,
private readonly ObjectManager $manager,
private readonly EventDispatcherInterface $eventDispatcher,
protected readonly ObjectManager $manager,
protected readonly EventDispatcherInterface $eventDispatcher,
) {
$this->initialize($orderRepository, $formFactory, $resourceClass, $formClass);
}

View file

@ -43,7 +43,7 @@ class WidgetComponent
/** @param OrderRepositoryInterface<OrderInterface> $orderRepository */
public function __construct(
private readonly CartContextInterface $cartContext,
protected readonly CartContextInterface $cartContext,
OrderRepositoryInterface $orderRepository,
) {
$this->initialize($orderRepository);

View file

@ -41,7 +41,7 @@ class AddressBookComponent
public string $field;
public function __construct(
private readonly CustomerContextInterface $customerContext,
protected readonly CustomerContextInterface $customerContext,
) {
}

View file

@ -49,9 +49,9 @@ class FormComponent
FormFactoryInterface $formFactory,
string $resourceClass,
string $formClass,
private readonly CustomerContextInterface $customerContext,
private readonly UserRepositoryInterface $shopUserRepository,
private readonly AddressRepositoryInterface $addressRepository,
protected readonly CustomerContextInterface $customerContext,
protected readonly UserRepositoryInterface $shopUserRepository,
protected readonly AddressRepositoryInterface $addressRepository,
) {
$this->initialize($repository, $formFactory, $resourceClass, $formClass);
}

View file

@ -24,8 +24,8 @@ use Symfony\UX\TwigComponent\Attribute\ExposeInTemplate;
readonly class CurrencySwitcherComponent
{
public function __construct(
private ChannelContextInterface $channelContext,
private CurrencyContextInterface $currencyContext,
protected ChannelContextInterface $channelContext,
protected CurrencyContextInterface $currencyContext,
) {
}

View file

@ -22,8 +22,8 @@ use Symfony\UX\TwigComponent\Attribute\ExposeInTemplate;
readonly class LocaleSwitcherComponent
{
public function __construct(
private LocaleContextInterface $localeContext,
private LocaleProviderInterface $localeProvider,
protected LocaleContextInterface $localeContext,
protected LocaleProviderInterface $localeProvider,
) {
}

View file

@ -28,9 +28,9 @@ readonly class TaxonMenuComponent
* @param TaxonRepositoryInterface<TaxonInterface> $taxonRepository
*/
public function __construct(
private TaxonRepositoryInterface $taxonRepository,
private ChannelContextInterface $channelContext,
private LocaleContextInterface $localeContext,
protected TaxonRepositoryInterface $taxonRepository,
protected ChannelContextInterface $channelContext,
protected LocaleContextInterface $localeContext,
) {
}

View file

@ -15,7 +15,7 @@ namespace Sylius\Bundle\ShopBundle\Twig\Component\Product;
use Doctrine\Persistence\ObjectManager;
use Sylius\Bundle\CoreBundle\Provider\FlashBagProvider;
use Sylius\Bundle\OrderBundle\Factory\AddToCartCommandFactory;
use Sylius\Bundle\OrderBundle\Factory\AddToCartCommandFactoryInterface;
use Sylius\Bundle\ShopBundle\Twig\Component\Product\Trait\ProductLivePropTrait;
use Sylius\Bundle\ShopBundle\Twig\Component\Product\Trait\ProductVariantLivePropTrait;
use Sylius\Bundle\UiBundle\Twig\Component\TemplatePropTrait;
@ -71,15 +71,15 @@ class AddToCartFormComponent
* @param ProductVariantRepositoryInterface<ProductVariantInterface> $productVariantRepository
*/
public function __construct(
private readonly FormFactoryInterface $formFactory,
private readonly ObjectManager $manager,
private readonly RouterInterface $router,
private readonly RequestStack $requestStack,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly CartContextInterface $cartContext,
private readonly AddToCartCommandFactory $addToCartCommandFactory,
private readonly CartItemFactoryInterface $cartItemFactory,
private readonly string $formClass,
protected readonly FormFactoryInterface $formFactory,
protected readonly ObjectManager $manager,
protected readonly RouterInterface $router,
protected readonly RequestStack $requestStack,
protected readonly EventDispatcherInterface $eventDispatcher,
protected readonly CartContextInterface $cartContext,
protected readonly AddToCartCommandFactoryInterface $addToCartCommandFactory,
protected readonly CartItemFactoryInterface $cartItemFactory,
protected readonly string $formClass,
ProductRepositoryInterface $productRepository,
ProductVariantRepositoryInterface $productVariantRepository,
) {

View file

@ -31,8 +31,8 @@ class AssociationComponent
* @param ProductAssociationRepositoryInterface<ProductAssociationInterface> $productAssociationRepository
*/
public function __construct(
private readonly ProductAssociationRepositoryInterface $productAssociationRepository,
private readonly ChannelContextInterface $channelContext,
protected readonly ProductAssociationRepositoryInterface $productAssociationRepository,
protected readonly ChannelContextInterface $channelContext,
) {
}

View file

@ -27,9 +27,9 @@ readonly class BreadcrumbComponent
* @param TaxonRepositoryInterface<TaxonInterface> $taxonRepository
*/
public function __construct(
private RequestStack $requestStack,
private TaxonRepositoryInterface $taxonRepository,
private LocaleContextInterface $localeContext,
protected RequestStack $requestStack,
protected TaxonRepositoryInterface $taxonRepository,
protected LocaleContextInterface $localeContext,
) {
}

View file

@ -30,9 +30,9 @@ class BySlugComponent
* @param ProductRepositoryInterface<ProductInterface> $productRepository
*/
public function __construct(
private readonly ProductRepositoryInterface $productRepository,
private readonly ChannelContextInterface $channelContext,
private readonly LocaleContextInterface $localeContext,
protected readonly ProductRepositoryInterface $productRepository,
protected readonly ChannelContextInterface $channelContext,
protected readonly LocaleContextInterface $localeContext,
) {
}

View file

@ -41,11 +41,11 @@ class CardComponent
* @param ProductRepositoryInterface<ProductInterface> $productRepository
*/
public function __construct(
private readonly ProductRepositoryInterface $productRepository,
private readonly ProductVariantResolverInterface $productVariantResolver,
private readonly ChannelContextInterface $channelContext,
private readonly LocaleContextInterface $localeContext,
private readonly ProductVariantPricesCalculatorInterface $productVariantPricesCalculator,
protected readonly ProductRepositoryInterface $productRepository,
protected readonly ProductVariantResolverInterface $productVariantResolver,
protected readonly ChannelContextInterface $channelContext,
protected readonly LocaleContextInterface $localeContext,
protected readonly ProductVariantPricesCalculatorInterface $productVariantPricesCalculator,
) {
}

View file

@ -33,9 +33,9 @@ class ListComponent
/** @param ProductRepositoryInterface<ProductInterface> $productRepository */
public function __construct(
private readonly ProductRepositoryInterface $productRepository,
private readonly LocaleContextInterface $localeContext,
private readonly ChannelContextInterface $channelContext,
protected readonly ProductRepositoryInterface $productRepository,
protected readonly LocaleContextInterface $localeContext,
protected readonly ChannelContextInterface $channelContext,
) {
}

View file

@ -43,12 +43,12 @@ class PriceComponent
public bool $hasDiscount = false;
public function __construct(
private readonly ProductVariantPricesCalculatorInterface $productVariantPricesCalculator,
private readonly MoneyFormatterInterface $moneyFormatter,
private readonly ChannelContextInterface $channelContext,
private readonly LocaleContextInterface $localeContext,
private readonly CurrencyContextInterface $currencyContext,
private readonly CurrencyConverterInterface $currencyConverter,
protected readonly ProductVariantPricesCalculatorInterface $productVariantPricesCalculator,
protected readonly MoneyFormatterInterface $moneyFormatter,
protected readonly ChannelContextInterface $channelContext,
protected readonly LocaleContextInterface $localeContext,
protected readonly CurrencyContextInterface $currencyContext,
protected readonly CurrencyConverterInterface $currencyConverter,
) {
}

View file

@ -42,7 +42,7 @@ class SummaryComponent
* @param ProductVariantRepositoryInterface<ProductVariantInterface> $productVariantRepository
*/
public function __construct(
private readonly ProductVariantResolverInterface $productVariantResolver,
protected readonly ProductVariantResolverInterface $productVariantResolver,
ProductRepositoryInterface $productRepository,
ProductVariantRepositoryInterface $productVariantRepository,
) {

View file

@ -27,7 +27,7 @@ class CountComponent
/**
* @param ProductReviewRepositoryInterface<ProductReview> $productReviewRepository
*/
public function __construct(private readonly ProductReviewRepositoryInterface $productReviewRepository)
public function __construct(protected readonly ProductReviewRepositoryInterface $productReviewRepository)
{
}

View file

@ -32,7 +32,7 @@ class ListComponent
/**
* @param ProductReviewRepositoryInterface<ProductReview> $productReviewRepository
*/
public function __construct(private readonly ProductReviewRepositoryInterface $productReviewRepository)
public function __construct(protected readonly ProductReviewRepositoryInterface $productReviewRepository)
{
}