2010-08-20 22:09:55 +01:00
< ? php
2010-10-02 11:42:31 +01:00
/*
2011-01-15 13:29:43 +00:00
* This file is part of the Symfony package .
2010-10-02 11:42:31 +01:00
*
2011-03-06 11:40:06 +00:00
* ( c ) Fabien Potencier < fabien @ symfony . com >
2010-10-02 11:42:31 +01:00
*
2011-01-15 13:29:43 +00:00
* For the full copyright and license information , please view the LICENSE
* file that was distributed with this source code .
2010-10-02 11:42:31 +01:00
*/
2011-01-15 13:29:43 +00:00
namespace Symfony\Component\Validator\Constraints ;
2011-05-19 08:34:54 +01:00
use Symfony\Component\Validator\Constraint ;
2018-03-11 00:00:21 +00:00
use Symfony\Component\Validator\Exception\InvalidArgumentException ;
2011-05-19 08:34:54 +01:00
2011-07-20 09:37:57 +01:00
/**
* @ Annotation
2014-04-23 11:57:22 +01:00
* @ Target ({ " PROPERTY " , " METHOD " , " ANNOTATION " })
2011-07-20 09:37:57 +01:00
*
2013-04-17 17:02:12 +01:00
* @ author Bernhard Schussek < bschussek @ gmail . com >
2018-12-18 10:24:49 +00:00
* @ author Kévin Dunglas < dunglas @ gmail . com >
2011-07-20 09:37:57 +01:00
*/
2011-05-19 08:34:54 +01:00
class NotBlank extends Constraint
2010-08-20 22:09:55 +01:00
{
2014-11-03 10:15:16 +00:00
const IS_BLANK_ERROR = 'c1051bb4-d103-4f74-8988-acbcafc7fdc3' ;
2019-01-16 09:39:14 +00:00
protected static $errorNames = [
2014-11-03 10:15:16 +00:00
self :: IS_BLANK_ERROR => 'IS_BLANK_ERROR' ,
2019-01-16 09:39:14 +00:00
];
2014-11-03 10:15:16 +00:00
2012-04-13 15:47:58 +01:00
public $message = 'This value should not be blank.' ;
2018-12-18 10:24:49 +00:00
public $allowNull = false ;
2018-03-11 00:00:21 +00:00
public $normalizer ;
public function __construct ( $options = null )
{
parent :: __construct ( $options );
if ( null !== $this -> normalizer && ! \is_callable ( $this -> normalizer )) {
throw new InvalidArgumentException ( sprintf ( 'The "normalizer" option must be a valid callable ("%s" given).' , \is_object ( $this -> normalizer ) ? \get_class ( $this -> normalizer ) : \gettype ( $this -> normalizer )));
}
}
2010-08-20 22:09:55 +01:00
}