Skip to content

Commit

Permalink
Add description to assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
gapple committed Feb 3, 2025
1 parent 46503bf commit 9329710
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ParsingInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public function consumeString(string $value): void
*/
public function consumeRegex(string $pattern): string
{
assert(str_starts_with($pattern, '/^'));
assert(!preg_match('/\$\/[a-z]+$/i', $pattern));
assert(str_starts_with($pattern, '/^'), "Regular expression must be anchored to beginning of string");
assert(!preg_match('/\$\/[a-z]+$/i', $pattern), "Regular expression must not be anchored to end of string");

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

0 comments on commit 9329710

Please sign in to comment.