The expression $max of type integer|null is loosely compared to true; this is ambiguous if the integer can be 0. 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 integer values, zero is a special case, in particular the following
results might be unexpected:
0==false// true0==null// true123==false// false123==null// false// It is often better to use strict comparison0===false// false0===null// false
Loading history...
25
throw new \InvalidArgumentException('Min must be less than max.');
26
}
27
28
$this->factory = $factory;
29
$this->min = $min;
30
$this->max = $max ?? $min;
31
}
32
33
/**
34
* @param array|callable $attributes
35
*
36
* @return Proxy[]|object[]
37
*/
38
public function create($attributes = []): array
39
{
40
return \array_map(
41
static function(Factory $factory) use ($attributes) {
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: