| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function withAttribute(string $name, string $value = null): ArbitraryEmpty |
||
| 26 | { |
||
| 27 | if ($value) { |
||
|
|
|||
| 28 | $attribute = new StandardAttribute($name, $value); |
||
| 29 | } else { |
||
| 30 | $attribute = new BooleanAttribute($name); |
||
| 31 | } |
||
| 32 | |||
| 33 | return new ArbitraryEmpty($this->name, $this->attributes->add($attribute)); |
||
| 34 | } |
||
| 35 | } |
||
| 36 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: