comparison vendor/symfony/validator/Constraints/Length.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children 12f9dff5fda9
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
24 { 24 {
25 const TOO_SHORT_ERROR = '9ff3fdc4-b214-49db-8718-39c315e33d45'; 25 const TOO_SHORT_ERROR = '9ff3fdc4-b214-49db-8718-39c315e33d45';
26 const TOO_LONG_ERROR = 'd94b19cc-114f-4f44-9cc4-4138e80a87b9'; 26 const TOO_LONG_ERROR = 'd94b19cc-114f-4f44-9cc4-4138e80a87b9';
27 const INVALID_CHARACTERS_ERROR = '35e6a710-aa2e-4719-b58e-24b35749b767'; 27 const INVALID_CHARACTERS_ERROR = '35e6a710-aa2e-4719-b58e-24b35749b767';
28 28
29 protected static $errorNames = array( 29 protected static $errorNames = [
30 self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', 30 self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR',
31 self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', 31 self::TOO_LONG_ERROR => 'TOO_LONG_ERROR',
32 self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', 32 self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR',
33 ); 33 ];
34 34
35 public $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.'; 35 public $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.';
36 public $minMessage = 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.'; 36 public $minMessage = 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.';
37 public $exactMessage = 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.'; 37 public $exactMessage = 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.';
38 public $charsetMessage = 'This value does not match the expected {{ charset }} charset.'; 38 public $charsetMessage = 'This value does not match the expected {{ charset }} charset.';
40 public $min; 40 public $min;
41 public $charset = 'UTF-8'; 41 public $charset = 'UTF-8';
42 42
43 public function __construct($options = null) 43 public function __construct($options = null)
44 { 44 {
45 if (null !== $options && !is_array($options)) { 45 if (null !== $options && !\is_array($options)) {
46 $options = array( 46 $options = [
47 'min' => $options, 47 'min' => $options,
48 'max' => $options, 48 'max' => $options,
49 ); 49 ];
50 } 50 }
51 51
52 parent::__construct($options); 52 parent::__construct($options);
53 53
54 if (null === $this->min && null === $this->max) { 54 if (null === $this->min && null === $this->max) {
55 throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); 55 throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), ['min', 'max']);
56 } 56 }
57 } 57 }
58 } 58 }