Validator/Constraints/AddressValidator.php
public function validate($address, Constraint $constraint)
    {
        if (!$address instanceof AddressInterface) {
            throw new UnexpectedTypeException($address, '\Ekyna\Bundle\CoreBundle\Model\AddressInterface');
        }
        if (!$constraint instanceof Address) {
            throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\Address');
        }

        /**
         * @var AddressInterface $address
         * @var Address $constraint
         */
        if (array_key_exists($address->getCountry(), $this->zipRegex)) {
            if (!preg_match("~^" . $this->zipRegex[$address->getCountry()] . "$~i", $address->getPostalCode())) {
                $this->context->addViolationAt('postalCode', $constraint->invalidPostalCode);
            }
        }
    }
public function validate($address, Constraint $constraint)
    {
        if (!$address instanceof AddressInterface) {
            throw new UnexpectedTypeException($address, '\Ekyna\Bundle\CoreBundle\Model\AddressInterface');
        }
        if (!$constraint instanceof Address) {
            throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\Address');
        }

        /**
         * @var AddressInterface $address
         * @var Address $constraint
         */
        if (array_key_exists($address->getCountry(), $this->zipRegex)) {
            if (!preg_match("~^" . $this->zipRegex[$address->getCountry()] . "$~i", $address->getPostalCode())) {
                $this->context->addViolationAt('postalCode', $constraint->invalidPostalCode);
            }
        }
    }
{@inheritdoc}