Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions inc/admin/dashboard/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, array<string, mixed>> $configs An array of configurations.
*
* @return array The configurations.
* @return array<string, array<string, mixed>> 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;
}
Comment on lines +1467 to +1470

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests Add a PHPUnit case for the new guard. No test exercises add_black_friday_data(), so a regression of the Undefined array key "default" warning would pass CI. Add tests/test-neve-black-friday-data.php in the style of tests/test-neve-support-hub.php. Call add_black_friday_data() on a Main instance and assert that array() and an array without default come back unchanged with no neve key. These cases fail on the base code because phpunit.xml converts warnings to exceptions. Also assert that a non-empty default still gets a neve entry.


$configs['neve'] = self::get_black_friday_data( $configs['default'] );

return $configs;
Expand Down
12 changes: 0 additions & 12 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading