Skip to content

Commit

Permalink
refactor #322 Change to a more meaningful message in factory exceptio…
Browse files Browse the repository at this point in the history
…n (GSadee)

This PR was merged into the 1.0-dev branch.

Discussion
----------

According to: #321 (review)

Commits
-------

0045e1c Change to a more meaningful message in factory exception
  • Loading branch information
lchrusciel authored Jun 29, 2021
2 parents 6048825 + 0045e1c commit de9384c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Factory/RefundFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(string $className)

public function createNew(): RefundInterface
{
throw new \InvalidArgumentException('This object is not default constructable.');
throw new \InvalidArgumentException('Default creation method is forbidden for this object. Use `createWithData` instead.');
}

public function createWithData(OrderInterface $order, int $unitId, int $amount, RefundType $type): RefundInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/RefundPaymentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(string $className)

public function createNew(): RefundPaymentInterface
{
throw new \InvalidArgumentException('This object is not default constructable.');
throw new \InvalidArgumentException('Default creation method is forbidden for this object. Use `createWithData` instead.');
}

public function createWithData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(RefundPaymentFactoryInterface $baseRefundPaymentFact

public function createNew(): RefundPaymentInterface
{
throw new \InvalidArgumentException('This object is not default constructable.');
throw new \InvalidArgumentException('Default creation method is forbidden for this object. Use `createWithData` instead.');
}

public function createWithData(
Expand Down

0 comments on commit de9384c

Please sign in to comment.