Skip to content

Commit

Permalink
minor #297 Add interface prefix to number generator (GSadee)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.0-dev branch.

Discussion
----------

Associated with #191

Commits
-------

8b31592 Add interface prefix to number generator
  • Loading branch information
Zales0123 authored May 31, 2021
2 parents 7031729 + 8b31592 commit f0c2ef8
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ always generated after credit memo. Technical changes:
facilitate post-units refunding process.
* Their `__invoke` methods were replaced by `Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessStepInterface::next(UnitsRefunded $unitsRefunded)`.

1. `Sylius\RefundPlugin\Generator\NumberGenerator` has been changed to `Sylius\RefundPlugin\Generator\NumberGeneratorInterface`.

### UPGRADE FROM 1.0.0-RC.7 TO 1.0.0-RC.8

1. The `fully_refunded` state and the `refund` transition have been removed from `sylius_order` state machine.
Expand Down
6 changes: 3 additions & 3 deletions spec/Factory/CreditMemoFactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
use Sylius\RefundPlugin\Entity\TaxItemInterface;
use Sylius\RefundPlugin\Factory\CreditMemoFactoryInterface;
use Sylius\RefundPlugin\Generator\CreditMemoIdentifierGeneratorInterface;
use Sylius\RefundPlugin\Generator\NumberGenerator;
use Sylius\RefundPlugin\Generator\NumberGeneratorInterface;
use Sylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface;

final class CreditMemoFactorySpec extends ObjectBehavior
{
function let(
FactoryInterface $creditMemoFactory,
CreditMemoIdentifierGeneratorInterface $creditMemoIdentifierGenerator,
NumberGenerator $creditMemoNumberGenerator,
NumberGeneratorInterface $creditMemoNumberGenerator,
CurrentDateTimeImmutableProviderInterface $currentDateTimeImmutableProvider
): void {
$this->beConstructedWith(
Expand Down Expand Up @@ -61,7 +61,7 @@ function it_creates_a_new_credit_memo(
function it_creates_a_new_credit_memo_with_data(
FactoryInterface $creditMemoFactory,
CreditMemoIdentifierGeneratorInterface $creditMemoIdentifierGenerator,
NumberGenerator $creditMemoNumberGenerator,
NumberGeneratorInterface $creditMemoNumberGenerator,
CurrentDateTimeImmutableProviderInterface $currentDateTimeImmutableProvider,
CreditMemoInterface $creditMemo,
OrderInterface $order,
Expand Down
2 changes: 1 addition & 1 deletion spec/Generator/CreditMemoGeneratorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Sylius\RefundPlugin\Factory\CreditMemoFactoryInterface;
use Sylius\RefundPlugin\Generator\CreditMemoGeneratorInterface;
use Sylius\RefundPlugin\Generator\CreditMemoIdentifierGeneratorInterface;
use Sylius\RefundPlugin\Generator\NumberGenerator;
use Sylius\RefundPlugin\Generator\NumberGeneratorInterface;
use Sylius\RefundPlugin\Generator\TaxItemsGeneratorInterface;
use Sylius\RefundPlugin\Model\OrderItemUnitRefund;
use Sylius\RefundPlugin\Model\ShipmentRefund;
Expand Down
4 changes: 2 additions & 2 deletions spec/Generator/SequentialNumberGeneratorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PhpSpec\ObjectBehavior;
use Sylius\RefundPlugin\Entity\CreditMemoSequenceInterface;
use Sylius\RefundPlugin\Factory\CreditMemoSequenceFactoryInterface;
use Sylius\RefundPlugin\Generator\NumberGenerator;
use Sylius\RefundPlugin\Generator\NumberGeneratorInterface;
use Sylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface;

final class SequentialNumberGeneratorSpec extends ObjectBehavior
Expand All @@ -33,7 +33,7 @@ function let(

function it_is_number_generator_interface(): void
{
$this->shouldImplement(NumberGenerator::class);
$this->shouldImplement(NumberGeneratorInterface::class);
}

function it_generates_sequential_number(
Expand Down
6 changes: 3 additions & 3 deletions src/Factory/CreditMemoFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Sylius\RefundPlugin\Entity\CustomerBillingDataInterface;
use Sylius\RefundPlugin\Entity\ShopBillingDataInterface;
use Sylius\RefundPlugin\Generator\CreditMemoIdentifierGeneratorInterface;
use Sylius\RefundPlugin\Generator\NumberGenerator;
use Sylius\RefundPlugin\Generator\NumberGeneratorInterface;
use Sylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface;
use Webmozart\Assert\Assert;

Expand All @@ -33,7 +33,7 @@ final class CreditMemoFactory implements CreditMemoFactoryInterface
/** @var CreditMemoIdentifierGeneratorInterface */
private $creditMemoIdentifierGenerator;

/** @var NumberGenerator */
/** @var NumberGeneratorInterface */
private $creditMemoNumberGenerator;

/** @var CurrentDateTimeImmutableProviderInterface */
Expand All @@ -42,7 +42,7 @@ final class CreditMemoFactory implements CreditMemoFactoryInterface
public function __construct(
FactoryInterface $creditMemoFactory,
CreditMemoIdentifierGeneratorInterface $creditMemoIdentifierGenerator,
NumberGenerator $creditMemoNumberGenerator,
NumberGeneratorInterface $creditMemoNumberGenerator,
CurrentDateTimeImmutableProviderInterface $currentDateTimeImmutableProvider
) {
$this->creditMemoFactory = $creditMemoFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Sylius\RefundPlugin\Generator;

interface NumberGenerator
interface NumberGeneratorInterface
{
public function generate(): string;
}
2 changes: 1 addition & 1 deletion src/Generator/SequentialNumberGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Sylius\RefundPlugin\Factory\CreditMemoSequenceFactoryInterface;
use Sylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface;

final class SequentialNumberGenerator implements NumberGenerator
final class SequentialNumberGenerator implements NumberGeneratorInterface
{
/** @var ObjectRepository */
private $sequenceRepository;
Expand Down

0 comments on commit f0c2ef8

Please sign in to comment.