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