The expression $params of type array 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...
36
foreach ($params as $param_name => $param_value) {
37
$this->addParam($param_name, $param_value);
38
}
39
}
40
}
41
42
/**
43
* @param string $param_name
44
* @param AbstractObject $param_value
45
*
46
* @return UpDownRequest
47
*/
48
public function addParam(string $param_name, $param_value): UpDownRequest
49
{
50
51
$this->params[$param_name] = $param_value;
52
53
return $this;
54
}
55
56
/**
57
* @return string
58
*/
59
public function getQuery(): string
60
{
61
62
$params = [];
63
64
foreach ($this->params as $param_name => $param_value) {
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.