Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function withAttribute(string $name, string $value = null): Parameter |
||
23 | { |
||
24 | if ($value) { |
||
|
|||
25 | $attribute = new StandardAttribute($name, $value); |
||
26 | } else { |
||
27 | $attribute = new BooleanAttribute($name); |
||
28 | } |
||
29 | |||
30 | return new Parameter($this->attributes->add($attribute)); |
||
31 | } |
||
32 | |||
43 |
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: