Skip to content

Commit cdba36f

Browse files
authored
fix: assert type string is matched (#264)
1 parent 1858ed8 commit cdba36f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Sql/Type.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace SimPod\ClickHouseClient\Sql;
66

7+
use function assert;
78
use function preg_match;
89

910
final readonly class Type
@@ -14,7 +15,8 @@ private function __construct(public string $name, public string $params)
1415

1516
public static function fromString(string $type): self
1617
{
17-
preg_match('~([a-zA-Z\d ]+)(?:\((.+)\))?~', $type, $matches);
18+
$result = preg_match('~([a-zA-Z\d ]+)(?:\((.+)\))?~', $type, $matches);
19+
assert($result === 1);
1820

1921
return new self($matches[1], $matches[2] ?? '');
2022
}

0 commit comments

Comments
 (0)