| Total Complexity | 6 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 14 | class NonCompliantDecoder extends Decoder |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var string Whether current dictionary needs to be sorted |
||
| 18 | */ |
||
| 19 | protected bool $sortDictionary = false; |
||
| 20 | |||
| 21 | 4 | protected function checkDictionaryCompliance(string $key, string $lastKey): void |
|
| 22 | { |
||
| 23 | 4 | if (!$this->sortDictionary && strcmp($key, $lastKey) < 0) |
|
| 24 | { |
||
| 25 | 2 | $this->sortDictionary = true; |
|
|
|
|||
| 26 | } |
||
| 27 | 4 | } |
|
| 28 | |||
| 29 | 7 | protected function complianceError(string $message, int $offset): void |
|
| 30 | { |
||
| 31 | // Do nothing |
||
| 32 | 7 | } |
|
| 33 | |||
| 34 | 4 | protected function decodeDictionary(): ArrayObject |
|
| 46 | } |
||
| 47 | } |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.