The expression $parsers of type array<integer,RazonYang\...\LocaleParserInterface> is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an
empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using empty(..) or !empty(...) instead.
Loading history...
21
1
throw new InvalidArgumentException('No parser specified.');
22
}
23
24
9
$this->parsers = $parsers;
25
}
26
27
9
public function parse(ServerRequestInterface $request): ?string
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.