| 1: | <?php |
| 2: | declare(strict_types=1); |
| 3: | |
| 4: | namespace om\ICal\Parser; |
| 5: | |
| 6: | use Stringable; |
| 7: | |
| 8: | /** |
| 9: | * A problem the permissive parser repaired or skipped. |
| 10: | */ |
| 11: | final readonly class ParseWarning implements Stringable { |
| 12: | /** |
| 13: | * @param string $code stable identifier, e.g. "syntax.invalid-line" |
| 14: | */ |
| 15: | public function __construct( |
| 16: | public string $code, |
| 17: | public string $message, |
| 18: | public ?int $line = null, |
| 19: | public ?string $property = null, |
| 20: | ) { |
| 21: | } |
| 22: | |
| 23: | public function __toString(): string { |
| 24: | return ($this->line !== null ? "line $this->line: " : '') . $this->message . " [$this->code]"; |
| 25: | } |
| 26: | } |
| 27: |