diff --git a/src/Sql/Type.php b/src/Sql/Type.php index b998f7a..52af57b 100644 --- a/src/Sql/Type.php +++ b/src/Sql/Type.php @@ -4,6 +4,7 @@ namespace SimPod\ClickHouseClient\Sql; +use function assert; use function preg_match; final readonly class Type @@ -14,7 +15,8 @@ private function __construct(public string $name, public string $params) public static function fromString(string $type): self { - preg_match('~([a-zA-Z\d ]+)(?:\((.+)\))?~', $type, $matches); + $result = preg_match('~([a-zA-Z\d ]+)(?:\((.+)\))?~', $type, $matches); + assert($result === 1); return new self($matches[1], $matches[2] ?? ''); }