[CS][DX] Refactor

This commit is contained in:
Sylius Bot 2023-11-27 02:18:39 +00:00 committed by Jacob Tobiasz
parent 8c6ad41cb5
commit d1c23790b6
2 changed files with 7 additions and 5 deletions

View file

@ -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,
);
}
}
@ -43,7 +45,7 @@ final class DefaultProductVariantResolver implements ProductVariantResolverInter
'position' => 'ASC',
'id' => 'ASC',
],
1
1,
);
return $productVariants[0] ?? null;

View file

@ -64,7 +64,7 @@ final class DefaultProductVariantResolverSpec extends ObjectBehavior
'position' => 'ASC',
'id' => 'ASC',
],
1
1,
)->willReturn([$variant]);
$this->getVariant($product)->shouldReturn($variant);
@ -86,7 +86,7 @@ final class DefaultProductVariantResolverSpec extends ObjectBehavior
'position' => 'ASC',
'id' => 'ASC',
],
1
1,
)->willReturn([]);
$this->getVariant($product)->shouldReturn(null);