| Total Complexity | 3 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | abstract class InlineNode extends Node |
||
| 8 | { |
||
| 9 | private array $marks = []; |
||
| 10 | |||
| 11 | public function jsonSerialize(): array |
||
| 12 | { |
||
| 13 | $result = parent::jsonSerialize(); |
||
| 14 | if ($this->marks) { |
||
|
|
|||
| 15 | $result['marks'] = $this->marks; |
||
| 16 | } |
||
| 17 | |||
| 18 | return $result; |
||
| 19 | } |
||
| 20 | |||
| 21 | protected function addMark(MarkNode $mark): void |
||
| 24 | } |
||
| 25 | } |
||
| 26 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.