You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docs: Add never return types to functions that always terminate.
Documents `@return never` on 30 functions and methods whose every control-flow path ends in `exit`, `die()`, `wp_die()`, or `wp_send_json_*()`, so static analysis knows the code following a call to them is unreachable. Native `never` requires PHP 8.1, so these are PHPDoc-only.
Where terminating depends on a parameter, a conditional `@phpstan-return` describes each case rather than over-widening to the union of both. The seven `wp_die()` handlers gain the same conditional `wp_die()` itself already carries. `trackback_response()` and `wp_protect_special_option()` never return for the parameter values that die, while `redirect_canonical()`, `check_admin_referer()`, `check_ajax_referer()`, and `get_cli_args()` narrow their return types accordingly.
The bottom type `never` was also incorrectly declared in the return type union for `get_cli_args()`, so it was removed.
Developed as subset of WordPress#12488.
Follow-up to r62703, r62178, r62177.
Props westonruter, mukesh27.
See #64896, #64898.
git-svn-id: https://develop.svn.wordpress.org/trunk@62704 602fd350-edb4-49c9-b593-d223f7449a82
0 commit comments