Skip to content

Commit

Permalink
Merge pull request Sylius#9540 from pamil/1.1-phpstan-fixes
Browse files Browse the repository at this point in the history
PHPStan 0.10 upgrade & road to level 2 checks
  • Loading branch information
pamil authored Jul 3, 2018
2 parents c29b4bf + 0bd57ab commit 1d3748b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Webmozart\Assert\Assert;

class DifferentSourceTargetCurrencyValidator extends ConstraintValidator
{
Expand All @@ -25,6 +26,9 @@ class DifferentSourceTargetCurrencyValidator extends ConstraintValidator
*/
public function validate($value, Constraint $constraint)
{
/** @var DifferentSourceTargetCurrency $constraint */
Assert::isInstanceOf($constraint, DifferentSourceTargetCurrency::class);

if (!$value instanceof ExchangeRateInterface) {
throw new UnexpectedTypeException($value, ExchangeRateInterface::class);
}
Expand Down
4 changes: 4 additions & 0 deletions Validator/Constraints/UniqueCurrencyPairValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Webmozart\Assert\Assert;

class UniqueCurrencyPairValidator extends ConstraintValidator
{
Expand All @@ -40,6 +41,9 @@ public function __construct(ExchangeRateRepositoryInterface $exchangeRateReposit
*/
public function validate($value, Constraint $constraint)
{
/** @var UniqueCurrencyPair $constraint */
Assert::isInstanceOf($constraint, UniqueCurrencyPair::class);

if (!$value instanceof ExchangeRateInterface) {
throw new UnexpectedTypeException($value, ExchangeRateInterface::class);
}
Expand Down

0 comments on commit 1d3748b

Please sign in to comment.