Modern DOM library written in PHP for HTML documents
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
559 B

<?php
declare(strict_types=1);
namespace dW\HTML5;
trait ParseErrorEmitter {
/** @var ParseError $errorHandler */
private $errorHandler;
private function error(int $code, ...$arg): bool {
$data = ($this instanceof Data) ? $this : ($this->data ?? null);
assert($data instanceof Data);
assert($this->errorHandler instanceof ParseError);
list($line, $column) = $data->whereIs(ParseError::REPORT_OFFSETS[$code] ?? 0);
return $this->errorHandler->emit($data->filePath, $line, $column, $code, ...$arg);
}
}