diff --git a/composer.json b/composer.json index 0968e74b71..5634c331be 100644 --- a/composer.json +++ b/composer.json @@ -230,7 +230,7 @@ "symfony/runtime": "^5.4.21 || ^6.0", "symfony/web-profiler-bundle": "^5.4.21 || ^6.0", "symplify/monorepo-builder": "^11.0", - "vimeo/psalm": "^4.19" + "vimeo/psalm": "5.9.*" }, "suggest": { "ext-iconv": "For better performance than using Symfony Polyfill Component", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 2db1541692..fc907601eb 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -37,3 +37,4 @@ parameters: - '/Access to an undefined property Doctrine\\Common\\Collections\\ArrayCollection/' - '/Class Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken constructor invoked with 4 parameters\, 2\-3 required./' - '/Method Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface\:\:supportsNormalization\(\) invoked with 3 parameters\, 1\-2 required\./' + - '/(Interface|Class) [a-zA-Z\\]+ specifies template type (\w+) of interface [a-zA-Z\\]+ as [a-zA-Z\\]+ (of [a-zA-Z\\]+ )?but it''s already specified as/' # turns off a weird generics check behavior, we are basing on Psalm for generics checks diff --git a/psalm.xml b/psalm.xml index 853e7219a9..405bc4e9b3 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,8 @@ + @@ -62,11 +65,16 @@ + + + + + @@ -99,12 +107,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -116,6 +148,12 @@ + + + + + + @@ -125,6 +163,19 @@ + + + + + + + + + + + + + diff --git a/src/Sylius/Bundle/ApiBundle/Serializer/FlattenExceptionNormalizer.php b/src/Sylius/Bundle/ApiBundle/Serializer/FlattenExceptionNormalizer.php index bd20a3d855..9dba966618 100644 --- a/src/Sylius/Bundle/ApiBundle/Serializer/FlattenExceptionNormalizer.php +++ b/src/Sylius/Bundle/ApiBundle/Serializer/FlattenExceptionNormalizer.php @@ -26,6 +26,7 @@ final class FlattenExceptionNormalizer implements ContextAwareNormalizerInterfac ) { } + /** @psalm-suppress TooManyArguments */ public function supportsNormalization($data, $format = null, array $context = []): bool { $request = $this->requestStack->getMainRequest(); diff --git a/src/Sylius/Bundle/ChannelBundle/Doctrine/ORM/ChannelRepository.php b/src/Sylius/Bundle/ChannelBundle/Doctrine/ORM/ChannelRepository.php index b997807c50..de6bf84f0b 100644 --- a/src/Sylius/Bundle/ChannelBundle/Doctrine/ORM/ChannelRepository.php +++ b/src/Sylius/Bundle/ChannelBundle/Doctrine/ORM/ChannelRepository.php @@ -18,6 +18,10 @@ use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; use Sylius\Component\Channel\Model\ChannelInterface; use Sylius\Component\Channel\Repository\ChannelRepositoryInterface; +/** + * @template T of ChannelInterface + * @implements ChannelRepositoryInterface + */ class ChannelRepository extends EntityRepository implements ChannelRepositoryInterface { private const ORDER_BY = ['id' => 'ASC']; diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AddressRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AddressRepository.php index 30ac5485b8..2d4e09de27 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AddressRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AddressRepository.php @@ -18,6 +18,10 @@ use Sylius\Component\Core\Model\AddressInterface; use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Repository\AddressRepositoryInterface; +/** + * @template T of AddressInterface + * @implements AddressRepositoryInterface + */ class AddressRepository extends EntityRepository implements AddressRepositoryInterface { public function findByCustomer(CustomerInterface $customer): array diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AttributeRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AttributeRepository.php index 087e37b332..22d995db6f 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AttributeRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AttributeRepository.php @@ -16,12 +16,15 @@ namespace Sylius\Bundle\CoreBundle\Doctrine\ORM; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\ClassMetadata; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Attribute\Model\AttributeInterface; use SyliusLabs\AssociationHydrator\AssociationHydrator; +/** + * @template T of AttributeInterface + */ class AttributeRepository extends EntityRepository { - /** @var AssociationHydrator */ - protected $associationHydrator; + protected AssociationHydrator $associationHydrator; public function __construct(EntityManager $entityManager, ClassMetadata $class) { diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AvatarImageRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AvatarImageRepository.php index 111f2979b9..41a3222f75 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AvatarImageRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/AvatarImageRepository.php @@ -14,9 +14,14 @@ declare(strict_types=1); namespace Sylius\Bundle\CoreBundle\Doctrine\ORM; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Core\Model\AvatarImageInterface; use Sylius\Component\Core\Model\ImageInterface; use Sylius\Component\Core\Repository\AvatarImageRepositoryInterface; +/** + * @template T of AvatarImageInterface + * @implements AvatarImageRepositoryInterface + */ final class AvatarImageRepository extends EntityRepository implements AvatarImageRepositoryInterface { public function findOneByOwnerId(string $id): ?ImageInterface diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ChannelPricingLogEntryRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ChannelPricingLogEntryRepository.php index 8e3326c32e..e112f1ff0c 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ChannelPricingLogEntryRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ChannelPricingLogEntryRepository.php @@ -20,6 +20,10 @@ use Sylius\Component\Core\Model\ChannelPricingLogEntryInterface; use Sylius\Component\Core\Repository\ChannelPricingLogEntryRepositoryInterface; use Webmozart\Assert\Assert; +/** + * @template T of ChannelPricingLogEntryInterface + * @implements ChannelPricingLogEntryRepositoryInterface + */ class ChannelPricingLogEntryRepository extends EntityRepository implements ChannelPricingLogEntryRepositoryInterface { public function createByChannelPricingIdListQueryBuilder(mixed $channelPricingId): QueryBuilder diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/CustomerRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/CustomerRepository.php index a1e7485e20..2c8afa2d32 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/CustomerRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/CustomerRepository.php @@ -14,8 +14,13 @@ declare(strict_types=1); namespace Sylius\Bundle\CoreBundle\Doctrine\ORM; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Repository\CustomerRepositoryInterface; +/** + * @template T of CustomerInterface + * @implements CustomerRepositoryInterface + */ class CustomerRepository extends EntityRepository implements CustomerRepositoryInterface { public function countCustomers(): int diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderItemRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderItemRepository.php index 472600d01a..ae9a37764f 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderItemRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderItemRepository.php @@ -18,6 +18,11 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\OrderItemInterface; use Sylius\Component\Core\Repository\OrderItemRepositoryInterface; +/** + * @template T of OrderItemInterface + * @extends BaseOrderItemRepository + * @implements OrderItemRepositoryInterface + */ class OrderItemRepository extends BaseOrderItemRepository implements OrderItemRepositoryInterface { public function findOneByIdAndCustomer($id, CustomerInterface $customer): ?OrderItemInterface diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderItemUnitRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderItemUnitRepository.php index 3862c8e3b2..6a55aa4fd0 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderItemUnitRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderItemUnitRepository.php @@ -18,6 +18,10 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\OrderItemUnitInterface; use Sylius\Component\Core\Repository\OrderItemUnitRepositoryInterface; +/** + * @template T of OrderItemUnitInterface + * @implements OrderItemUnitRepositoryInterface + */ class OrderItemUnitRepository extends EntityRepository implements OrderItemUnitRepositoryInterface { public function findOneByCustomer($id, CustomerInterface $customer): ?OrderItemUnitInterface diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository.php index f4fdc06c0d..330c2adfaa 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository.php @@ -28,10 +28,14 @@ use Sylius\Component\Order\Model\OrderInterface as BaseOrderInterface; use SyliusLabs\AssociationHydrator\AssociationHydrator; use Webmozart\Assert\Assert; +/** + * @template T of OrderInterface + * @extends BaseOrderRepository + * @implements OrderRepositoryInterface + */ class OrderRepository extends BaseOrderRepository implements OrderRepositoryInterface { - /** @var AssociationHydrator */ - protected $associationHydrator; + protected AssociationHydrator $associationHydrator; public function __construct(EntityManager $entityManager, ClassMetadata $class) { diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PaymentMethodRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PaymentMethodRepository.php index 3894700d41..74c3b4dd7f 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PaymentMethodRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PaymentMethodRepository.php @@ -16,8 +16,14 @@ namespace Sylius\Bundle\CoreBundle\Doctrine\ORM; use Doctrine\ORM\QueryBuilder; use Sylius\Bundle\PaymentBundle\Doctrine\ORM\PaymentMethodRepository as BasePaymentMethodRepository; use Sylius\Component\Core\Model\ChannelInterface; +use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Core\Repository\PaymentMethodRepositoryInterface; +/** + * @template T of PaymentMethodInterface + * @extends BasePaymentMethodRepository + * @implements PaymentMethodRepositoryInterface + */ class PaymentMethodRepository extends BasePaymentMethodRepository implements PaymentMethodRepositoryInterface { public function createListQueryBuilder(string $locale): QueryBuilder diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PaymentRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PaymentRepository.php index 59694ef7b0..d7dc6d364f 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PaymentRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PaymentRepository.php @@ -19,6 +19,10 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\Repository\PaymentRepositoryInterface; +/** + * @template T of PaymentInterface + * @implements PaymentRepositoryInterface + */ class PaymentRepository extends EntityRepository implements PaymentRepositoryInterface { public function createListQueryBuilder(): QueryBuilder diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductAssociationRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductAssociationRepository.php index 1884e318d1..935d61a62b 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductAssociationRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductAssociationRepository.php @@ -18,6 +18,10 @@ use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Repository\ProductAssociationRepositoryInterface; use Sylius\Component\Product\Model\ProductAssociationInterface; +/** + * @template T of ProductAssociationInterface + * @implements ProductAssociationRepositoryInterface + */ class ProductAssociationRepository extends EntityRepository implements ProductAssociationRepositoryInterface { public function findWithProductsWithinChannel($associationId, ChannelInterface $channel): ProductAssociationInterface diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductOptionRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductOptionRepository.php index fec3c3312b..3a3acf718c 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductOptionRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductOptionRepository.php @@ -16,12 +16,16 @@ namespace Sylius\Bundle\CoreBundle\Doctrine\ORM; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\ClassMetadata; use Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductOptionRepository as BaseProductOptionRepository; +use Sylius\Component\Product\Model\ProductOptionInterface; use SyliusLabs\AssociationHydrator\AssociationHydrator; +/** + * @template T of ProductOptionInterface + * @extends BaseProductOptionRepository + */ class ProductOptionRepository extends BaseProductOptionRepository { - /** @var AssociationHydrator */ - protected $associationHydrator; + protected AssociationHydrator $associationHydrator; public function __construct(EntityManager $entityManager, ClassMetadata $class) { diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductRepository.php index 61d874b7e8..6790d02b0d 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductRepository.php @@ -23,6 +23,11 @@ use Sylius\Component\Core\Model\TaxonInterface; use Sylius\Component\Core\Repository\ProductRepositoryInterface; use SyliusLabs\AssociationHydrator\AssociationHydrator; +/** + * @template T of ProductInterface + * @extends BaseProductRepository + * @implements ProductRepositoryInterface + */ class ProductRepository extends BaseProductRepository implements ProductRepositoryInterface { protected AssociationHydrator $associationHydrator; diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductReviewRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductReviewRepository.php index 6f23bb5e1d..59d1678e39 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductReviewRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductReviewRepository.php @@ -19,6 +19,10 @@ use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Repository\ProductReviewRepositoryInterface; use Sylius\Component\Review\Model\ReviewInterface; +/** + * @template T of ReviewInterface + * @implements ProductReviewRepositoryInterface + */ class ProductReviewRepository extends EntityRepository implements ProductReviewRepositoryInterface { public function findLatestByProductId($productId, int $count): array diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductTaxonRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductTaxonRepository.php index 74e8029cd1..8398821f57 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductTaxonRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductTaxonRepository.php @@ -17,6 +17,10 @@ use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; use Sylius\Component\Core\Model\ProductTaxonInterface; use Sylius\Component\Core\Repository\ProductTaxonRepositoryInterface; +/** + * @template T of ProductTaxonInterface + * @implements ProductTaxonRepositoryInterface + */ class ProductTaxonRepository extends EntityRepository implements ProductTaxonRepositoryInterface { public function findOneByProductCodeAndTaxonCode(string $productCode, string $taxonCode): ?ProductTaxonInterface diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductVariantRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductVariantRepository.php index 1db3e24054..dfb984b637 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductVariantRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ProductVariantRepository.php @@ -16,9 +16,15 @@ namespace Sylius\Bundle\CoreBundle\Doctrine\ORM; use Doctrine\ORM\QueryBuilder; use Sylius\Bundle\ProductBundle\Doctrine\ORM\ProductVariantRepository as BaseProductVariantRepository; use Sylius\Component\Core\Model\CatalogPromotionInterface; +use Sylius\Component\Core\Model\ProductVariantInterface; use Sylius\Component\Core\Model\TaxonInterface; use Sylius\Component\Core\Repository\ProductVariantRepositoryInterface; +/** + * @template T of ProductVariantInterface + * @extends BaseProductVariantRepository + * @implements ProductVariantRepositoryInterface + */ class ProductVariantRepository extends BaseProductVariantRepository implements ProductVariantRepositoryInterface { public function createInventoryListQueryBuilder(string $locale): QueryBuilder diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PromotionRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PromotionRepository.php index f3cf808814..29f15b092b 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PromotionRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/PromotionRepository.php @@ -17,9 +17,15 @@ use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\ClassMetadata; use Sylius\Bundle\PromotionBundle\Doctrine\ORM\PromotionRepository as BasePromotionRepository; use Sylius\Component\Channel\Model\ChannelInterface; +use Sylius\Component\Core\Model\PromotionInterface; use Sylius\Component\Core\Repository\PromotionRepositoryInterface; use SyliusLabs\AssociationHydrator\AssociationHydrator; +/** + * @template T of PromotionInterface + * @extends BasePromotionRepository + * @implements PromotionRepositoryInterface + */ class PromotionRepository extends BasePromotionRepository implements PromotionRepositoryInterface { private AssociationHydrator $associationHydrator; diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShipmentRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShipmentRepository.php index e856e9049d..a6d6c33c25 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShipmentRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShipmentRepository.php @@ -20,6 +20,10 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\ShipmentInterface; use Sylius\Component\Core\Repository\ShipmentRepositoryInterface; +/** + * @template T of ShipmentInterface + * @implements ShipmentRepositoryInterface + */ class ShipmentRepository extends EntityRepository implements ShipmentRepositoryInterface { public function createListQueryBuilder(): QueryBuilder diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShippingCategoryRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShippingCategoryRepository.php index fd00433f84..b6ccf09b6c 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShippingCategoryRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShippingCategoryRepository.php @@ -16,7 +16,12 @@ namespace Sylius\Bundle\CoreBundle\Doctrine\ORM; use Doctrine\ORM\QueryBuilder; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; use Sylius\Component\Core\Repository\ShippingCategoryRepositoryInterface; +use Sylius\Component\Shipping\Model\ShippingCategoryInterface; +/** + * @template T of ShippingCategoryInterface + * @implements ShippingCategoryRepositoryInterface + */ class ShippingCategoryRepository extends EntityRepository implements ShippingCategoryRepositoryInterface { public function createListQueryBuilder(): QueryBuilder diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShippingMethodRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShippingMethodRepository.php index 15384d8bee..1267168b1a 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShippingMethodRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/ShippingMethodRepository.php @@ -16,8 +16,14 @@ namespace Sylius\Bundle\CoreBundle\Doctrine\ORM; use Doctrine\ORM\QueryBuilder; use Sylius\Bundle\ShippingBundle\Doctrine\ORM\ShippingMethodRepository as BaseShippingMethodRepository; use Sylius\Component\Core\Model\ChannelInterface; +use Sylius\Component\Core\Model\ShippingMethodInterface; use Sylius\Component\Core\Repository\ShippingMethodRepositoryInterface; +/** + * @template T of ShippingMethodInterface + * @extends BaseShippingMethodRepository + * @implements ShippingMethodRepositoryInterface + */ class ShippingMethodRepository extends BaseShippingMethodRepository implements ShippingMethodRepositoryInterface { public function createListQueryBuilder(string $locale): QueryBuilder diff --git a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/UserRepository.php b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/UserRepository.php index 01c8b99d68..6db3c0f47d 100644 --- a/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/UserRepository.php +++ b/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/UserRepository.php @@ -17,6 +17,11 @@ use Sylius\Bundle\UserBundle\Doctrine\ORM\UserRepository as BaseUserRepository; use Sylius\Component\User\Model\UserInterface; use Sylius\Component\User\Repository\UserRepositoryInterface; +/** + * @template T of UserInterface + * @extends BaseUserRepository + * @implements UserRepositoryInterface + */ class UserRepository extends BaseUserRepository implements UserRepositoryInterface { public function findOneByEmail(string $email): ?UserInterface diff --git a/src/Sylius/Bundle/CoreBundle/Factory/OrderFactory.php b/src/Sylius/Bundle/CoreBundle/Factory/OrderFactory.php index b5fc0d06c7..5536db0c6f 100644 --- a/src/Sylius/Bundle/CoreBundle/Factory/OrderFactory.php +++ b/src/Sylius/Bundle/CoreBundle/Factory/OrderFactory.php @@ -19,6 +19,9 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @implements OrderFactoryInterface + */ final class OrderFactory implements OrderFactoryInterface { public function __construct( @@ -28,7 +31,10 @@ final class OrderFactory implements OrderFactoryInterface public function createNew(): OrderInterface { - return $this->decoratedFactory->createNew(); + /** @var OrderInterface $order */ + $order = $this->decoratedFactory->createNew(); + + return $order; } public function createNewCart( diff --git a/src/Sylius/Bundle/CoreBundle/Factory/OrderFactoryInterface.php b/src/Sylius/Bundle/CoreBundle/Factory/OrderFactoryInterface.php index 2631f19551..a2b9c30f1f 100644 --- a/src/Sylius/Bundle/CoreBundle/Factory/OrderFactoryInterface.php +++ b/src/Sylius/Bundle/CoreBundle/Factory/OrderFactoryInterface.php @@ -17,7 +17,12 @@ use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +use Sylius\Component\Resource\Model\ResourceInterface; +/** + * @template T of ResourceInterface + * @extends FactoryInterface + */ interface OrderFactoryInterface extends FactoryInterface { public function createNewCart( diff --git a/src/Sylius/Bundle/CoreBundle/Fixture/Factory/AddressExampleFactory.php b/src/Sylius/Bundle/CoreBundle/Fixture/Factory/AddressExampleFactory.php index 7e1b80c8a8..b4a2f06607 100644 --- a/src/Sylius/Bundle/CoreBundle/Fixture/Factory/AddressExampleFactory.php +++ b/src/Sylius/Bundle/CoreBundle/Fixture/Factory/AddressExampleFactory.php @@ -139,6 +139,7 @@ class AddressExampleFactory extends AbstractExampleFactory } /** + * @param Collection $provinces * @throws \InvalidArgumentException */ private function getProvinceCode(Collection $provinces, string $provinceName): string diff --git a/src/Sylius/Bundle/CoreBundle/Installer/Requirement/RequirementCollection.php b/src/Sylius/Bundle/CoreBundle/Installer/Requirement/RequirementCollection.php index 01ac8bcb02..9042ed934d 100644 --- a/src/Sylius/Bundle/CoreBundle/Installer/Requirement/RequirementCollection.php +++ b/src/Sylius/Bundle/CoreBundle/Installer/Requirement/RequirementCollection.php @@ -13,6 +13,9 @@ declare(strict_types=1); namespace Sylius\Bundle\CoreBundle\Installer\Requirement; +/** + * @implements \IteratorAggregate + */ abstract class RequirementCollection implements \IteratorAggregate { /** @var array|Requirement[] */ diff --git a/src/Sylius/Bundle/CoreBundle/Installer/Requirement/SyliusRequirements.php b/src/Sylius/Bundle/CoreBundle/Installer/Requirement/SyliusRequirements.php index ad5ebff1dc..75f5f3b753 100644 --- a/src/Sylius/Bundle/CoreBundle/Installer/Requirement/SyliusRequirements.php +++ b/src/Sylius/Bundle/CoreBundle/Installer/Requirement/SyliusRequirements.php @@ -13,6 +13,9 @@ declare(strict_types=1); namespace Sylius\Bundle\CoreBundle\Installer\Requirement; +/** + * @implements \IteratorAggregate + */ final class SyliusRequirements implements \IteratorAggregate { /** @var array|RequirementCollection[] */ diff --git a/src/Sylius/Bundle/CoreBundle/Installer/Setup/LocaleSetup.php b/src/Sylius/Bundle/CoreBundle/Installer/Setup/LocaleSetup.php index 4cd22791e1..20c52fa0c2 100644 --- a/src/Sylius/Bundle/CoreBundle/Installer/Setup/LocaleSetup.php +++ b/src/Sylius/Bundle/CoreBundle/Installer/Setup/LocaleSetup.php @@ -89,7 +89,9 @@ final class LocaleSetup implements LocaleSetupInterface $region = null; if (count(explode('_', $code, 2)) === 2) { - [$language, $region] = explode('_', $code, 2); + $codeParts = explode('_', $code, 2); + $language = $codeParts[0]; + $region = $codeParts[1] ?? null; } try { diff --git a/src/Sylius/Bundle/CurrencyBundle/Doctrine/ORM/ExchangeRateRepository.php b/src/Sylius/Bundle/CurrencyBundle/Doctrine/ORM/ExchangeRateRepository.php index 4d45a77d54..46c7e0eca9 100644 --- a/src/Sylius/Bundle/CurrencyBundle/Doctrine/ORM/ExchangeRateRepository.php +++ b/src/Sylius/Bundle/CurrencyBundle/Doctrine/ORM/ExchangeRateRepository.php @@ -18,6 +18,10 @@ use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; use Sylius\Component\Currency\Model\ExchangeRateInterface; use Sylius\Component\Currency\Repository\ExchangeRateRepositoryInterface; +/** + * @template T of ExchangeRateInterface + * @implements ExchangeRateRepositoryInterface + */ class ExchangeRateRepository extends EntityRepository implements ExchangeRateRepositoryInterface { /** diff --git a/src/Sylius/Bundle/CustomerBundle/Doctrine/ORM/CustomerGroupRepository.php b/src/Sylius/Bundle/CustomerBundle/Doctrine/ORM/CustomerGroupRepository.php index 985d8bec14..cbb33502a1 100644 --- a/src/Sylius/Bundle/CustomerBundle/Doctrine/ORM/CustomerGroupRepository.php +++ b/src/Sylius/Bundle/CustomerBundle/Doctrine/ORM/CustomerGroupRepository.php @@ -14,8 +14,13 @@ declare(strict_types=1); namespace Sylius\Bundle\CustomerBundle\Doctrine\ORM; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Customer\Model\CustomerGroupInterface; use Sylius\Component\Customer\Repository\CustomerGroupRepositoryInterface; +/** + * @template T of CustomerGroupInterface + * @implements CustomerGroupRepositoryInterface + */ class CustomerGroupRepository extends EntityRepository implements CustomerGroupRepositoryInterface { public function findByPhrase(string $phrase, ?int $limit = null): iterable diff --git a/src/Sylius/Bundle/OrderBundle/Doctrine/ORM/OrderItemRepository.php b/src/Sylius/Bundle/OrderBundle/Doctrine/ORM/OrderItemRepository.php index 8f18b95a41..782142e3df 100644 --- a/src/Sylius/Bundle/OrderBundle/Doctrine/ORM/OrderItemRepository.php +++ b/src/Sylius/Bundle/OrderBundle/Doctrine/ORM/OrderItemRepository.php @@ -18,6 +18,10 @@ use Sylius\Component\Order\Model\OrderInterface; use Sylius\Component\Order\Model\OrderItemInterface; use Sylius\Component\Order\Repository\OrderItemRepositoryInterface; +/** + * @template T of OrderItemInterface + * @implements OrderItemRepositoryInterface + */ class OrderItemRepository extends EntityRepository implements OrderItemRepositoryInterface { public function findOneByIdAndCartId($id, $cartId): ?OrderItemInterface diff --git a/src/Sylius/Bundle/OrderBundle/Doctrine/ORM/OrderRepository.php b/src/Sylius/Bundle/OrderBundle/Doctrine/ORM/OrderRepository.php index 4a9c088e1d..9d87ef2ace 100644 --- a/src/Sylius/Bundle/OrderBundle/Doctrine/ORM/OrderRepository.php +++ b/src/Sylius/Bundle/OrderBundle/Doctrine/ORM/OrderRepository.php @@ -19,6 +19,10 @@ use Sylius\Component\Order\Model\OrderInterface; use Sylius\Component\Order\Repository\OrderRepositoryInterface; use Webmozart\Assert\Assert; +/** + * @template T of OrderInterface + * @implements OrderRepositoryInterface + */ class OrderRepository extends EntityRepository implements OrderRepositoryInterface { public function countPlacedOrders(): int diff --git a/src/Sylius/Bundle/PaymentBundle/Doctrine/ORM/PaymentMethodRepository.php b/src/Sylius/Bundle/PaymentBundle/Doctrine/ORM/PaymentMethodRepository.php index 6b7d8efee8..be2db10342 100644 --- a/src/Sylius/Bundle/PaymentBundle/Doctrine/ORM/PaymentMethodRepository.php +++ b/src/Sylius/Bundle/PaymentBundle/Doctrine/ORM/PaymentMethodRepository.php @@ -14,8 +14,13 @@ declare(strict_types=1); namespace Sylius\Bundle\PaymentBundle\Doctrine\ORM; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Payment\Model\PaymentMethodInterface; use Sylius\Component\Payment\Repository\PaymentMethodRepositoryInterface; +/** + * @template T of PaymentMethodInterface + * @implements PaymentMethodRepositoryInterface + */ class PaymentMethodRepository extends EntityRepository implements PaymentMethodRepositoryInterface { public function findByName(string $name, string $locale): array diff --git a/src/Sylius/Bundle/PayumBundle/DependencyInjection/SyliusPayumExtension.php b/src/Sylius/Bundle/PayumBundle/DependencyInjection/SyliusPayumExtension.php index b1f3613ac6..8d329fe748 100644 --- a/src/Sylius/Bundle/PayumBundle/DependencyInjection/SyliusPayumExtension.php +++ b/src/Sylius/Bundle/PayumBundle/DependencyInjection/SyliusPayumExtension.php @@ -47,6 +47,7 @@ final class SyliusPayumExtension extends AbstractResourceExtension implements Pr continue; } + /** @var string $gatewayKey */ foreach (array_keys($config['gateways']) as $gatewayKey) { $gateways[$gatewayKey] = 'sylius.payum_gateway.' . $gatewayKey; } diff --git a/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductAssociationTypeRepository.php b/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductAssociationTypeRepository.php index cd7ed9ff2e..a26c6e4923 100644 --- a/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductAssociationTypeRepository.php +++ b/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductAssociationTypeRepository.php @@ -15,8 +15,13 @@ namespace Sylius\Bundle\ProductBundle\Doctrine\ORM; use Doctrine\ORM\QueryBuilder; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Product\Model\ProductAssociationTypeInterface; use Sylius\Component\Product\Repository\ProductAssociationTypeRepositoryInterface; +/** + * @template T of ProductAssociationTypeInterface + * @implements ProductAssociationTypeRepositoryInterface + */ class ProductAssociationTypeRepository extends EntityRepository implements ProductAssociationTypeRepositoryInterface { public function createListQueryBuilder(string $locale): QueryBuilder diff --git a/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductAttributeValueRepository.php b/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductAttributeValueRepository.php index 90a212421e..944ea9188f 100644 --- a/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductAttributeValueRepository.php +++ b/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductAttributeValueRepository.php @@ -15,8 +15,13 @@ namespace Sylius\Bundle\ProductBundle\Doctrine\ORM; use Doctrine\ORM\QueryBuilder; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Product\Model\ProductAttributeValueInterface; use Sylius\Component\Product\Repository\ProductAttributeValueRepositoryInterface; +/** + * @template T of ProductAttributeValueInterface + * @implements ProductAttributeValueRepositoryInterface + */ class ProductAttributeValueRepository extends EntityRepository implements ProductAttributeValueRepositoryInterface { public function findByJsonChoiceKey(string $choiceKey): array diff --git a/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductOptionRepository.php b/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductOptionRepository.php index 92e1e41815..7d1bbcc2f7 100644 --- a/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductOptionRepository.php +++ b/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductOptionRepository.php @@ -15,8 +15,13 @@ namespace Sylius\Bundle\ProductBundle\Doctrine\ORM; use Doctrine\ORM\QueryBuilder; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Product\Model\ProductOptionInterface; use Sylius\Component\Product\Repository\ProductOptionRepositoryInterface; +/** + * @template T of ProductOptionInterface + * @implements ProductOptionRepositoryInterface + */ class ProductOptionRepository extends EntityRepository implements ProductOptionRepositoryInterface { public function createListQueryBuilder(string $locale): QueryBuilder diff --git a/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductRepository.php b/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductRepository.php index 984dfe836d..280a544884 100644 --- a/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductRepository.php +++ b/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductRepository.php @@ -14,8 +14,13 @@ declare(strict_types=1); namespace Sylius\Bundle\ProductBundle\Doctrine\ORM; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Product\Model\ProductInterface; use Sylius\Component\Product\Repository\ProductRepositoryInterface; +/** + * @template T of ProductInterface + * @implements ProductRepositoryInterface + */ class ProductRepository extends EntityRepository implements ProductRepositoryInterface { public function findByName(string $name, string $locale): array diff --git a/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductVariantRepository.php b/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductVariantRepository.php index 9bd2b4c620..dcf5748d87 100644 --- a/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductVariantRepository.php +++ b/src/Sylius/Bundle/ProductBundle/Doctrine/ORM/ProductVariantRepository.php @@ -19,6 +19,10 @@ use Sylius\Component\Product\Model\ProductInterface; use Sylius\Component\Product\Model\ProductVariantInterface; use Sylius\Component\Product\Repository\ProductVariantRepositoryInterface; +/** + * @template T of ProductVariantInterface + * @implements ProductVariantRepositoryInterface + */ class ProductVariantRepository extends EntityRepository implements ProductVariantRepositoryInterface { public function createQueryBuilderByProductId(string $locale, $productId): QueryBuilder diff --git a/src/Sylius/Bundle/ProductBundle/Form/DataTransformer/ProductsToProductAssociationsTransformer.php b/src/Sylius/Bundle/ProductBundle/Form/DataTransformer/ProductsToProductAssociationsTransformer.php index 0920fad836..a7968cfb67 100644 --- a/src/Sylius/Bundle/ProductBundle/Form/DataTransformer/ProductsToProductAssociationsTransformer.php +++ b/src/Sylius/Bundle/ProductBundle/Form/DataTransformer/ProductsToProductAssociationsTransformer.php @@ -85,6 +85,9 @@ final class ProductsToProductAssociationsTransformer implements DataTransformerI return $productAssociations; } + /** + * @param Collection $products + */ private function getCodesAsStringFromProducts(Collection $products): ?string { if ($products->isEmpty()) { diff --git a/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/CatalogPromotionRepository.php b/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/CatalogPromotionRepository.php index 6f5052e47c..66d512a2dd 100644 --- a/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/CatalogPromotionRepository.php +++ b/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/CatalogPromotionRepository.php @@ -15,8 +15,13 @@ namespace Sylius\Bundle\PromotionBundle\Doctrine\ORM; use Sylius\Bundle\PromotionBundle\Criteria\CriteriaInterface; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Promotion\Model\CatalogPromotionInterface; use Sylius\Component\Promotion\Repository\CatalogPromotionRepositoryInterface; +/** + * @template T of CatalogPromotionInterface + * @implements CatalogPromotionRepositoryInterface + */ class CatalogPromotionRepository extends EntityRepository implements CatalogPromotionRepositoryInterface { public function findByCriteria(iterable $criteria): array diff --git a/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/PromotionCouponRepository.php b/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/PromotionCouponRepository.php index 72b39f6a88..5b99b918dd 100644 --- a/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/PromotionCouponRepository.php +++ b/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/PromotionCouponRepository.php @@ -18,6 +18,10 @@ use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; use Sylius\Component\Promotion\Model\PromotionCouponInterface; use Sylius\Component\Promotion\Repository\PromotionCouponRepositoryInterface; +/** + * @template T of PromotionCouponInterface + * @implements PromotionCouponRepositoryInterface + */ class PromotionCouponRepository extends EntityRepository implements PromotionCouponRepositoryInterface { public function createQueryBuilderByPromotionId($promotionId): QueryBuilder diff --git a/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/PromotionRepository.php b/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/PromotionRepository.php index dbb33b06fa..1c5e0850f2 100644 --- a/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/PromotionRepository.php +++ b/src/Sylius/Bundle/PromotionBundle/Doctrine/ORM/PromotionRepository.php @@ -15,8 +15,13 @@ namespace Sylius\Bundle\PromotionBundle\Doctrine\ORM; use Doctrine\ORM\QueryBuilder; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Promotion\Model\PromotionInterface; use Sylius\Component\Promotion\Repository\PromotionRepositoryInterface; +/** + * @template T of PromotionInterface + * @implements PromotionRepositoryInterface + */ class PromotionRepository extends EntityRepository implements PromotionRepositoryInterface { public function findActive(): array diff --git a/src/Sylius/Bundle/ShippingBundle/Doctrine/ORM/ShippingMethodRepository.php b/src/Sylius/Bundle/ShippingBundle/Doctrine/ORM/ShippingMethodRepository.php index b582e0a750..619969cd3c 100644 --- a/src/Sylius/Bundle/ShippingBundle/Doctrine/ORM/ShippingMethodRepository.php +++ b/src/Sylius/Bundle/ShippingBundle/Doctrine/ORM/ShippingMethodRepository.php @@ -14,8 +14,13 @@ declare(strict_types=1); namespace Sylius\Bundle\ShippingBundle\Doctrine\ORM; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Shipping\Model\ShippingMethodInterface; use Sylius\Component\Shipping\Repository\ShippingMethodRepositoryInterface; +/** + * @template T of ShippingMethodInterface + * @implements ShippingMethodRepositoryInterface + */ class ShippingMethodRepository extends EntityRepository implements ShippingMethodRepositoryInterface { public function findByName(string $name, string $locale): array diff --git a/src/Sylius/Bundle/TaxationBundle/Doctrine/ORM/TaxCategoryRepository.php b/src/Sylius/Bundle/TaxationBundle/Doctrine/ORM/TaxCategoryRepository.php index abb9fd663d..212ac454a4 100644 --- a/src/Sylius/Bundle/TaxationBundle/Doctrine/ORM/TaxCategoryRepository.php +++ b/src/Sylius/Bundle/TaxationBundle/Doctrine/ORM/TaxCategoryRepository.php @@ -14,8 +14,13 @@ declare(strict_types=1); namespace Sylius\Bundle\TaxationBundle\Doctrine\ORM; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; +use Sylius\Component\Taxation\Model\TaxCategoryInterface; use Sylius\Component\Taxation\Repository\TaxCategoryRepositoryInterface; +/** + * @template T of TaxCategoryInterface + * @implements TaxCategoryRepositoryInterface + */ class TaxCategoryRepository extends EntityRepository implements TaxCategoryRepositoryInterface { public function findByName(string $name): array diff --git a/src/Sylius/Bundle/TaxonomyBundle/Doctrine/ORM/TaxonRepository.php b/src/Sylius/Bundle/TaxonomyBundle/Doctrine/ORM/TaxonRepository.php index ea51c6562c..226d3d5c0c 100644 --- a/src/Sylius/Bundle/TaxonomyBundle/Doctrine/ORM/TaxonRepository.php +++ b/src/Sylius/Bundle/TaxonomyBundle/Doctrine/ORM/TaxonRepository.php @@ -18,6 +18,10 @@ use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; use Sylius\Component\Taxonomy\Model\TaxonInterface; use Sylius\Component\Taxonomy\Repository\TaxonRepositoryInterface; +/** + * @template T of TaxonInterface + * @implements TaxonRepositoryInterface + */ class TaxonRepository extends EntityRepository implements TaxonRepositoryInterface { public function findChildren(string $parentCode, ?string $locale = null): array diff --git a/src/Sylius/Bundle/UserBundle/Doctrine/ORM/UserRepository.php b/src/Sylius/Bundle/UserBundle/Doctrine/ORM/UserRepository.php index 221532c565..e28f350811 100644 --- a/src/Sylius/Bundle/UserBundle/Doctrine/ORM/UserRepository.php +++ b/src/Sylius/Bundle/UserBundle/Doctrine/ORM/UserRepository.php @@ -17,6 +17,10 @@ use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository; use Sylius\Component\User\Model\UserInterface; use Sylius\Component\User\Repository\UserRepositoryInterface; +/** + * @template T of UserInterface + * @implements UserRepositoryInterface + */ class UserRepository extends EntityRepository implements UserRepositoryInterface { public function findOneByEmail(string $email): ?UserInterface diff --git a/src/Sylius/Bundle/UserBundle/Factory/UserWithEncoderFactory.php b/src/Sylius/Bundle/UserBundle/Factory/UserWithEncoderFactory.php index 300d259205..8c4c44b7e4 100644 --- a/src/Sylius/Bundle/UserBundle/Factory/UserWithEncoderFactory.php +++ b/src/Sylius/Bundle/UserBundle/Factory/UserWithEncoderFactory.php @@ -17,6 +17,9 @@ use Sylius\Component\Resource\Factory\FactoryInterface; use Sylius\Component\User\Model\UserInterface; use Webmozart\Assert\Assert; +/** + * @implements FactoryInterface + */ final class UserWithEncoderFactory implements FactoryInterface { public function __construct(private FactoryInterface $decoratedUserFactory, private string $encoderName) diff --git a/src/Sylius/Component/Addressing/Factory/ZoneFactory.php b/src/Sylius/Component/Addressing/Factory/ZoneFactory.php index a007e1b19d..2567b32ece 100644 --- a/src/Sylius/Component/Addressing/Factory/ZoneFactory.php +++ b/src/Sylius/Component/Addressing/Factory/ZoneFactory.php @@ -17,6 +17,10 @@ use Sylius\Component\Addressing\Model\ZoneInterface; use Sylius\Component\Addressing\Model\ZoneMemberInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of ZoneInterface + * @implements ZoneFactoryInterface + */ final class ZoneFactory implements ZoneFactoryInterface { public function __construct(private FactoryInterface $factory, private FactoryInterface $zoneMemberFactory) diff --git a/src/Sylius/Component/Addressing/Factory/ZoneFactoryInterface.php b/src/Sylius/Component/Addressing/Factory/ZoneFactoryInterface.php index fb057d1a8e..3fab4f7e15 100644 --- a/src/Sylius/Component/Addressing/Factory/ZoneFactoryInterface.php +++ b/src/Sylius/Component/Addressing/Factory/ZoneFactoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Addressing\Factory; use Sylius\Component\Addressing\Model\ZoneInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of ZoneInterface + * @extends FactoryInterface + */ interface ZoneFactoryInterface extends FactoryInterface { public function createTyped(string $type): ZoneInterface; diff --git a/src/Sylius/Component/Attribute/Factory/AttributeFactory.php b/src/Sylius/Component/Attribute/Factory/AttributeFactory.php index 1fc27916d1..86f82c0abb 100644 --- a/src/Sylius/Component/Attribute/Factory/AttributeFactory.php +++ b/src/Sylius/Component/Attribute/Factory/AttributeFactory.php @@ -18,6 +18,10 @@ use Sylius\Component\Attribute\Model\AttributeInterface; use Sylius\Component\Registry\ServiceRegistryInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of AttributeInterface + * @implements AttributeFactoryInterface + */ final class AttributeFactory implements AttributeFactoryInterface { public function __construct(private FactoryInterface $factory, private ServiceRegistryInterface $attributeTypesRegistry) diff --git a/src/Sylius/Component/Attribute/Factory/AttributeFactoryInterface.php b/src/Sylius/Component/Attribute/Factory/AttributeFactoryInterface.php index 02278c035e..85c61bb08b 100644 --- a/src/Sylius/Component/Attribute/Factory/AttributeFactoryInterface.php +++ b/src/Sylius/Component/Attribute/Factory/AttributeFactoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Attribute\Factory; use Sylius\Component\Attribute\Model\AttributeInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of AttributeInterface + * @extends FactoryInterface + */ interface AttributeFactoryInterface extends FactoryInterface { public function createTyped(string $type): AttributeInterface; diff --git a/src/Sylius/Component/Attribute/Model/AttributeSubjectInterface.php b/src/Sylius/Component/Attribute/Model/AttributeSubjectInterface.php index bd8e6c53ae..c4fa585f82 100644 --- a/src/Sylius/Component/Attribute/Model/AttributeSubjectInterface.php +++ b/src/Sylius/Component/Attribute/Model/AttributeSubjectInterface.php @@ -25,9 +25,7 @@ interface AttributeSubjectInterface public function getAttributes(): Collection; /** - * @return Collection|AttributeValueInterface[] - * - * @psalm-return Collection + * @return Collection */ public function getAttributesByLocale( string $localeCode, diff --git a/src/Sylius/Component/Channel/Factory/ChannelFactory.php b/src/Sylius/Component/Channel/Factory/ChannelFactory.php index 3eb35d14e5..40094a863a 100644 --- a/src/Sylius/Component/Channel/Factory/ChannelFactory.php +++ b/src/Sylius/Component/Channel/Factory/ChannelFactory.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Channel\Factory; use Sylius\Component\Channel\Model\ChannelInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of ChannelInterface + * @implements ChannelFactoryInterface + */ final class ChannelFactory implements ChannelFactoryInterface { public function __construct(private FactoryInterface $defaultFactory) diff --git a/src/Sylius/Component/Channel/Factory/ChannelFactoryInterface.php b/src/Sylius/Component/Channel/Factory/ChannelFactoryInterface.php index 7726bf43cf..c1bcd52efd 100644 --- a/src/Sylius/Component/Channel/Factory/ChannelFactoryInterface.php +++ b/src/Sylius/Component/Channel/Factory/ChannelFactoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Channel\Factory; use Sylius\Component\Channel\Model\ChannelInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of ChannelInterface + * @extends FactoryInterface + */ interface ChannelFactoryInterface extends FactoryInterface { public function createNamed(string $name): ChannelInterface; diff --git a/src/Sylius/Component/Channel/Repository/ChannelRepositoryInterface.php b/src/Sylius/Component/Channel/Repository/ChannelRepositoryInterface.php index 64092037a4..53c1441cc2 100644 --- a/src/Sylius/Component/Channel/Repository/ChannelRepositoryInterface.php +++ b/src/Sylius/Component/Channel/Repository/ChannelRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Channel\Repository; use Sylius\Component\Channel\Model\ChannelInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ChannelInterface + * @extends RepositoryInterface + */ interface ChannelRepositoryInterface extends RepositoryInterface { /** @deprecated since Sylius 1.11, use the `findOneEnabledByHostname` method instead */ diff --git a/src/Sylius/Component/Core/Factory/AddressFactory.php b/src/Sylius/Component/Core/Factory/AddressFactory.php index bf8d6b2899..9b71ed5101 100644 --- a/src/Sylius/Component/Core/Factory/AddressFactory.php +++ b/src/Sylius/Component/Core/Factory/AddressFactory.php @@ -17,6 +17,10 @@ use Sylius\Component\Core\Model\AddressInterface; use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of AddressInterface + * @implements AddressFactoryInterface + */ class AddressFactory implements AddressFactoryInterface { public function __construct(private FactoryInterface $decoratedFactory) diff --git a/src/Sylius/Component/Core/Factory/AddressFactoryInterface.php b/src/Sylius/Component/Core/Factory/AddressFactoryInterface.php index 67899f60a2..5ca2dbee96 100644 --- a/src/Sylius/Component/Core/Factory/AddressFactoryInterface.php +++ b/src/Sylius/Component/Core/Factory/AddressFactoryInterface.php @@ -17,6 +17,10 @@ use Sylius\Component\Core\Model\AddressInterface; use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of AddressInterface + * @extends FactoryInterface + */ interface AddressFactoryInterface extends FactoryInterface { public function createForCustomer(CustomerInterface $customer): AddressInterface; diff --git a/src/Sylius/Component/Core/Factory/CartItemFactory.php b/src/Sylius/Component/Core/Factory/CartItemFactory.php index d16512b5e5..af4d2c3860 100644 --- a/src/Sylius/Component/Core/Factory/CartItemFactory.php +++ b/src/Sylius/Component/Core/Factory/CartItemFactory.php @@ -19,6 +19,10 @@ use Sylius\Component\Core\Model\ProductInterface; use Sylius\Component\Product\Resolver\ProductVariantResolverInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of OrderItemInterface + * @implements CartItemFactoryInterface + */ final class CartItemFactory implements CartItemFactoryInterface { public function __construct(private FactoryInterface $decoratedFactory, private ProductVariantResolverInterface $variantResolver) diff --git a/src/Sylius/Component/Core/Factory/CartItemFactoryInterface.php b/src/Sylius/Component/Core/Factory/CartItemFactoryInterface.php index 08e1273cb7..8c97ee6aa8 100644 --- a/src/Sylius/Component/Core/Factory/CartItemFactoryInterface.php +++ b/src/Sylius/Component/Core/Factory/CartItemFactoryInterface.php @@ -18,6 +18,10 @@ use Sylius\Component\Core\Model\OrderItemInterface; use Sylius\Component\Core\Model\ProductInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of OrderItemInterface + * @extends FactoryInterface + */ interface CartItemFactoryInterface extends FactoryInterface { public function createForProduct(ProductInterface $product): OrderItemInterface; diff --git a/src/Sylius/Component/Core/Factory/ChannelFactory.php b/src/Sylius/Component/Core/Factory/ChannelFactory.php index 0a05f8ad52..6491d1f7b6 100644 --- a/src/Sylius/Component/Core/Factory/ChannelFactory.php +++ b/src/Sylius/Component/Core/Factory/ChannelFactory.php @@ -14,14 +14,21 @@ declare(strict_types=1); namespace Sylius\Component\Core\Factory; use Sylius\Component\Channel\Factory\ChannelFactoryInterface; -use Sylius\Component\Channel\Model\ChannelInterface; -use Sylius\Component\Core\Model\ChannelInterface as CoreChannelInterface; +use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\ChannelPriceHistoryConfigInterface; use Sylius\Component\Resource\Factory\FactoryInterface; use Webmozart\Assert\Assert; +/** + * @template T of ChannelInterface + * @implements ChannelFactoryInterface + */ final class ChannelFactory implements ChannelFactoryInterface { + /** + * @param FactoryInterface $decoratedFactory + * @param FactoryInterface|null $channelPriceHistoryConfigFactory + */ public function __construct( private FactoryInterface $decoratedFactory, private string $defaultCalculationStrategy, @@ -32,12 +39,9 @@ final class ChannelFactory implements ChannelFactoryInterface } } - /** - * @inheritdoc - */ + /** @inheritdoc */ public function createNew(): ChannelInterface { - /** @var CoreChannelInterface $channel */ $channel = $this->decoratedFactory->createNew(); $channel->setTaxCalculationStrategy($this->defaultCalculationStrategy); diff --git a/src/Sylius/Component/Core/Factory/ChannelPricingLogEntryFactory.php b/src/Sylius/Component/Core/Factory/ChannelPricingLogEntryFactory.php index 3c9a347fc9..710accad4c 100644 --- a/src/Sylius/Component/Core/Factory/ChannelPricingLogEntryFactory.php +++ b/src/Sylius/Component/Core/Factory/ChannelPricingLogEntryFactory.php @@ -17,6 +17,10 @@ use Sylius\Component\Core\Model\ChannelPricingInterface; use Sylius\Component\Core\Model\ChannelPricingLogEntryInterface; use Sylius\Component\Resource\Exception\UnsupportedMethodException; +/** + * @template T of ChannelPricingLogEntryInterface + * @implements ChannelPricingLogEntryFactoryInterface + */ final class ChannelPricingLogEntryFactory implements ChannelPricingLogEntryFactoryInterface { public function __construct(private string $className) diff --git a/src/Sylius/Component/Core/Factory/ChannelPricingLogEntryFactoryInterface.php b/src/Sylius/Component/Core/Factory/ChannelPricingLogEntryFactoryInterface.php index ea5dec9b0d..7c261a4906 100644 --- a/src/Sylius/Component/Core/Factory/ChannelPricingLogEntryFactoryInterface.php +++ b/src/Sylius/Component/Core/Factory/ChannelPricingLogEntryFactoryInterface.php @@ -17,6 +17,10 @@ use Sylius\Component\Core\Model\ChannelPricingInterface; use Sylius\Component\Core\Model\ChannelPricingLogEntryInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of ChannelPricingLogEntryInterface + * @extends FactoryInterface + */ interface ChannelPricingLogEntryFactoryInterface extends FactoryInterface { public function create( diff --git a/src/Sylius/Component/Core/Factory/CustomerAfterCheckoutFactory.php b/src/Sylius/Component/Core/Factory/CustomerAfterCheckoutFactory.php index f4a6ebeae0..f0343180bf 100644 --- a/src/Sylius/Component/Core/Factory/CustomerAfterCheckoutFactory.php +++ b/src/Sylius/Component/Core/Factory/CustomerAfterCheckoutFactory.php @@ -17,18 +17,20 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of CustomerInterface + * @implements CustomerAfterCheckoutFactoryInterface + */ final class CustomerAfterCheckoutFactory implements CustomerAfterCheckoutFactoryInterface { public function __construct(private FactoryInterface $baseCustomerFactory) { } + /** @inheritdoc */ public function createNew(): CustomerInterface { - /** @var CustomerInterface $customer */ - $customer = $this->baseCustomerFactory->createNew(); - - return $customer; + return $this->baseCustomerFactory->createNew(); } public function createAfterCheckout(OrderInterface $order): CustomerInterface diff --git a/src/Sylius/Component/Core/Factory/CustomerAfterCheckoutFactoryInterface.php b/src/Sylius/Component/Core/Factory/CustomerAfterCheckoutFactoryInterface.php index c331700931..286ae2c0c1 100644 --- a/src/Sylius/Component/Core/Factory/CustomerAfterCheckoutFactoryInterface.php +++ b/src/Sylius/Component/Core/Factory/CustomerAfterCheckoutFactoryInterface.php @@ -17,7 +17,14 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of CustomerInterface + * @extends FactoryInterface + */ interface CustomerAfterCheckoutFactoryInterface extends FactoryInterface { + /** + * @return T + */ public function createAfterCheckout(OrderInterface $order): CustomerInterface; } diff --git a/src/Sylius/Component/Core/Factory/PaymentMethodFactory.php b/src/Sylius/Component/Core/Factory/PaymentMethodFactory.php index b37b09a69f..d0259ba55f 100644 --- a/src/Sylius/Component/Core/Factory/PaymentMethodFactory.php +++ b/src/Sylius/Component/Core/Factory/PaymentMethodFactory.php @@ -17,12 +17,21 @@ use Payum\Core\Model\GatewayConfigInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of PaymentMethodInterface + * @implements PaymentMethodFactoryInterface + */ final class PaymentMethodFactory implements PaymentMethodFactoryInterface { + /** + * @param FactoryInterface $decoratedFactory + * @param FactoryInterface $gatewayConfigFactory + */ public function __construct(private FactoryInterface $decoratedFactory, private FactoryInterface $gatewayConfigFactory) { } + /** @inheritdoc */ public function createNew(): PaymentMethodInterface { return $this->decoratedFactory->createNew(); diff --git a/src/Sylius/Component/Core/Factory/PaymentMethodFactoryInterface.php b/src/Sylius/Component/Core/Factory/PaymentMethodFactoryInterface.php index 370b12a385..33e08b41db 100644 --- a/src/Sylius/Component/Core/Factory/PaymentMethodFactoryInterface.php +++ b/src/Sylius/Component/Core/Factory/PaymentMethodFactoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Core\Factory; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of PaymentMethodInterface + * @extends FactoryInterface + */ interface PaymentMethodFactoryInterface extends FactoryInterface { public function createWithGateway(string $gatewayFactory): PaymentMethodInterface; diff --git a/src/Sylius/Component/Core/Factory/PromotionActionFactory.php b/src/Sylius/Component/Core/Factory/PromotionActionFactory.php index e06ee2594d..dc9d712402 100644 --- a/src/Sylius/Component/Core/Factory/PromotionActionFactory.php +++ b/src/Sylius/Component/Core/Factory/PromotionActionFactory.php @@ -21,8 +21,14 @@ use Sylius\Component\Core\Promotion\Action\UnitPercentageDiscountPromotionAction use Sylius\Component\Promotion\Model\PromotionActionInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @implements PromotionActionFactoryInterface + */ final class PromotionActionFactory implements PromotionActionFactoryInterface { + /** + * @param FactoryInterface $decoratedFactory + */ public function __construct(private FactoryInterface $decoratedFactory) { } diff --git a/src/Sylius/Component/Core/Factory/PromotionActionFactoryInterface.php b/src/Sylius/Component/Core/Factory/PromotionActionFactoryInterface.php index 71afe168df..15b79f1a42 100644 --- a/src/Sylius/Component/Core/Factory/PromotionActionFactoryInterface.php +++ b/src/Sylius/Component/Core/Factory/PromotionActionFactoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Core\Factory; use Sylius\Component\Promotion\Model\PromotionActionInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of PromotionActionInterface + * @extends FactoryInterface + */ interface PromotionActionFactoryInterface extends FactoryInterface { public function createFixedDiscount(int $amount, string $channelCode): PromotionActionInterface; diff --git a/src/Sylius/Component/Core/Factory/PromotionRuleFactory.php b/src/Sylius/Component/Core/Factory/PromotionRuleFactory.php index b9c40aa732..bc0f8e466b 100644 --- a/src/Sylius/Component/Core/Factory/PromotionRuleFactory.php +++ b/src/Sylius/Component/Core/Factory/PromotionRuleFactory.php @@ -22,6 +22,9 @@ use Sylius\Component\Promotion\Checker\Rule\ItemTotalRuleChecker; use Sylius\Component\Promotion\Model\PromotionRuleInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @implements PromotionRuleFactoryInterface + */ final class PromotionRuleFactory implements PromotionRuleFactoryInterface { public function __construct(private FactoryInterface $decoratedFactory) diff --git a/src/Sylius/Component/Core/Factory/PromotionRuleFactoryInterface.php b/src/Sylius/Component/Core/Factory/PromotionRuleFactoryInterface.php index a0ab2a0925..69671c4fbf 100644 --- a/src/Sylius/Component/Core/Factory/PromotionRuleFactoryInterface.php +++ b/src/Sylius/Component/Core/Factory/PromotionRuleFactoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Core\Factory; use Sylius\Component\Promotion\Model\PromotionRuleInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of PromotionRuleInterface + * @extends FactoryInterface + */ interface PromotionRuleFactoryInterface extends FactoryInterface { public function createCartQuantity(int $count): PromotionRuleInterface; diff --git a/src/Sylius/Component/Core/Model/Order.php b/src/Sylius/Component/Core/Model/Order.php index cf1981e624..937b9db3bc 100644 --- a/src/Sylius/Component/Core/Model/Order.php +++ b/src/Sylius/Component/Core/Model/Order.php @@ -183,7 +183,7 @@ class Order extends BaseOrder implements OrderInterface public function getItemUnits(): Collection { - /** @var ArrayCollection $units */ + /** @var ArrayCollection $units */ $units = new ArrayCollection(); /** @var OrderItem $item */ diff --git a/src/Sylius/Component/Core/Model/OrderInterface.php b/src/Sylius/Component/Core/Model/OrderInterface.php index 90abd9fe9e..f20db2ddda 100644 --- a/src/Sylius/Component/Core/Model/OrderInterface.php +++ b/src/Sylius/Component/Core/Model/OrderInterface.php @@ -52,16 +52,12 @@ interface OrderInterface extends public function setPaymentState(?string $paymentState): void; /** - * @return Collection|OrderItemUnitInterface[] - * - * @psalm-return Collection + * @return Collection */ public function getItemUnits(): Collection; /** - * @return Collection|OrderItemUnitInterface[] - * - * @psalm-return Collection + * @return Collection */ public function getItemUnitsByVariant(ProductVariantInterface $variant): Collection; diff --git a/src/Sylius/Component/Core/Repository/AddressRepositoryInterface.php b/src/Sylius/Component/Core/Repository/AddressRepositoryInterface.php index ebad4a6b2e..3a39c4e545 100644 --- a/src/Sylius/Component/Core/Repository/AddressRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/AddressRepositoryInterface.php @@ -17,6 +17,10 @@ use Sylius\Component\Core\Model\AddressInterface; use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of AddressInterface + * @extends RepositoryInterface + */ interface AddressRepositoryInterface extends RepositoryInterface { /** diff --git a/src/Sylius/Component/Core/Repository/AvatarImageRepositoryInterface.php b/src/Sylius/Component/Core/Repository/AvatarImageRepositoryInterface.php index 0e58eee165..02eadee635 100644 --- a/src/Sylius/Component/Core/Repository/AvatarImageRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/AvatarImageRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Core\Repository; use Sylius\Component\Core\Model\ImageInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ImageInterface + * @extends RepositoryInterface + */ interface AvatarImageRepositoryInterface extends RepositoryInterface { public function findOneByOwnerId(string $id): ?ImageInterface; diff --git a/src/Sylius/Component/Core/Repository/ChannelPricingLogEntryRepositoryInterface.php b/src/Sylius/Component/Core/Repository/ChannelPricingLogEntryRepositoryInterface.php index becdc5a60c..faf5ef21b2 100644 --- a/src/Sylius/Component/Core/Repository/ChannelPricingLogEntryRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/ChannelPricingLogEntryRepositoryInterface.php @@ -18,6 +18,10 @@ use Sylius\Component\Core\Model\ChannelPricingInterface; use Sylius\Component\Core\Model\ChannelPricingLogEntryInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ChannelPricingLogEntryInterface + * @extends RepositoryInterface + */ interface ChannelPricingLogEntryRepositoryInterface extends RepositoryInterface { public function createByChannelPricingIdListQueryBuilder(mixed $channelPricingId): QueryBuilder; diff --git a/src/Sylius/Component/Core/Repository/CustomerRepositoryInterface.php b/src/Sylius/Component/Core/Repository/CustomerRepositoryInterface.php index 63468f4327..d4d6448dff 100644 --- a/src/Sylius/Component/Core/Repository/CustomerRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/CustomerRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Core\Repository; use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of CustomerInterface + * @extends RepositoryInterface + */ interface CustomerRepositoryInterface extends RepositoryInterface { public function countCustomers(): int; diff --git a/src/Sylius/Component/Core/Repository/OrderItemRepositoryInterface.php b/src/Sylius/Component/Core/Repository/OrderItemRepositoryInterface.php index 87a2933738..3fa11b00ba 100644 --- a/src/Sylius/Component/Core/Repository/OrderItemRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/OrderItemRepositoryInterface.php @@ -17,6 +17,10 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\OrderItemInterface; use Sylius\Component\Order\Repository\OrderItemRepositoryInterface as BaseOrderItemRepositoryInterface; +/** + * @template T of OrderItemInterface + * @extends BaseOrderItemRepositoryInterface + */ interface OrderItemRepositoryInterface extends BaseOrderItemRepositoryInterface { public function findOneByIdAndCustomer($id, CustomerInterface $customer): ?OrderItemInterface; diff --git a/src/Sylius/Component/Core/Repository/OrderItemUnitRepositoryInterface.php b/src/Sylius/Component/Core/Repository/OrderItemUnitRepositoryInterface.php index 8896235d4b..783db81b3c 100644 --- a/src/Sylius/Component/Core/Repository/OrderItemUnitRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/OrderItemUnitRepositoryInterface.php @@ -17,6 +17,10 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\OrderItemUnitInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of OrderItemUnitInterface + * @extends RepositoryInterface + */ interface OrderItemUnitRepositoryInterface extends RepositoryInterface { public function findOneByCustomer($id, CustomerInterface $customer): ?OrderItemUnitInterface; diff --git a/src/Sylius/Component/Core/Repository/OrderRepositoryInterface.php b/src/Sylius/Component/Core/Repository/OrderRepositoryInterface.php index f746bb849f..84431e3ba4 100644 --- a/src/Sylius/Component/Core/Repository/OrderRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/OrderRepositoryInterface.php @@ -21,6 +21,10 @@ use Sylius\Component\Core\Model\PromotionCouponInterface; use Sylius\Component\Order\Model\OrderInterface as BaseOrderInterface; use Sylius\Component\Order\Repository\OrderRepositoryInterface as BaseOrderRepositoryInterface; +/** + * @template T of OrderInterface + * @extends BaseOrderRepositoryInterface + */ interface OrderRepositoryInterface extends BaseOrderRepositoryInterface { public function createListQueryBuilder(): QueryBuilder; diff --git a/src/Sylius/Component/Core/Repository/PaymentMethodRepositoryInterface.php b/src/Sylius/Component/Core/Repository/PaymentMethodRepositoryInterface.php index 21121ea783..693d491a8f 100644 --- a/src/Sylius/Component/Core/Repository/PaymentMethodRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/PaymentMethodRepositoryInterface.php @@ -15,8 +15,13 @@ namespace Sylius\Component\Core\Repository; use Doctrine\ORM\QueryBuilder; use Sylius\Component\Core\Model\ChannelInterface; +use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Payment\Repository\PaymentMethodRepositoryInterface as BasePaymentMethodRepositoryInterface; +/** + * @template T of PaymentMethodInterface + * @extends BasePaymentMethodRepositoryInterface + */ interface PaymentMethodRepositoryInterface extends BasePaymentMethodRepositoryInterface { public function createListQueryBuilder(string $locale): QueryBuilder; diff --git a/src/Sylius/Component/Core/Repository/PaymentRepositoryInterface.php b/src/Sylius/Component/Core/Repository/PaymentRepositoryInterface.php index d79f87e154..80fb6709df 100644 --- a/src/Sylius/Component/Core/Repository/PaymentRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/PaymentRepositoryInterface.php @@ -18,6 +18,10 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of PaymentInterface + * @extends RepositoryInterface + */ interface PaymentRepositoryInterface extends RepositoryInterface { public function createListQueryBuilder(): QueryBuilder; diff --git a/src/Sylius/Component/Core/Repository/ProductAssociationRepositoryInterface.php b/src/Sylius/Component/Core/Repository/ProductAssociationRepositoryInterface.php index f67771c641..d7de776fd2 100644 --- a/src/Sylius/Component/Core/Repository/ProductAssociationRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/ProductAssociationRepositoryInterface.php @@ -17,6 +17,10 @@ use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Product\Model\ProductAssociationInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ProductAssociationInterface + * @extends RepositoryInterface + */ interface ProductAssociationRepositoryInterface extends RepositoryInterface { public function findWithProductsWithinChannel($associationId, ChannelInterface $channel): ProductAssociationInterface; diff --git a/src/Sylius/Component/Core/Repository/ProductRepositoryInterface.php b/src/Sylius/Component/Core/Repository/ProductRepositoryInterface.php index 2d391e86a5..9a74dbf5bd 100644 --- a/src/Sylius/Component/Core/Repository/ProductRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/ProductRepositoryInterface.php @@ -19,6 +19,10 @@ use Sylius\Component\Core\Model\ProductInterface; use Sylius\Component\Core\Model\TaxonInterface; use Sylius\Component\Product\Repository\ProductRepositoryInterface as BaseProductRepositoryInterface; +/** + * @template T of ProductInterface + * @extends BaseProductRepositoryInterface + */ interface ProductRepositoryInterface extends BaseProductRepositoryInterface { /** @param mixed|null $taxonId */ diff --git a/src/Sylius/Component/Core/Repository/ProductReviewRepositoryInterface.php b/src/Sylius/Component/Core/Repository/ProductReviewRepositoryInterface.php index 221142bf7f..8e680a116a 100644 --- a/src/Sylius/Component/Core/Repository/ProductReviewRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/ProductReviewRepositoryInterface.php @@ -18,6 +18,10 @@ use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; use Sylius\Component\Review\Model\ReviewInterface; +/** + * @template T of ReviewInterface + * @extends RepositoryInterface + */ interface ProductReviewRepositoryInterface extends RepositoryInterface { /** diff --git a/src/Sylius/Component/Core/Repository/ProductTaxonRepositoryInterface.php b/src/Sylius/Component/Core/Repository/ProductTaxonRepositoryInterface.php index ab5b4278e8..e5097ff5e2 100644 --- a/src/Sylius/Component/Core/Repository/ProductTaxonRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/ProductTaxonRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Core\Repository; use Sylius\Component\Core\Model\ProductTaxonInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ProductTaxonInterface + * @extends RepositoryInterface + */ interface ProductTaxonRepositoryInterface extends RepositoryInterface { public function findOneByProductCodeAndTaxonCode(string $productCode, string $taxonCode): ?ProductTaxonInterface; diff --git a/src/Sylius/Component/Core/Repository/ProductVariantRepositoryInterface.php b/src/Sylius/Component/Core/Repository/ProductVariantRepositoryInterface.php index 195c7cd13e..f0fb2466a5 100644 --- a/src/Sylius/Component/Core/Repository/ProductVariantRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/ProductVariantRepositoryInterface.php @@ -15,9 +15,14 @@ namespace Sylius\Component\Core\Repository; use Doctrine\ORM\QueryBuilder; use Sylius\Component\Core\Model\CatalogPromotionInterface; +use Sylius\Component\Core\Model\ProductVariantInterface; use Sylius\Component\Core\Model\TaxonInterface; use Sylius\Component\Product\Repository\ProductVariantRepositoryInterface as BaseProductVariantRepositoryInterface; +/** + * @template T of ProductVariantInterface + * @extends BaseProductVariantRepositoryInterface + */ interface ProductVariantRepositoryInterface extends BaseProductVariantRepositoryInterface { public function createInventoryListQueryBuilder(string $locale): QueryBuilder; diff --git a/src/Sylius/Component/Core/Repository/PromotionRepositoryInterface.php b/src/Sylius/Component/Core/Repository/PromotionRepositoryInterface.php index cb7a6450da..9bc5b1d536 100644 --- a/src/Sylius/Component/Core/Repository/PromotionRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/PromotionRepositoryInterface.php @@ -17,6 +17,10 @@ use Sylius\Component\Channel\Model\ChannelInterface; use Sylius\Component\Core\Model\PromotionInterface; use Sylius\Component\Promotion\Repository\PromotionRepositoryInterface as BasePromotionRepositoryInterface; +/** + * @template T of PromotionInterface + * @extends BasePromotionRepositoryInterface + */ interface PromotionRepositoryInterface extends BasePromotionRepositoryInterface { /** diff --git a/src/Sylius/Component/Core/Repository/ShipmentRepositoryInterface.php b/src/Sylius/Component/Core/Repository/ShipmentRepositoryInterface.php index 586d08e4e3..0fb0e45544 100644 --- a/src/Sylius/Component/Core/Repository/ShipmentRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/ShipmentRepositoryInterface.php @@ -19,6 +19,10 @@ use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\ShipmentInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ShipmentInterface + * @extends RepositoryInterface + */ interface ShipmentRepositoryInterface extends RepositoryInterface { public function createListQueryBuilder(): QueryBuilder; diff --git a/src/Sylius/Component/Core/Repository/ShippingCategoryRepositoryInterface.php b/src/Sylius/Component/Core/Repository/ShippingCategoryRepositoryInterface.php index f34a8fe937..0cb5236eb9 100644 --- a/src/Sylius/Component/Core/Repository/ShippingCategoryRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/ShippingCategoryRepositoryInterface.php @@ -15,7 +15,12 @@ namespace Sylius\Component\Core\Repository; use Doctrine\ORM\QueryBuilder; use Sylius\Component\Resource\Repository\RepositoryInterface; +use Sylius\Component\Shipping\Model\ShippingCategoryInterface; +/** + * @template T of ShippingCategoryInterface + * @extends RepositoryInterface + */ interface ShippingCategoryRepositoryInterface extends RepositoryInterface { public function createListQueryBuilder(): QueryBuilder; diff --git a/src/Sylius/Component/Core/Repository/ShippingMethodRepositoryInterface.php b/src/Sylius/Component/Core/Repository/ShippingMethodRepositoryInterface.php index 39e15165d1..d7c2a03a29 100644 --- a/src/Sylius/Component/Core/Repository/ShippingMethodRepositoryInterface.php +++ b/src/Sylius/Component/Core/Repository/ShippingMethodRepositoryInterface.php @@ -18,6 +18,10 @@ use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\ShippingMethodInterface; use Sylius\Component\Shipping\Repository\ShippingMethodRepositoryInterface as BaseShippingMethodRepositoryInterface; +/** + * @template T of ShippingMethodInterface + * @extends BaseShippingMethodRepositoryInterface + */ interface ShippingMethodRepositoryInterface extends BaseShippingMethodRepositoryInterface { public function createListQueryBuilder(string $locale): QueryBuilder; diff --git a/src/Sylius/Component/Currency/Repository/ExchangeRateRepositoryInterface.php b/src/Sylius/Component/Currency/Repository/ExchangeRateRepositoryInterface.php index a1a095e651..ae98240363 100644 --- a/src/Sylius/Component/Currency/Repository/ExchangeRateRepositoryInterface.php +++ b/src/Sylius/Component/Currency/Repository/ExchangeRateRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Currency\Repository; use Sylius\Component\Currency\Model\ExchangeRateInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ExchangeRateInterface + * @extends RepositoryInterface + */ interface ExchangeRateRepositoryInterface extends RepositoryInterface { public function findOneWithCurrencyPair(string $firstCurrencyCode, string $secondCurrencyCode): ?ExchangeRateInterface; diff --git a/src/Sylius/Component/Customer/Repository/CustomerGroupRepositoryInterface.php b/src/Sylius/Component/Customer/Repository/CustomerGroupRepositoryInterface.php index d8f231c600..49cfc82640 100644 --- a/src/Sylius/Component/Customer/Repository/CustomerGroupRepositoryInterface.php +++ b/src/Sylius/Component/Customer/Repository/CustomerGroupRepositoryInterface.php @@ -13,8 +13,13 @@ declare(strict_types=1); namespace Sylius\Component\Customer\Repository; +use Sylius\Component\Customer\Model\CustomerGroupInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of CustomerGroupInterface + * @extends RepositoryInterface + */ interface CustomerGroupRepositoryInterface extends RepositoryInterface { public function findByPhrase(string $phrase, ?int $limit = null): iterable; diff --git a/src/Sylius/Component/Order/Factory/AdjustmentFactory.php b/src/Sylius/Component/Order/Factory/AdjustmentFactory.php index f144aba47f..fc74b87ce8 100644 --- a/src/Sylius/Component/Order/Factory/AdjustmentFactory.php +++ b/src/Sylius/Component/Order/Factory/AdjustmentFactory.php @@ -16,6 +16,9 @@ namespace Sylius\Component\Order\Factory; use Sylius\Component\Order\Model\AdjustmentInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @implements AdjustmentFactoryInterface + */ class AdjustmentFactory implements AdjustmentFactoryInterface { public function __construct(private FactoryInterface $adjustmentFactory) diff --git a/src/Sylius/Component/Order/Factory/AdjustmentFactoryInterface.php b/src/Sylius/Component/Order/Factory/AdjustmentFactoryInterface.php index 6c94c0bd45..e8eba9d31a 100644 --- a/src/Sylius/Component/Order/Factory/AdjustmentFactoryInterface.php +++ b/src/Sylius/Component/Order/Factory/AdjustmentFactoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Order\Factory; use Sylius\Component\Order\Model\AdjustmentInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of AdjustmentInterface + * @extends FactoryInterface + */ interface AdjustmentFactoryInterface extends FactoryInterface { public function createWithData( diff --git a/src/Sylius/Component/Order/Factory/OrderItemUnitFactory.php b/src/Sylius/Component/Order/Factory/OrderItemUnitFactory.php index 5977c88a6f..89755e1eb4 100644 --- a/src/Sylius/Component/Order/Factory/OrderItemUnitFactory.php +++ b/src/Sylius/Component/Order/Factory/OrderItemUnitFactory.php @@ -17,6 +17,9 @@ use Sylius\Component\Order\Model\OrderItemInterface; use Sylius\Component\Order\Model\OrderItemUnitInterface; use Sylius\Component\Resource\Exception\UnsupportedMethodException; +/** + * @implements OrderItemUnitFactoryInterface + */ class OrderItemUnitFactory implements OrderItemUnitFactoryInterface { /** diff --git a/src/Sylius/Component/Order/Factory/OrderItemUnitFactoryInterface.php b/src/Sylius/Component/Order/Factory/OrderItemUnitFactoryInterface.php index d1b8c088fd..503ccb7b4e 100644 --- a/src/Sylius/Component/Order/Factory/OrderItemUnitFactoryInterface.php +++ b/src/Sylius/Component/Order/Factory/OrderItemUnitFactoryInterface.php @@ -17,6 +17,10 @@ use Sylius\Component\Order\Model\OrderItemInterface; use Sylius\Component\Order\Model\OrderItemUnitInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of OrderItemUnitInterface + * @extends FactoryInterface + */ interface OrderItemUnitFactoryInterface extends FactoryInterface { public function createForItem(OrderItemInterface $orderItem): OrderItemUnitInterface; diff --git a/src/Sylius/Component/Order/Repository/OrderItemRepositoryInterface.php b/src/Sylius/Component/Order/Repository/OrderItemRepositoryInterface.php index 371957f0ac..4b7cdf3382 100644 --- a/src/Sylius/Component/Order/Repository/OrderItemRepositoryInterface.php +++ b/src/Sylius/Component/Order/Repository/OrderItemRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Order\Repository; use Sylius\Component\Order\Model\OrderItemInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of OrderItemInterface + * @extends RepositoryInterface + */ interface OrderItemRepositoryInterface extends RepositoryInterface { public function findOneByIdAndCartId($id, $cartId): ?OrderItemInterface; diff --git a/src/Sylius/Component/Order/Repository/OrderRepositoryInterface.php b/src/Sylius/Component/Order/Repository/OrderRepositoryInterface.php index 53260046ce..535b17c7b2 100644 --- a/src/Sylius/Component/Order/Repository/OrderRepositoryInterface.php +++ b/src/Sylius/Component/Order/Repository/OrderRepositoryInterface.php @@ -17,6 +17,10 @@ use Doctrine\ORM\QueryBuilder; use Sylius\Component\Order\Model\OrderInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of OrderInterface + * @extends RepositoryInterface + */ interface OrderRepositoryInterface extends RepositoryInterface { public function countPlacedOrders(): int; diff --git a/src/Sylius/Component/Payment/Factory/PaymentFactory.php b/src/Sylius/Component/Payment/Factory/PaymentFactory.php index b590831276..6e6e8ac420 100644 --- a/src/Sylius/Component/Payment/Factory/PaymentFactory.php +++ b/src/Sylius/Component/Payment/Factory/PaymentFactory.php @@ -16,6 +16,9 @@ namespace Sylius\Component\Payment\Factory; use Sylius\Component\Payment\Model\PaymentInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @implements PaymentFactoryInterface + */ final class PaymentFactory implements PaymentFactoryInterface { public function __construct(private FactoryInterface $factory) diff --git a/src/Sylius/Component/Payment/Factory/PaymentFactoryInterface.php b/src/Sylius/Component/Payment/Factory/PaymentFactoryInterface.php index 175c364004..c40b44f12c 100644 --- a/src/Sylius/Component/Payment/Factory/PaymentFactoryInterface.php +++ b/src/Sylius/Component/Payment/Factory/PaymentFactoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Payment\Factory; use Sylius\Component\Payment\Model\PaymentInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of PaymentInterface + * @extends FactoryInterface + */ interface PaymentFactoryInterface extends FactoryInterface { public function createWithAmountAndCurrencyCode(int $amount, string $currency): PaymentInterface; diff --git a/src/Sylius/Component/Payment/Repository/PaymentMethodRepositoryInterface.php b/src/Sylius/Component/Payment/Repository/PaymentMethodRepositoryInterface.php index 78359cb81e..6c80f7b161 100644 --- a/src/Sylius/Component/Payment/Repository/PaymentMethodRepositoryInterface.php +++ b/src/Sylius/Component/Payment/Repository/PaymentMethodRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Payment\Repository; use Sylius\Component\Payment\Model\PaymentMethodInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of PaymentMethodInterface + * @extends RepositoryInterface + */ interface PaymentMethodRepositoryInterface extends RepositoryInterface { /** diff --git a/src/Sylius/Component/Product/Factory/ProductVariantFactory.php b/src/Sylius/Component/Product/Factory/ProductVariantFactory.php index ae15ce322d..3a2dc3544c 100644 --- a/src/Sylius/Component/Product/Factory/ProductVariantFactory.php +++ b/src/Sylius/Component/Product/Factory/ProductVariantFactory.php @@ -17,6 +17,9 @@ use Sylius\Component\Product\Model\ProductInterface; use Sylius\Component\Product\Model\ProductVariantInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @implements ProductVariantFactoryInterface + */ class ProductVariantFactory implements ProductVariantFactoryInterface { public function __construct(private FactoryInterface $factory) diff --git a/src/Sylius/Component/Product/Factory/ProductVariantFactoryInterface.php b/src/Sylius/Component/Product/Factory/ProductVariantFactoryInterface.php index e9cab1e06b..13921f8fbc 100644 --- a/src/Sylius/Component/Product/Factory/ProductVariantFactoryInterface.php +++ b/src/Sylius/Component/Product/Factory/ProductVariantFactoryInterface.php @@ -17,6 +17,10 @@ use Sylius\Component\Product\Model\ProductInterface; use Sylius\Component\Product\Model\ProductVariantInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of ProductVariantInterface + * @extends FactoryInterface + */ interface ProductVariantFactoryInterface extends FactoryInterface { public function createForProduct(ProductInterface $product): ProductVariantInterface; diff --git a/src/Sylius/Component/Product/Model/Product.php b/src/Sylius/Component/Product/Model/Product.php index 3f603aa5bf..008a6d9b78 100644 --- a/src/Sylius/Component/Product/Model/Product.php +++ b/src/Sylius/Component/Product/Model/Product.php @@ -169,6 +169,9 @@ class Product implements ProductInterface, \Stringable return $this->attributes; } + /** + * @return Collection + */ public function getAttributesByLocale( string $localeCode, string $fallbackLocaleCode, @@ -190,7 +193,10 @@ class Product implements ProductInterface, \Stringable $attributesWithFallback[] = $this->getAttributeInDifferentLocale($attribute, $localeCode, $fallbackLocaleCode); } - return new ArrayCollection($attributesWithFallback); + /** @var Collection $collection */ + $collection = new ArrayCollection($attributesWithFallback); + + return $collection; } public function addAttribute(?AttributeValueInterface $attribute): void diff --git a/src/Sylius/Component/Product/Repository/ProductAssociationTypeRepositoryInterface.php b/src/Sylius/Component/Product/Repository/ProductAssociationTypeRepositoryInterface.php index d7a8d3c194..64d32f85c0 100644 --- a/src/Sylius/Component/Product/Repository/ProductAssociationTypeRepositoryInterface.php +++ b/src/Sylius/Component/Product/Repository/ProductAssociationTypeRepositoryInterface.php @@ -17,6 +17,10 @@ use Doctrine\ORM\QueryBuilder; use Sylius\Component\Product\Model\ProductAssociationTypeInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ProductAssociationTypeInterface + * @extends RepositoryInterface + */ interface ProductAssociationTypeRepositoryInterface extends RepositoryInterface { public function createListQueryBuilder(string $locale): QueryBuilder; diff --git a/src/Sylius/Component/Product/Repository/ProductAttributeValueRepositoryInterface.php b/src/Sylius/Component/Product/Repository/ProductAttributeValueRepositoryInterface.php index 769297257b..28594ee9dd 100644 --- a/src/Sylius/Component/Product/Repository/ProductAttributeValueRepositoryInterface.php +++ b/src/Sylius/Component/Product/Repository/ProductAttributeValueRepositoryInterface.php @@ -17,6 +17,10 @@ use Doctrine\ORM\QueryBuilder; use Sylius\Component\Product\Model\ProductAttributeValueInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ProductAttributeValueInterface + * @extends RepositoryInterface + */ interface ProductAttributeValueRepositoryInterface extends RepositoryInterface { /** diff --git a/src/Sylius/Component/Product/Repository/ProductOptionRepositoryInterface.php b/src/Sylius/Component/Product/Repository/ProductOptionRepositoryInterface.php index f50581764d..5d95e809ac 100644 --- a/src/Sylius/Component/Product/Repository/ProductOptionRepositoryInterface.php +++ b/src/Sylius/Component/Product/Repository/ProductOptionRepositoryInterface.php @@ -17,6 +17,10 @@ use Doctrine\ORM\QueryBuilder; use Sylius\Component\Product\Model\ProductOptionInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ProductOptionInterface + * @extends RepositoryInterface + */ interface ProductOptionRepositoryInterface extends RepositoryInterface { public function createListQueryBuilder(string $locale): QueryBuilder; diff --git a/src/Sylius/Component/Product/Repository/ProductRepositoryInterface.php b/src/Sylius/Component/Product/Repository/ProductRepositoryInterface.php index 9cc5d1b0b1..8602324543 100644 --- a/src/Sylius/Component/Product/Repository/ProductRepositoryInterface.php +++ b/src/Sylius/Component/Product/Repository/ProductRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Product\Repository; use Sylius\Component\Product\Model\ProductInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ProductInterface + * @extends RepositoryInterface + */ interface ProductRepositoryInterface extends RepositoryInterface { /** diff --git a/src/Sylius/Component/Product/Repository/ProductVariantRepositoryInterface.php b/src/Sylius/Component/Product/Repository/ProductVariantRepositoryInterface.php index c8495b90ed..e5b8bf860a 100644 --- a/src/Sylius/Component/Product/Repository/ProductVariantRepositoryInterface.php +++ b/src/Sylius/Component/Product/Repository/ProductVariantRepositoryInterface.php @@ -18,6 +18,10 @@ use Sylius\Component\Product\Model\ProductInterface; use Sylius\Component\Product\Model\ProductVariantInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of ProductVariantInterface + * @extends RepositoryInterface + */ interface ProductVariantRepositoryInterface extends RepositoryInterface { public function createQueryBuilderByProductId(string $locale, $productId): QueryBuilder; diff --git a/src/Sylius/Component/Promotion/Factory/PromotionCouponFactory.php b/src/Sylius/Component/Promotion/Factory/PromotionCouponFactory.php index 8937d64713..e521a4e5de 100644 --- a/src/Sylius/Component/Promotion/Factory/PromotionCouponFactory.php +++ b/src/Sylius/Component/Promotion/Factory/PromotionCouponFactory.php @@ -18,6 +18,9 @@ use Sylius\Component\Promotion\Model\PromotionInterface; use Sylius\Component\Resource\Factory\FactoryInterface; use Webmozart\Assert\Assert; +/** + * @implements PromotionCouponFactoryInterface + */ final class PromotionCouponFactory implements PromotionCouponFactoryInterface { public function __construct(private FactoryInterface $factory) diff --git a/src/Sylius/Component/Promotion/Factory/PromotionCouponFactoryInterface.php b/src/Sylius/Component/Promotion/Factory/PromotionCouponFactoryInterface.php index ec8653ada2..a5c68a2ad8 100644 --- a/src/Sylius/Component/Promotion/Factory/PromotionCouponFactoryInterface.php +++ b/src/Sylius/Component/Promotion/Factory/PromotionCouponFactoryInterface.php @@ -17,6 +17,10 @@ use Sylius\Component\Promotion\Model\PromotionCouponInterface; use Sylius\Component\Promotion\Model\PromotionInterface; use Sylius\Component\Resource\Factory\FactoryInterface; +/** + * @template T of PromotionCouponInterface + * @extends FactoryInterface + */ interface PromotionCouponFactoryInterface extends FactoryInterface { /** diff --git a/src/Sylius/Component/Promotion/Repository/CatalogPromotionRepositoryInterface.php b/src/Sylius/Component/Promotion/Repository/CatalogPromotionRepositoryInterface.php index 0050c71b62..66e034f0ae 100644 --- a/src/Sylius/Component/Promotion/Repository/CatalogPromotionRepositoryInterface.php +++ b/src/Sylius/Component/Promotion/Repository/CatalogPromotionRepositoryInterface.php @@ -14,8 +14,13 @@ declare(strict_types=1); namespace Sylius\Component\Promotion\Repository; use Sylius\Bundle\PromotionBundle\Criteria\CriteriaInterface; +use Sylius\Component\Promotion\Model\CatalogPromotionInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of CatalogPromotionInterface + * @extends RepositoryInterface + */ interface CatalogPromotionRepositoryInterface extends RepositoryInterface { /** diff --git a/src/Sylius/Component/Promotion/Repository/PromotionCouponRepositoryInterface.php b/src/Sylius/Component/Promotion/Repository/PromotionCouponRepositoryInterface.php index 4a011a955e..4faa7f060e 100644 --- a/src/Sylius/Component/Promotion/Repository/PromotionCouponRepositoryInterface.php +++ b/src/Sylius/Component/Promotion/Repository/PromotionCouponRepositoryInterface.php @@ -17,6 +17,10 @@ use Doctrine\ORM\QueryBuilder; use Sylius\Component\Promotion\Model\PromotionCouponInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of PromotionCouponInterface + * @extends RepositoryInterface + */ interface PromotionCouponRepositoryInterface extends RepositoryInterface { public function createQueryBuilderByPromotionId($promotionId): QueryBuilder; diff --git a/src/Sylius/Component/Promotion/Repository/PromotionRepositoryInterface.php b/src/Sylius/Component/Promotion/Repository/PromotionRepositoryInterface.php index f64ab9bd6a..644066f061 100644 --- a/src/Sylius/Component/Promotion/Repository/PromotionRepositoryInterface.php +++ b/src/Sylius/Component/Promotion/Repository/PromotionRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Promotion\Repository; use Sylius\Component\Promotion\Model\PromotionInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; +/** + * @template T of PromotionInterface + * @extends RepositoryInterface + */ interface PromotionRepositoryInterface extends RepositoryInterface { /** diff --git a/src/Sylius/Component/Review/Factory/ReviewFactory.php b/src/Sylius/Component/Review/Factory/ReviewFactory.php index 2d0d1a7f2d..b263168e7f 100644 --- a/src/Sylius/Component/Review/Factory/ReviewFactory.php +++ b/src/Sylius/Component/Review/Factory/ReviewFactory.php @@ -18,6 +18,9 @@ use Sylius\Component\Review\Model\ReviewableInterface; use Sylius\Component\Review\Model\ReviewerInterface; use Sylius\Component\Review\Model\ReviewInterface; +/** + * @implements ReviewFactoryInterface + */ final class ReviewFactory implements ReviewFactoryInterface { public function __construct(private FactoryInterface $factory) diff --git a/src/Sylius/Component/Review/Factory/ReviewFactoryInterface.php b/src/Sylius/Component/Review/Factory/ReviewFactoryInterface.php index 5593899644..65603a376c 100644 --- a/src/Sylius/Component/Review/Factory/ReviewFactoryInterface.php +++ b/src/Sylius/Component/Review/Factory/ReviewFactoryInterface.php @@ -18,6 +18,10 @@ use Sylius\Component\Review\Model\ReviewableInterface; use Sylius\Component\Review\Model\ReviewerInterface; use Sylius\Component\Review\Model\ReviewInterface; +/** + * @template T of ReviewInterface + * @extends FactoryInterface + */ interface ReviewFactoryInterface extends FactoryInterface { public function createForSubject(ReviewableInterface $subject): ReviewInterface; diff --git a/src/Sylius/Component/Shipping/Repository/ShippingMethodRepositoryInterface.php b/src/Sylius/Component/Shipping/Repository/ShippingMethodRepositoryInterface.php index d2994f2343..feaf57ac39 100644 --- a/src/Sylius/Component/Shipping/Repository/ShippingMethodRepositoryInterface.php +++ b/src/Sylius/Component/Shipping/Repository/ShippingMethodRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Shipping\Repository; use Sylius\Component\Resource\Repository\RepositoryInterface; use Sylius\Component\Shipping\Model\ShippingMethodInterface; +/** + * @template T of ShippingMethodInterface + * @extends RepositoryInterface + */ interface ShippingMethodRepositoryInterface extends RepositoryInterface { /** diff --git a/src/Sylius/Component/Taxation/Repository/TaxCategoryRepositoryInterface.php b/src/Sylius/Component/Taxation/Repository/TaxCategoryRepositoryInterface.php index 9442a8f7dd..25d9de8c0f 100644 --- a/src/Sylius/Component/Taxation/Repository/TaxCategoryRepositoryInterface.php +++ b/src/Sylius/Component/Taxation/Repository/TaxCategoryRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Taxation\Repository; use Sylius\Component\Resource\Repository\RepositoryInterface; use Sylius\Component\Taxation\Model\TaxCategoryInterface; +/** + * @template T of TaxCategoryInterface + * @extends RepositoryInterface + */ interface TaxCategoryRepositoryInterface extends RepositoryInterface { /** diff --git a/src/Sylius/Component/Taxonomy/Factory/TaxonFactory.php b/src/Sylius/Component/Taxonomy/Factory/TaxonFactory.php index 6d2eca449e..9906c4e228 100644 --- a/src/Sylius/Component/Taxonomy/Factory/TaxonFactory.php +++ b/src/Sylius/Component/Taxonomy/Factory/TaxonFactory.php @@ -16,6 +16,9 @@ namespace Sylius\Component\Taxonomy\Factory; use Sylius\Component\Resource\Factory\FactoryInterface; use Sylius\Component\Taxonomy\Model\TaxonInterface; +/** + * @implements TaxonFactoryInterface + */ final class TaxonFactory implements TaxonFactoryInterface { public function __construct(private FactoryInterface $factory) diff --git a/src/Sylius/Component/Taxonomy/Factory/TaxonFactoryInterface.php b/src/Sylius/Component/Taxonomy/Factory/TaxonFactoryInterface.php index 7c7c2d7956..c2cb33f41a 100644 --- a/src/Sylius/Component/Taxonomy/Factory/TaxonFactoryInterface.php +++ b/src/Sylius/Component/Taxonomy/Factory/TaxonFactoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\Taxonomy\Factory; use Sylius\Component\Resource\Factory\FactoryInterface; use Sylius\Component\Taxonomy\Model\TaxonInterface; +/** + * @template T of TaxonInterface + * @extends FactoryInterface + */ interface TaxonFactoryInterface extends FactoryInterface { public function createForParent(TaxonInterface $parent): TaxonInterface; diff --git a/src/Sylius/Component/Taxonomy/Model/Taxon.php b/src/Sylius/Component/Taxonomy/Model/Taxon.php index a94ce7e456..efcac67a1f 100644 --- a/src/Sylius/Component/Taxonomy/Model/Taxon.php +++ b/src/Sylius/Component/Taxonomy/Model/Taxon.php @@ -109,6 +109,9 @@ class Taxon implements TaxonInterface, \Stringable } } + /** + * @return Collection + */ public function getAncestors(): Collection { $ancestors = []; @@ -117,7 +120,10 @@ class Taxon implements TaxonInterface, \Stringable $ancestors[] = $ancestor; } - return new ArrayCollection($ancestors); + /** @var Collection $collection */ + $collection = new ArrayCollection($ancestors); + + return $collection; } public function getChildren(): Collection diff --git a/src/Sylius/Component/Taxonomy/Model/TaxonInterface.php b/src/Sylius/Component/Taxonomy/Model/TaxonInterface.php index f2a6aada50..868de26709 100644 --- a/src/Sylius/Component/Taxonomy/Model/TaxonInterface.php +++ b/src/Sylius/Component/Taxonomy/Model/TaxonInterface.php @@ -32,9 +32,7 @@ interface TaxonInterface extends CodeAwareInterface, TranslatableInterface, Reso public function setParent(?self $taxon): void; /** - * @return Collection|TaxonInterface[] - * - * @psalm-return Collection + * @return Collection */ public function getAncestors(): Collection; diff --git a/src/Sylius/Component/Taxonomy/Repository/TaxonRepositoryInterface.php b/src/Sylius/Component/Taxonomy/Repository/TaxonRepositoryInterface.php index 1741adb8fa..50827661cd 100644 --- a/src/Sylius/Component/Taxonomy/Repository/TaxonRepositoryInterface.php +++ b/src/Sylius/Component/Taxonomy/Repository/TaxonRepositoryInterface.php @@ -17,6 +17,10 @@ use Doctrine\ORM\QueryBuilder; use Sylius\Component\Resource\Repository\RepositoryInterface; use Sylius\Component\Taxonomy\Model\TaxonInterface; +/** + * @template T of TaxonInterface + * @extends RepositoryInterface + */ interface TaxonRepositoryInterface extends RepositoryInterface { /** diff --git a/src/Sylius/Component/User/Repository/UserRepositoryInterface.php b/src/Sylius/Component/User/Repository/UserRepositoryInterface.php index dae77d32ef..e8e00a89d7 100644 --- a/src/Sylius/Component/User/Repository/UserRepositoryInterface.php +++ b/src/Sylius/Component/User/Repository/UserRepositoryInterface.php @@ -16,6 +16,10 @@ namespace Sylius\Component\User\Repository; use Sylius\Component\Resource\Repository\RepositoryInterface; use Sylius\Component\User\Model\UserInterface; +/** + * @template T of UserInterface + * @extends RepositoryInterface + */ interface UserRepositoryInterface extends RepositoryInterface { public function findOneByEmail(string $email): ?UserInterface; diff --git a/symfony.lock b/symfony.lock index 4cac7c0648..a184e6fd38 100644 --- a/symfony.lock +++ b/symfony.lock @@ -49,9 +49,6 @@ "coduo/php-to-string": { "version": "3.0.0" }, - "composer/package-versions-deprecated": { - "version": "1.11.99.1" - }, "composer/pcre": { "version": "3.0.0" }, @@ -976,9 +973,6 @@ "webmozart/assert": { "version": "1.9.1" }, - "webmozart/path-util": { - "version": "2.3.0" - }, "willdurand/hateoas": { "version": "2.12.0" },