From c375d5f8ed843c84d0523c1623a4e7bbd4dd0c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 6 Oct 2024 12:37:28 +0200 Subject: [PATCH] add early assertion --- src/SqlFormatter.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SqlFormatter.php b/src/SqlFormatter.php index aee3f23..8764efd 100644 --- a/src/SqlFormatter.php +++ b/src/SqlFormatter.php @@ -78,6 +78,7 @@ public function format(string $string, string $indentString = ' '): string }; $decreaseIndentationLevelFx = static function () use (&$return, &$indentTypes, $tab, &$indentLevel): void { array_pop($indentTypes); + assert($indentLevel > 0); $indentLevel--; // Redo the indentation since it may be different now