1 | <?php |
||
17 | class TextField extends Field |
||
18 | { |
||
19 | /** |
||
20 | * @var int|null |
||
21 | */ |
||
22 | public $min_length; |
||
23 | |||
24 | /** |
||
25 | * @var int|null |
||
26 | */ |
||
27 | public $max_length; |
||
28 | |||
29 | /** |
||
30 | * @var string|null |
||
31 | */ |
||
32 | protected $pattern; |
||
33 | |||
34 | /** |
||
35 | * @var string|null |
||
36 | */ |
||
37 | protected $pattern_error; |
||
38 | |||
39 | /** |
||
40 | * @param string $pattern regular expression pattern (optional; no delimiters, modifiers or anchors) |
||
41 | * @param string $error error message to apply on pattern mismatch |
||
42 | */ |
||
43 | 5 | public function setPattern($pattern, $error) |
|
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | 6 | public function renderInput(InputRenderer $renderer, InputModel $model, array $attr) |
|
67 | |||
68 | /** |
||
69 | * @inheritdoc |
||
70 | */ |
||
71 | 8 | public function createValidators() |
|
91 | } |
||
92 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: