From c5e915b4f5909f63f8a29118d26aa893d80589c3 Mon Sep 17 00:00:00 2001 From: Saskia Teichmann Date: Sun, 1 Nov 2026 11:58:18 +0100 Subject: [PATCH] Narrow return type of wp_get_development_mode wp_get_development_mode() reads WP_DEVELOPMENT_MODE and checks it against a fixed list. Any other value becomes ''. The static cache is set only after this check. There is no filter. The function therefore always returns '', 'all', 'core', 'plugin' or 'theme'. --- functionMap.php | 1 + tests/data/return/wp-get-development-mode.php | 14 ++++++++++++++ wordpress-stubs.php | 1 + 3 files changed, 16 insertions(+) create mode 100644 tests/data/return/wp-get-development-mode.php diff --git a/functionMap.php b/functionMap.php index 6fe36ba..313c360 100644 --- a/functionMap.php +++ b/functionMap.php @@ -253,6 +253,7 @@ 'wp_generate_uuid4' => ['lowercase-string&non-falsy-string', '@phpstan-impure' => ''], 'wp_get_archives' => ['($args is array{echo: false|0, ...} ? string|void : void)'], 'wp_get_comment_status' => ["'approved'|'spam'|'trash'|'unapproved'|false"], + 'wp_get_development_mode' => ["''|'all'|'core'|'plugin'|'theme'"], 'wp_get_elements_class_name' => ['lowercase-string&non-falsy-string'], 'wp_get_http_headers' => [null, 'deprecated' => 'false'], 'wp_get_inline_script_tag' => ['non-falsy-string', 'attributes' => 'array'], diff --git a/tests/data/return/wp-get-development-mode.php b/tests/data/return/wp-get-development-mode.php new file mode 100644 index 0000000..f320b9e --- /dev/null +++ b/tests/data/return/wp-get-development-mode.php @@ -0,0 +1,14 @@ +