From 59fa2a6cf4ec5071a45dbe4047969b77c7dd41d7 Mon Sep 17 00:00:00 2001 From: Colin O'Dell Date: Sun, 8 Sep 2024 08:20:15 -0400 Subject: [PATCH] Help phpstan understand the available matches --- src/Parser/Cursor.php | 1 + src/Util/SpecReader.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Parser/Cursor.php b/src/Parser/Cursor.php index d6d76b3a92..faae75bc1d 100644 --- a/src/Parser/Cursor.php +++ b/src/Parser/Cursor.php @@ -336,6 +336,7 @@ public function advanceToNextNonSpaceOrNewline(): int // [0][0] contains the matched text // [0][1] contains the index of that match + \assert(isset($matches[0])); $increment = $matches[0][1] + \strlen($matches[0][0]); $this->advanceBy($increment); diff --git a/src/Util/SpecReader.php b/src/Util/SpecReader.php index 7523304e8f..faee2042ce 100644 --- a/src/Util/SpecReader.php +++ b/src/Util/SpecReader.php @@ -40,6 +40,7 @@ public static function read(string $data): iterable $exampleNumber = 0; foreach ($matches as $match) { + \assert(isset($match[1], $match[2], $match[3])); if (isset($match[4])) { $currentSection = $match[4]; continue;