1 | <?php |
||
17 | class DateTimeField extends TimeZoneAwareField implements ParserInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var string input date/time format string |
||
21 | */ |
||
22 | public $format; |
||
23 | |||
24 | /** |
||
25 | * @var string[] map of HTML attributes to apply |
||
26 | */ |
||
27 | public $attrs; |
||
28 | |||
29 | /** |
||
30 | * @param string $name field name |
||
31 | * @param string $timezone timezone name |
||
32 | * @param string $format date/time format compatible with the date() function |
||
33 | * @param array $attrs map of HTML attribtues to apply |
||
34 | * |
||
35 | * @see date() |
||
36 | */ |
||
37 | 5 | public function __construct($name, $timezone, $format, $attrs = []) |
|
46 | |||
47 | /** |
||
48 | * @param string $input |
||
49 | * |
||
50 | * @return int|null |
||
51 | */ |
||
52 | 2 | public function parseInput($input) |
|
60 | |||
61 | /** |
||
62 | * @param InputModel $model |
||
63 | * |
||
64 | * @return int|null timestamp |
||
65 | * |
||
66 | * @throws UnexpectedValueException if unable to parse the input |
||
67 | */ |
||
68 | 1 | public function getValue(InputModel $model) |
|
84 | |||
85 | /** |
||
86 | * @param InputModel $model |
||
87 | * @param int|null $value timestamp |
||
88 | * |
||
89 | * @return void |
||
90 | * |
||
91 | * @throws InvalidArgumentException if the given value is unacceptable. |
||
92 | */ |
||
93 | 3 | public function setValue(InputModel $model, $value) |
|
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | 2 | public function renderInput(InputRenderer $renderer, InputModel $model, array $attr) |
|
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | 1 | public function createValidators() |
|
127 | } |
||
128 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.