Skip to content

Commit b09e717

Browse files
committed
tests: suppress errors when string is used as callable
1 parent c83a099 commit b09e717

2 files changed

Lines changed: 4 additions & 102 deletions

File tree

phpstan.neon.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ parameters:
3232
# These are too noisy at the moment:
3333
- '#Variable \$[a-zA-Z0-9_]+ might not be defined\.#'
3434

35+
# Level 2:
36+
# We use callable-strings as callables in WordPress.
37+
- '#Default value of the parameter .* is incompatible with type callable.*#'
38+
3539
# Level 6:
3640

3741
# WPCS syntax for iterable types is not supported:

tests/phpstan/baseline/level-2.php

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -103,24 +103,6 @@
103103
'count' => 1,
104104
'path' => __DIR__ . '/../../../src/wp-admin/includes/ajax-actions.php',
105105
];
106-
$ignoreErrors[] = [
107-
'message' => '#^Default value of the parameter \\#1 \\$admin_header_callback \\(\'\'\\) of method Custom_Background\\:\\:__construct\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
108-
'identifier' => 'parameter.defaultValue',
109-
'count' => 1,
110-
'path' => __DIR__ . '/../../../src/wp-admin/includes/class-custom-background.php',
111-
];
112-
$ignoreErrors[] = [
113-
'message' => '#^Default value of the parameter \\#2 \\$admin_image_div_callback \\(\'\'\\) of method Custom_Background\\:\\:__construct\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
114-
'identifier' => 'parameter.defaultValue',
115-
'count' => 1,
116-
'path' => __DIR__ . '/../../../src/wp-admin/includes/class-custom-background.php',
117-
];
118-
$ignoreErrors[] = [
119-
'message' => '#^Default value of the parameter \\#2 \\$admin_image_div_callback \\(\'\'\\) of method Custom_Image_Header\\:\\:__construct\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
120-
'identifier' => 'parameter.defaultValue',
121-
'count' => 1,
122-
'path' => __DIR__ . '/../../../src/wp-admin/includes/class-custom-image-header.php',
123-
];
124106
$ignoreErrors[] = [
125107
'message' => '#^Call to an undefined method WP_Upgrader\\:\\:get_name_for_update\\(\\)\\.$#',
126108
'identifier' => 'method.notFound',
@@ -607,84 +589,6 @@
607589
'count' => 1,
608590
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
609591
];
610-
$ignoreErrors[] = [
611-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_comments_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
612-
'identifier' => 'parameter.defaultValue',
613-
'count' => 1,
614-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
615-
];
616-
$ignoreErrors[] = [
617-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_dashboard_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
618-
'identifier' => 'parameter.defaultValue',
619-
'count' => 1,
620-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
621-
];
622-
$ignoreErrors[] = [
623-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_links_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
624-
'identifier' => 'parameter.defaultValue',
625-
'count' => 1,
626-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
627-
];
628-
$ignoreErrors[] = [
629-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_management_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
630-
'identifier' => 'parameter.defaultValue',
631-
'count' => 1,
632-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
633-
];
634-
$ignoreErrors[] = [
635-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_media_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
636-
'identifier' => 'parameter.defaultValue',
637-
'count' => 1,
638-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
639-
];
640-
$ignoreErrors[] = [
641-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_menu_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
642-
'identifier' => 'parameter.defaultValue',
643-
'count' => 1,
644-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
645-
];
646-
$ignoreErrors[] = [
647-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_options_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
648-
'identifier' => 'parameter.defaultValue',
649-
'count' => 1,
650-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
651-
];
652-
$ignoreErrors[] = [
653-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_pages_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
654-
'identifier' => 'parameter.defaultValue',
655-
'count' => 1,
656-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
657-
];
658-
$ignoreErrors[] = [
659-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_plugins_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
660-
'identifier' => 'parameter.defaultValue',
661-
'count' => 1,
662-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
663-
];
664-
$ignoreErrors[] = [
665-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_posts_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
666-
'identifier' => 'parameter.defaultValue',
667-
'count' => 1,
668-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
669-
];
670-
$ignoreErrors[] = [
671-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_theme_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
672-
'identifier' => 'parameter.defaultValue',
673-
'count' => 1,
674-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
675-
];
676-
$ignoreErrors[] = [
677-
'message' => '#^Default value of the parameter \\#5 \\$callback \\(\'\'\\) of function add_users_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
678-
'identifier' => 'parameter.defaultValue',
679-
'count' => 1,
680-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
681-
];
682-
$ignoreErrors[] = [
683-
'message' => '#^Default value of the parameter \\#6 \\$callback \\(\'\'\\) of function add_submenu_page\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
684-
'identifier' => 'parameter.defaultValue',
685-
'count' => 1,
686-
'path' => __DIR__ . '/../../../src/wp-admin/includes/plugin.php',
687-
];
688592
$ignoreErrors[] = [
689593
'message' => '#^Access to private property WP_Block_Type\\:\\:\\$uses_context\\.$#',
690594
'identifier' => 'property.private',
@@ -1213,12 +1117,6 @@
12131117
'count' => 1,
12141118
'path' => __DIR__ . '/../../../src/wp-includes/ms-functions.php',
12151119
];
1216-
$ignoreErrors[] = [
1217-
'message' => '#^Default value of the parameter \\#3 \\$deprecated \\(\'\'\\) of function unregister_setting\\(\\) is incompatible with type callable\\(\\)\\: mixed\\.$#',
1218-
'identifier' => 'parameter.defaultValue',
1219-
'count' => 1,
1220-
'path' => __DIR__ . '/../../../src/wp-includes/option.php',
1221-
];
12221120
$ignoreErrors[] = [
12231121
'message' => '#^Cannot access property \\$ID on array\\|object\\.$#',
12241122
'identifier' => 'property.nonObject',

0 commit comments

Comments
 (0)