Total Complexity | 5 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
14 | final class EdifactParser |
||
15 | { |
||
16 | private SegmentFactoryInterface $segmentFactory; |
||
17 | |||
18 | 4 | public static function create(?SegmentFactoryInterface $segmentFactory = null): self |
|
19 | { |
||
20 | 4 | return new self($segmentFactory ?? new SegmentFactory()); |
|
21 | } |
||
22 | |||
23 | 4 | private function __construct(SegmentFactoryInterface $segmentFactory) |
|
26 | 4 | } |
|
27 | |||
28 | /** @codeCoverageIgnore */ |
||
29 | private function __clone() |
||
30 | { |
||
31 | } |
||
32 | |||
33 | /** @psalm-return list<TransactionMessage> */ |
||
34 | 4 | public function parse(string $fileContent): array |
|
46 | } |
||
47 | } |
||
48 |
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.