1 | <?php |
||
9 | class DateTimeParser extends AbstractParser |
||
10 | { |
||
11 | /** @var null|string */ |
||
12 | private $format; |
||
13 | public function getFormat() { return $this->format; } |
||
15 | |||
16 | /** @var bool */ |
||
17 | private $ignoreWarnings; |
||
18 | public function getIgnoreWarnings() { return $this->ignoreWarnings; } |
||
20 | |||
21 | /** |
||
22 | * DateTimeParser constructor. |
||
23 | * @param string|null $format |
||
24 | * @param bool $ignoreWarnings |
||
25 | * @param string $errorMessage |
||
26 | */ |
||
27 | public function __construct(string $format = null, bool $ignoreWarnings = false, string $errorMessage = "") |
||
33 | |||
34 | /** |
||
35 | * @param mixed $rawValue |
||
36 | * @return \DateTime |
||
37 | * @throws ParsingException |
||
38 | */ |
||
39 | public function parse($rawValue) |
||
61 | } |
||
62 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: