df3d543349
* 2.4: made types consistent with those defined in Hack made {@inheritdoc} annotations consistent across the board made {@inheritdoc} annotations consistent across the board fixed types in phpdocs [Debug] Fixed ClassNotFoundFatalErrorHandler on windows. made phpdoc types consistent with those defined in Hack Add support Thai translations [Validator] Add missing czech translations made types consistent with those defined in Hack removed extra/unsupported arguments [HttpKernel] fixed an error message [TwigBundle] removed undefined argument [Translation] Make IcuDatFileLoader/IcuResFileLoader::load invalid resource compatible with HHVM. Conflicts: src/Symfony/Component/Console/Helper/TableHelper.php src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php src/Symfony/Component/Form/FormError.php src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php src/Symfony/Component/Process/ProcessPipes.php src/Symfony/Component/PropertyAccess/PropertyAccessor.php src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php src/Symfony/Component/Translation/Dumper/FileDumper.php src/Symfony/Component/Validator/ConstraintViolation.php src/Symfony/Component/Validator/Constraints/EmailValidator.php src/Symfony/Component/Validator/ExecutionContextInterface.php src/Symfony/Component/Validator/Mapping/BlackholeMetadataFactory.php
39 lines
982 B
PHP
39 lines
982 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Symfony package.
|
|
*
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Symfony\Component\Validator\Constraints;
|
|
|
|
use Symfony\Component\Validator\Constraint;
|
|
use Symfony\Component\Validator\ConstraintValidator;
|
|
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
|
|
|
/**
|
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
|
*
|
|
* @api
|
|
*/
|
|
class BlankValidator extends ConstraintValidator
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function validate($value, Constraint $constraint)
|
|
{
|
|
if (!$constraint instanceof Blank) {
|
|
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Blank');
|
|
}
|
|
|
|
if ('' !== $value && null !== $value) {
|
|
$this->context->addViolation($constraint->message, array('{{ value }}' => $value));
|
|
}
|
|
}
|
|
}
|