| Total Complexity | 2 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | final class SyntaxException extends Exception implements JsonParserException |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * The error position. |
||
| 15 | * |
||
| 16 | * @var int|null |
||
| 17 | */ |
||
| 18 | public ?int $position = null; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Instantiate the class |
||
| 22 | * |
||
| 23 | * @param string $value |
||
| 24 | */ |
||
| 25 | 11 | public function __construct(public readonly string $value) |
|
| 26 | { |
||
| 27 | 11 | parent::__construct("Syntax error: unexpected '$value'"); |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Set the error position |
||
| 32 | * |
||
| 33 | * @param int $position |
||
| 34 | * @return self |
||
| 35 | */ |
||
| 36 | 11 | public function setPosition(int $position): self |
|
| 42 | } |
||
| 43 | } |
||
| 44 |