| Conditions | 3 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 45 | public static function load(array $data): self |
||
| 46 | { |
||
| 47 | self::checkNodeData(static::class, $data, ['text']); |
||
| 48 | |||
| 49 | $args = []; |
||
| 50 | if (\array_key_exists('marks', $data)) { |
||
| 51 | foreach ($data['marks'] as $nodeData) { |
||
| 52 | $class = Node::NODE_MAPPING[$nodeData['type']]; |
||
| 53 | $node = $class::load($nodeData); |
||
| 54 | \assert($node instanceof MarkNode); |
||
| 55 | $args[] = $node; |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | return new self($data['text'], ...$args); |
||
| 60 | } |
||
| 72 |
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.