From 60608bc78235e9e00170ad1a3fc83a601e0ad660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytis=20Bulkevi=C4=8Dius?= Date: Tue, 24 Nov 2026 10:16:32 +0200 Subject: [PATCH] fix: guard the Black Friday callback against a missing default config An earlier filter on themeisle_sdk_blackfriday_data can drop the 'default' entry, or empty the list to opt out of the sale. Reading $configs['default'] then emitted an "Undefined array key \"default\"" warning. Return $configs early when it is absent, matching the otter-blocks fix. Also type the callback's array param and return, and drop the now-redundant PHPStan baseline entries. --- inc/admin/dashboard/main.php | 9 +++++++-- phpstan-baseline.neon | 12 ------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/inc/admin/dashboard/main.php b/inc/admin/dashboard/main.php index 6419a44887..b89a48f959 100755 --- a/inc/admin/dashboard/main.php +++ b/inc/admin/dashboard/main.php @@ -1459,11 +1459,16 @@ public static function get_black_friday_data( $default = array() ) { /** * Add the Black Friday data. * - * @param array $configs An array of configurations. + * @param array> $configs An array of configurations. * - * @return array The configurations. + * @return array> The configurations. */ public function add_black_friday_data( $configs ) { + // An earlier filter may drop the default entry, or empty the list to opt out of the sale. + if ( empty( $configs['default'] ) ) { + return $configs; + } + $configs['neve'] = self::get_black_friday_data( $configs['default'] ); return $configs; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 415a437f5d..57d40bd135 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1464,18 +1464,6 @@ parameters: count: 1 path: inc/admin/dashboard/changelog_handler.php - - - message: '#^Method Neve\\Admin\\Dashboard\\Main\:\:add_black_friday_data\(\) has parameter \$configs with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: inc/admin/dashboard/main.php - - - - message: '#^Method Neve\\Admin\\Dashboard\\Main\:\:add_black_friday_data\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: inc/admin/dashboard/main.php - - message: '#^Method Neve\\Admin\\Dashboard\\Main\:\:enqueue\(\) has no return type specified\.$#' identifier: missingType.return