From a03ddb14c6cc04b380362b76e871a1506ff9192f Mon Sep 17 00:00:00 2001 From: neznaika0 Date: Wed, 8 Jan 2025 15:41:20 +0300 Subject: [PATCH] refactor: Fix phpstan isset.offset --- system/Database/BaseBuilder.php | 3 ++- utils/phpstan-baseline/isset.offset.neon | 8 -------- utils/phpstan-baseline/loader.neon | 1 - 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 utils/phpstan-baseline/isset.offset.neon diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index f5f21ed8841e..59cdd0bd0731 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -3182,6 +3182,7 @@ protected function compileWhereHaving(string $qbKey): string ) { continue; } + // $matches = [ // 0 => '(test <= foo)', /* the whole thing */ // 1 => '(', /* optional */ @@ -3191,7 +3192,7 @@ protected function compileWhereHaving(string $qbKey): string // 5 => ')' /* optional */ // ]; - if (isset($matches[4]) && $matches[4] !== '') { + if ($matches[4] !== '') { $protectIdentifiers = false; if (str_contains($matches[4], '.')) { $protectIdentifiers = true; diff --git a/utils/phpstan-baseline/isset.offset.neon b/utils/phpstan-baseline/isset.offset.neon deleted file mode 100644 index 5fa42018f231..000000000000 --- a/utils/phpstan-baseline/isset.offset.neon +++ /dev/null @@ -1,8 +0,0 @@ -# total 1 error - -parameters: - ignoreErrors: - - - message: '#^Offset 4 on array\{string, string, string, string, string, string\} in isset\(\) always exists and is not nullable\.$#' - count: 1 - path: ../../system/Database/BaseBuilder.php diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index feab1b53df83..36f110c2dcd1 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -17,7 +17,6 @@ includes: - expr.resultUnused.neon - function.alreadyNarrowedType.neon - generator.valueType.neon - - isset.offset.neon - isset.property.neon - method.alreadyNarrowedType.neon - method.childParameterType.neon