The expression $this->format of type null|string is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.
In PHP, under loose comparison (like ==, or !=, or switch 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:
''==false// true''==null// true'ab'==false// false'ab'==null// false// It is often better to use strict comparison''===false// false''===null// false
The expression \DateTime::createFromFor...is->format, $rawValue); of type DateTime|false adds false to the return on line 59 which is incompatible with the return type documented by MetaHydrator\Parser\DateTimeParser::parse of type DateTime|null. It seems like you forgot to handle an error condition.
Loading history...
47
} else {
48
$date = new \DateTime($rawValue);
49
}
50
51
$errors = \DateTime::getLastErrors();
52
if ($errors['error_count'] > 0) {
53
$this->throw();
54
}
55
if (!$this->ignoreWarnings && $errors['warning_count'] > 0) {
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: