Skip to content

Commit

Permalink
[CS][DX] Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylius Bot authored and jakubtobiasz committed Nov 29, 2023
1 parent 8c6ad41 commit d1c2379
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -22,10 +22,12 @@ final class DefaultProductVariantResolver implements ProductVariantResolverInter
public function __construct(private ?ProductVariantRepositoryInterface $productVariantRepository = null)
{
if (null === $productVariantRepository) {
trigger_deprecation('sylius/product', '1.12',
trigger_deprecation(
'sylius/product',
'1.12',
'Not passing a service that implements "%s" as a 1st argument of "%s" constructor is deprecated and will be prohibited in 2.0.',
ProductVariantRepositoryInterface::class,
self::class
self::class,
);
}
}
Expand All @@ -43,7 +45,7 @@ public function getVariant(ProductInterface $subject): ?ProductVariantInterface
'position' => 'ASC',
'id' => 'ASC',
],
1
1,
);

return $productVariants[0] ?? null;
Expand Down
Expand Up @@ -64,7 +64,7 @@ function it_returns_first_variant_if_product_variant_repository_is_initialized(
'position' => 'ASC',
'id' => 'ASC',
],
1
1,
)->willReturn([$variant]);

$this->getVariant($product)->shouldReturn($variant);
Expand All @@ -86,7 +86,7 @@ function it_returns_null_if_first_variant_is_not_defined_and_product_variant_rep
'position' => 'ASC',
'id' => 'ASC',
],
1
1,
)->willReturn([]);

$this->getVariant($product)->shouldReturn(null);
Expand Down

0 comments on commit d1c2379

Please sign in to comment.