diff --git a/src/Assigner/ProductsAssigner.php b/src/Assigner/ProductsAssigner.php index e82a62f6..d605a23f 100644 --- a/src/Assigner/ProductsAssigner.php +++ b/src/Assigner/ProductsAssigner.php @@ -9,9 +9,6 @@ final class ProductsAssigner implements ProductsAssignerInterface { - /** - * @inheritdoc - */ public function assign(BrandInterface $brand, array $products): void { foreach ($products as $product) { diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index fd37a3c7..0841f3b1 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -21,9 +21,6 @@ final class Configuration implements ConfigurationInterface { - /** - * @inheritdoc - */ public function getConfigTreeBuilder(): TreeBuilder { if (method_exists(TreeBuilder::class, 'getRootNode')) { diff --git a/src/DependencyInjection/LoevgaardSyliusBrandExtension.php b/src/DependencyInjection/LoevgaardSyliusBrandExtension.php index 1c3ecbb1..7ad47337 100644 --- a/src/DependencyInjection/LoevgaardSyliusBrandExtension.php +++ b/src/DependencyInjection/LoevgaardSyliusBrandExtension.php @@ -12,8 +12,6 @@ final class LoevgaardSyliusBrandExtension extends AbstractResourceExtension { /** - * @inheritdoc - * * @throws \Exception */ public function load(array $config, ContainerBuilder $container): void diff --git a/src/Doctrine/ORM/BrandImageRepository.php b/src/Doctrine/ORM/BrandImageRepository.php index 427dff09..c6a390b6 100644 --- a/src/Doctrine/ORM/BrandImageRepository.php +++ b/src/Doctrine/ORM/BrandImageRepository.php @@ -10,9 +10,6 @@ class BrandImageRepository extends EntityRepository implements BrandImageRepositoryInterface { - /** - * @inheritdoc - */ public function createListQueryBuilder(string $brandCode): QueryBuilder { return $this->createQueryBuilder('o') @@ -22,9 +19,6 @@ public function createListQueryBuilder(string $brandCode): QueryBuilder ; } - /** - * @inheritdoc - */ public function createPaginatorForBrandAndType(BrandInterface $brand, string $type): iterable { $queryBuilder = $this->createQueryBuilder('o') diff --git a/src/Doctrine/ORM/BrandRepository.php b/src/Doctrine/ORM/BrandRepository.php index 1399b8df..a6af68ea 100644 --- a/src/Doctrine/ORM/BrandRepository.php +++ b/src/Doctrine/ORM/BrandRepository.php @@ -8,9 +8,6 @@ class BrandRepository extends EntityRepository implements BrandRepositoryInterface { - /** - * @inheritdoc - */ public function findByPhrase(string $phrase): array { return $this->createQueryBuilder('o') diff --git a/src/Doctrine/ORM/ProductRepositoryTrait.php b/src/Doctrine/ORM/ProductRepositoryTrait.php index dc15d35d..7ac7ed72 100644 --- a/src/Doctrine/ORM/ProductRepositoryTrait.php +++ b/src/Doctrine/ORM/ProductRepositoryTrait.php @@ -17,9 +17,6 @@ trait ProductRepositoryTrait */ abstract public function createQueryBuilder($alias, $indexBy = null); - /** - * @inheritdoc - */ public function createPaginatorForBrand(BrandInterface $brand): iterable { return $this->createQueryBuilder('o') diff --git a/src/Event/BrandMenuBuilderEvent.php b/src/Event/BrandMenuBuilderEvent.php index ba66aeea..7ad1efb0 100644 --- a/src/Event/BrandMenuBuilderEvent.php +++ b/src/Event/BrandMenuBuilderEvent.php @@ -11,14 +11,9 @@ class BrandMenuBuilderEvent extends MenuBuilderEvent { - /** @var BrandInterface */ - private $brand; - - public function __construct(FactoryInterface $factory, ItemInterface $menu, BrandInterface $brand) + public function __construct(FactoryInterface $factory, ItemInterface $menu, private readonly BrandInterface $brand) { parent::__construct($factory, $menu); - - $this->brand = $brand; } public function getBrand(): BrandInterface diff --git a/src/EventListener/ImageUploadListener.php b/src/EventListener/ImageUploadListener.php index 144ae566..59480728 100644 --- a/src/EventListener/ImageUploadListener.php +++ b/src/EventListener/ImageUploadListener.php @@ -11,12 +11,8 @@ final class ImageUploadListener { - /** @var ImageUploaderInterface */ - private $uploader; - - public function __construct(ImageUploaderInterface $uploader) + public function __construct(private readonly ImageUploaderInterface $uploader) { - $this->uploader = $uploader; } public function uploadImage(ResourceControllerEvent $event): void diff --git a/src/Factory/BrandImageFactory.php b/src/Factory/BrandImageFactory.php index 03a0708a..d04f0a9f 100644 --- a/src/Factory/BrandImageFactory.php +++ b/src/Factory/BrandImageFactory.php @@ -10,17 +10,10 @@ class BrandImageFactory implements BrandImageFactoryInterface { - /** @var FactoryInterface */ - private $factory; - - public function __construct(FactoryInterface $factory) + public function __construct(private readonly FactoryInterface $factory) { - $this->factory = $factory; } - /** - * @inheritdoc - */ public function createNew(): BrandImageInterface { /** @var BrandImageInterface $brandImage */ @@ -29,9 +22,6 @@ public function createNew(): BrandImageInterface return $brandImage; } - /** - * @inheritdoc - */ public function createForBrand(BrandInterface $brand): BrandImageInterface { /** @var BrandImageInterface $brandImage */ diff --git a/src/Fixture/Factory/BrandExampleFactory.php b/src/Fixture/Factory/BrandExampleFactory.php index 49ec8dfc..9887dcfa 100644 --- a/src/Fixture/Factory/BrandExampleFactory.php +++ b/src/Fixture/Factory/BrandExampleFactory.php @@ -103,7 +103,7 @@ protected function createImages(BrandInterface $brand, array $options): void if (is_array($imagePath)) { $imagePath = $imagePath[array_key_first($imagePath)]; } - $uploadedImage = new UploadedFile($imagePath, basename($imagePath)); + $uploadedImage = new UploadedFile($imagePath, basename((string) $imagePath)); /** @var BrandImageInterface $brandImage */ $brandImage = $this->productImageFactory->createNew(); diff --git a/src/Form/Extension/Api/ProductTypeExtension.php b/src/Form/Extension/Api/ProductTypeExtension.php index 3a211d6b..2b615370 100644 --- a/src/Form/Extension/Api/ProductTypeExtension.php +++ b/src/Form/Extension/Api/ProductTypeExtension.php @@ -11,9 +11,6 @@ class ProductTypeExtension extends AbstractTypeExtension { - /** - * @inheritdoc - */ public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('brand', BrandChoiceType::class, [ @@ -23,9 +20,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ]); } - /** - * @inheritdoc - */ public static function getExtendedTypes(): iterable { return [ diff --git a/src/Form/Extension/ProductTypeExtension.php b/src/Form/Extension/ProductTypeExtension.php index 9ea5ed2f..62d49375 100644 --- a/src/Form/Extension/ProductTypeExtension.php +++ b/src/Form/Extension/ProductTypeExtension.php @@ -11,9 +11,6 @@ class ProductTypeExtension extends AbstractTypeExtension { - /** - * @inheritdoc - */ public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('brand', BrandAutocompleteChoiceType::class, [ @@ -23,9 +20,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ]); } - /** - * @inheritdoc - */ public static function getExtendedTypes(): iterable { return [ diff --git a/src/Form/Type/BrandAutocompleteChoiceType.php b/src/Form/Type/BrandAutocompleteChoiceType.php index 76abf196..6e82f6da 100644 --- a/src/Form/Type/BrandAutocompleteChoiceType.php +++ b/src/Form/Type/BrandAutocompleteChoiceType.php @@ -12,9 +12,6 @@ final class BrandAutocompleteChoiceType extends AbstractType { - /** - * @inheritdoc - */ public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ @@ -24,26 +21,17 @@ public function configureOptions(OptionsResolver $resolver): void ]); } - /** - * @inheritdoc - */ public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['remote_criteria_type'] = 'contains'; $view->vars['remote_criteria_name'] = 'phrase'; } - /** - * @inheritdoc - */ public function getBlockPrefix(): string { return 'loevgaard_sylius_brand_autocomplete_choice'; } - /** - * @inheritdoc - */ public function getParent(): string { return ResourceAutocompleteChoiceType::class; diff --git a/src/Form/Type/BrandChoiceType.php b/src/Form/Type/BrandChoiceType.php index 8a47edcf..f62e57a6 100644 --- a/src/Form/Type/BrandChoiceType.php +++ b/src/Form/Type/BrandChoiceType.php @@ -14,17 +14,10 @@ final class BrandChoiceType extends AbstractType { - /** @var RepositoryInterface */ - private $brandRepository; - - public function __construct(RepositoryInterface $brandRepository) + public function __construct(private readonly RepositoryInterface $brandRepository) { - $this->brandRepository = $brandRepository; } - /** - * @inheritdoc - */ public function buildForm(FormBuilderInterface $builder, array $options): void { if ($options['multiple']) { @@ -32,32 +25,21 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } } - /** - * @inheritdoc - */ public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - 'choices' => function (Options $options) { - return $this->brandRepository->findAll(); - }, + 'choices' => fn (Options $options) => $this->brandRepository->findAll(), 'choice_value' => 'code', 'choice_label' => 'name', 'choice_translation_domain' => false, ]); } - /** - * @inheritdoc - */ public function getParent(): string { return ChoiceType::class; } - /** - * @inheritdoc - */ public function getBlockPrefix(): string { return 'loevgaard_sylius_brand_choice'; diff --git a/src/Form/Type/BrandImageType.php b/src/Form/Type/BrandImageType.php index 06589b5e..c4b2ea1a 100644 --- a/src/Form/Type/BrandImageType.php +++ b/src/Form/Type/BrandImageType.php @@ -8,9 +8,6 @@ final class BrandImageType extends ImageType { - /** - * @inheritdoc - */ public function getBlockPrefix(): string { return 'loevgaard_sylius_brand_brand_image'; diff --git a/src/Form/Type/BrandType.php b/src/Form/Type/BrandType.php index 129d8eed..0814a1e5 100644 --- a/src/Form/Type/BrandType.php +++ b/src/Form/Type/BrandType.php @@ -12,9 +12,6 @@ final class BrandType extends AbstractResourceType { - /** - * @inheritdoc - */ public function buildForm(FormBuilderInterface $builder, array $options): void { $builder @@ -33,9 +30,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ]); } - /** - * @inheritdoc - */ public function getBlockPrefix(): string { return 'loevgaard_sylius_brand_brand'; diff --git a/src/LoevgaardSyliusBrandPlugin.php b/src/LoevgaardSyliusBrandPlugin.php index c8776d1f..ebb19f53 100644 --- a/src/LoevgaardSyliusBrandPlugin.php +++ b/src/LoevgaardSyliusBrandPlugin.php @@ -12,9 +12,6 @@ final class LoevgaardSyliusBrandPlugin extends AbstractResourceBundle { use SyliusPluginTrait; - /** - * @inheritdoc - */ public function getSupportedDrivers(): array { return [ diff --git a/src/Menu/BrandFormMenuBuilder.php b/src/Menu/BrandFormMenuBuilder.php index 5bcd6b56..76005be0 100644 --- a/src/Menu/BrandFormMenuBuilder.php +++ b/src/Menu/BrandFormMenuBuilder.php @@ -16,17 +16,12 @@ final class BrandFormMenuBuilder { public const EVENT_NAME = 'loevgaard_sylius_brand.menu.admin.brand.form'; - /** @var FactoryInterface */ - private $factory; - /** @var EventDispatcherInterface */ private $eventDispatcher; - public function __construct(FactoryInterface $factory, EventDispatcherInterface $eventDispatcher) + public function __construct(private readonly FactoryInterface $factory, EventDispatcherInterface $eventDispatcher) { - $this->factory = $factory; - - if (class_exists('Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy')) { + if (class_exists(\Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy::class)) { /** * It could return null only if we pass null, but we pass not null in any case * @@ -59,7 +54,7 @@ public function createMenu(array $options = []): ItemInterface ->setLabel('sylius.ui.media') ; - if (class_exists('Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy')) { + if (class_exists(\Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy::class)) { $this->eventDispatcher->dispatch( new BrandMenuBuilderEvent($this->factory, $menu, $options['brand']), self::EVENT_NAME, diff --git a/src/Model/Brand.php b/src/Model/Brand.php index d58be5c1..62ee67d9 100644 --- a/src/Model/Brand.php +++ b/src/Model/Brand.php @@ -28,17 +28,11 @@ public function __construct() $this->__productsAwareTraitConstruct(); } - /** - * @inheritdoc - */ public function __toString(): string { return (string) $this->getName(); } - /** - * @inheritdoc - */ public function getId(): ?int { return $this->id; @@ -60,17 +54,11 @@ public function setCode(?string $code): void $this->code = $code; } - /** - * @inheritdoc - */ public function getName(): ?string { return $this->name; } - /** - * @inheritdoc - */ public function setName(?string $name): void { $this->name = $name; diff --git a/src/Model/BrandImage.php b/src/Model/BrandImage.php index ab1a1d62..e9d5b13b 100644 --- a/src/Model/BrandImage.php +++ b/src/Model/BrandImage.php @@ -15,9 +15,6 @@ public function isLogo(): bool return $this->getType() === self::TYPE_LOGO; } - /** - * @inheritdoc - */ public function getBrand(): ?BrandInterface { /** @var BrandInterface|null $brand */ @@ -26,9 +23,6 @@ public function getBrand(): ?BrandInterface return $brand; } - /** - * @inheritdoc - */ public function setBrand(?BrandInterface $brand): void { $this->setOwner($brand); diff --git a/src/Model/ImagesAwareTrait.php b/src/Model/ImagesAwareTrait.php index 43e1e435..37b2ad2b 100644 --- a/src/Model/ImagesAwareTrait.php +++ b/src/Model/ImagesAwareTrait.php @@ -18,43 +18,26 @@ public function __construct() $this->images = new ArrayCollection(); } - /** - * @inheritdoc - */ public function getImages(): Collection { return $this->images; } - /** - * @inheritdoc - */ public function getImagesByType(string $type): Collection { - return $this->images->filter(function (ImageInterface $image) use ($type) { - return $type === $image->getType(); - }); + return $this->images->filter(fn (ImageInterface $image) => $type === $image->getType()); } - /** - * @inheritdoc - */ public function hasImages(): bool { return !$this->images->isEmpty(); } - /** - * @inheritdoc - */ public function hasImage(ImageInterface $image): bool { return $this->images->contains($image); } - /** - * @inheritdoc - */ public function addImage(ImageInterface $image): void { if (false === $this->hasImage($image)) { @@ -63,9 +46,6 @@ public function addImage(ImageInterface $image): void } } - /** - * @inheritdoc - */ public function removeImage(ImageInterface $image): void { if ($this->hasImage($image)) { diff --git a/src/Model/ProductsAwareTrait.php b/src/Model/ProductsAwareTrait.php index 5661fe86..1ae9092a 100644 --- a/src/Model/ProductsAwareTrait.php +++ b/src/Model/ProductsAwareTrait.php @@ -12,45 +12,27 @@ trait ProductsAwareTrait /** @var Collection|ProductInterface[] */ protected $products; - /** - * @inheritdoc - */ public function __construct() { $this->products = new ArrayCollection(); } - /** - * @inheritdoc - */ public function hasProducts(): bool { return $this->products->count() > 0; } - /** - * @inheritdoc - */ public function getProducts(): Collection { return $this->products; } - /** - * @inheritdoc - */ public function hasProduct(ProductInterface $product): bool { return $this->products->contains($product); } - /** - * @inheritdoc - */ abstract public function addProduct(ProductInterface $product): void; - /** - * @inheritdoc - */ abstract public function removeProduct(ProductInterface $product): void; } diff --git a/tests/Behat/Context/Setup/BrandContext.php b/tests/Behat/Context/Setup/BrandContext.php index a99aa8b2..c220b9df 100644 --- a/tests/Behat/Context/Setup/BrandContext.php +++ b/tests/Behat/Context/Setup/BrandContext.php @@ -11,16 +11,8 @@ final class BrandContext implements Context { - /** @var RepositoryInterface */ - private $brandRepository; - - /** @var FactoryInterface */ - private $brandFactory; - - public function __construct(RepositoryInterface $brandRepository, FactoryInterface $brandFactory) + public function __construct(private readonly RepositoryInterface $brandRepository, private readonly FactoryInterface $brandFactory) { - $this->brandRepository = $brandRepository; - $this->brandFactory = $brandFactory; } /** diff --git a/tests/Behat/Context/Transform/BrandContext.php b/tests/Behat/Context/Transform/BrandContext.php index eca58bf1..003b8c35 100644 --- a/tests/Behat/Context/Transform/BrandContext.php +++ b/tests/Behat/Context/Transform/BrandContext.php @@ -5,18 +5,13 @@ namespace Tests\Loevgaard\SyliusBrandPlugin\Behat\Context\Transform; use Behat\Behat\Context\Context; -use Loevgaard\SyliusBrandPlugin\Doctrine\ORM\BrandRepositoryInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; use Webmozart\Assert\Assert; final class BrandContext implements Context { - /** @var BrandRepositoryInterface */ - private $brandRepository; - - public function __construct(RepositoryInterface $brandRepository) + public function __construct(private readonly RepositoryInterface $brandRepository) { - $this->brandRepository = $brandRepository; } /** diff --git a/tests/Behat/Context/Ui/Admin/ManagingBrandsContext.php b/tests/Behat/Context/Ui/Admin/ManagingBrandsContext.php index 81821a84..669f6cb9 100644 --- a/tests/Behat/Context/Ui/Admin/ManagingBrandsContext.php +++ b/tests/Behat/Context/Ui/Admin/ManagingBrandsContext.php @@ -13,20 +13,8 @@ final class ManagingBrandsContext implements Context { - /** @var IndexBrandPage */ - private $indexBrandPage; - - /** @var CreateBrandPage */ - private $createBrandPage; - - /** @var UpdateBrandPage */ - private $updateBrandPage; - - public function __construct(IndexBrandPage $indexBrandPage, CreateBrandPage $createBrandPage, UpdateBrandPage $updateBrandPage) + public function __construct(private readonly IndexBrandPage $indexBrandPage, private readonly CreateBrandPage $createBrandPage, private readonly UpdateBrandPage $updateBrandPage) { - $this->indexBrandPage = $indexBrandPage; - $this->createBrandPage = $createBrandPage; - $this->updateBrandPage = $updateBrandPage; } /** diff --git a/tests/Behat/Page/Admin/Brand/CreateBrandPage.php b/tests/Behat/Page/Admin/Brand/CreateBrandPage.php index be0f9529..38650d5f 100644 --- a/tests/Behat/Page/Admin/Brand/CreateBrandPage.php +++ b/tests/Behat/Page/Admin/Brand/CreateBrandPage.php @@ -18,9 +18,6 @@ public function specifyCode($code): void $this->getElement('code')->setValue($code); } - /** - * @inheritdoc - */ protected function getDefinedElements(): array { return array_merge(parent::getDefinedElements(), [ diff --git a/tests/Behat/Page/Admin/Brand/UpdateBrandPage.php b/tests/Behat/Page/Admin/Brand/UpdateBrandPage.php index aca56e72..23f9680a 100644 --- a/tests/Behat/Page/Admin/Brand/UpdateBrandPage.php +++ b/tests/Behat/Page/Admin/Brand/UpdateBrandPage.php @@ -23,9 +23,6 @@ public function getName(): string return $this->getElement('name')->getValue(); } - /** - * @inheritdoc - */ protected function getDefinedElements(): array { return array_merge(parent::getDefinedElements(), [ diff --git a/tests/Fixture/BrandFixtureTest.php b/tests/Fixture/BrandFixtureTest.php index c4d9c647..eaecbab1 100644 --- a/tests/Fixture/BrandFixtureTest.php +++ b/tests/Fixture/BrandFixtureTest.php @@ -33,9 +33,6 @@ public function brand_products_is_optional(): void $this->assertConfigurationIsValid([['custom' => [['products' => []]]]], 'custom.*.products'); } - /** - * @inheritdoc - */ protected function getConfiguration(): BrandFixture { return new BrandFixture(