Skip to content

Commit 9329710

Browse files
committed
Add description to assertions
1 parent 46503bf commit 9329710

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ParsingInput.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ public function consumeString(string $value): void
135135
*/
136136
public function consumeRegex(string $pattern): string
137137
{
138-
assert(str_starts_with($pattern, '/^'));
139-
assert(!preg_match('/\$\/[a-z]+$/i', $pattern));
138+
assert(str_starts_with($pattern, '/^'), "Regular expression must be anchored to beginning of string");
139+
assert(!preg_match('/\$\/[a-z]+$/i', $pattern), "Regular expression must not be anchored to end of string");
140140

141141
if (preg_match($pattern, $this->remaining(), $matches)) {
142142
$this->position += strlen($matches[0]);

0 commit comments

Comments
 (0)