* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Core\ConstraintValidator; use PrestaShop\PrestaShop\Core\ConstraintValidator\Constraints\NotBlankWhenRequired; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\NotBlankValidator; class NotBlankWhenRequiredValidator extends NotBlankValidator { public function validate($value, Constraint $constraint) { if ($constraint instanceof NotBlankWhenRequired && true === $constraint->required) { parent::validate($value, $constraint); } } }