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