-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Build/Test Tools: Statically verify that hook documentation and arguments stay in sync #12022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
a7ec9c9
260254d
bd260a0
8bc73ae
a0ec688
b77d903
dcfd548
72e9acf
b23f1d2
753e502
d359a7f
ea34b55
413ba4c
c75eff1
92a2767
daaf47d
8765464
faa7cf0
286ebd5
7799649
b0f6210
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,7 +157,7 @@ | |
| $user_ids = (array) $_POST['allusers']; | ||
|
|
||
| /** This action is documented in wp-admin/network/site-themes.php */ | ||
| $sendback = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $user_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores | ||
| $sendback = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $user_ids, 0 ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reasoning as the Network Themes screen above: this is the same single dynamic hook ( (Reply from Claude, acting on behalf of @westonruter.) |
||
|
|
||
| wp_safe_redirect( $sendback ); | ||
| exit; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, but I don't think a separate three-argument variant is feasible here.
handle_network_bulk_actions-{$screen}is a single dynamic hook with one canonical docblock (inwp-admin/network/site-themes.php), and a callback registered withaccepted_args = 4runs on every screen that fires it. If this screen fired only three arguments, such a callback would receivenull/error for the fourth — exactly theArgumentCountError/TypeErrorrisk this rule is meant to catch. So all call sites need to pass the documented four arguments.Since a network-wide screen has no single-site context,
0is the appropriate value: it's the same "no specific site" sentinel thatsite-themes.phpitself falls back to ($id = isset( $_REQUEST['id'] ) ? (int) $_REQUEST['id'] : 0), so four-argument callbacks already see0there in the no-site case. Keeping0.(Reply from Claude, acting on behalf of @westonruter.)