Skip to content

Pass the documented values for deprecated arguments - #13872

Closed
westonruter wants to merge 5 commits into
WordPress:trunkfrom
westonruter:fix/deprecated-argument-call-sites
Closed

westonruter wants to merge 5 commits into
WordPress:trunkfrom
westonruter:fix/deprecated-argument-call-sites

Conversation

@westonruter

@westonruter westonruter commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

✅ Committed in r64045 (441b562).


Splits the call-site fixes out of #13530, so that the PHPStan types it adds can land as docblock-only changes.

Four core calls pass a value to a deprecated parameter that doesn't match its documented type. None of these values are used, so none of the fixes change behavior:

  • wp_generate_attachment_metadata() passes '' to wp_upload_bits(), whose $deprecated is documented as "Not used. Set to null." It now passes null.
  • upgrade_340() passes null to add_option(), whose $deprecated is a string defaulting to ''. It now passes ''.
  • wp-admin/update.php passes true to iframe_header(), whose second parameter has been unused since 4.2. The argument is dropped.
  • The PHPUnit install bootstrap passes null to wp_install(), whose $deprecated is a string defaulting to '', which is what wp-admin/install.php passes. It now passes ''.

The first three come from #13530. The fourth was found while reviewing that PR: its @phpstan-param '' $deprecated on wp_install() would flag the bootstrap call.

#13530 also adds a @phpstan-ignore arguments.count to WP_Widget_Factory::register(). That is left out here, since the error only exists once that PR types $widget as class-string<WP_Widget>. On trunk nothing is reported, so the ignore belongs with that change.

Each fix is its own commit.

Trac ticket: https://core.trac.wordpress.org/ticket/65817

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Identifying the call sites while reviewing #13530, making the changes, and drafting the commit messages and this description. Reviewed by me.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

🤖 Generated with Claude Code

westonruter and others added 4 commits September 30, 2026 13:44
The `$deprecated` parameter of `wp_upload_bits()` is documented as "Not used. Set to null." `wp_generate_attachment_metadata()` passed an empty string instead when uploading the cover art embedded in audio and video files. The value is ignored either way, so this changes no behavior; it brings the call in line with the documented type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The `$deprecated` parameter of `add_option()` is documented as a string, defaulting to an empty string. `upgrade_340()` passed null when re-adding the `uninstall_plugins` option without autoloading. `add_option()` only warns when the argument is non-empty, so this changes no behavior; it brings the call in line with the documented type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The second parameter of `iframe_header()` was renamed to `$deprecated` in WordPress 4.2 and has not been used since. The plugin reactivation screen in `wp-admin/update.php` still passed `true` for it. Dropping the argument changes no behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ests

The `$deprecated` parameter of `wp_install()` is documented as a string, defaulting to an empty string, which is also what `wp-admin/install.php` passes. The PHPUnit install bootstrap passed null instead. `wp_install()` only warns when the argument is non-empty, so this changes no behavior; it brings the call in line with the documented type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props westonruter.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@westonruter

Copy link
Copy Markdown
Member Author

🤖 Comment by Claude Opus 5.5

Props gathered for this subset from the full history of functionMap.php in php-stubs/wordpress-stubs, for the four entries whose types expose these call sites:

Map entry History
wp_upload_bits php-stubs/wordpress-stubs#435 and php-stubs/wordpress-stubs#436
add_option php-stubs/wordpress-stubs#436
iframe_header php-stubs/wordpress-stubs#436
wp_install php-stubs/wordpress-stubs#436

All were authored by @IanDelMar (marian1). The goal of php-stubs/wordpress-stubs#436 was to narrow deprecated parameters to their default values "so PHPStan can flag when developers pass non-default arguments", which is exactly what surfaced these four calls. Neither stubs PR carries co-authors or reviews. The other contributors credited on #13530 and #13614 did not author these entries, so they are left to the subsets that carry theirs.

Props for this PR:

westonruter, marian1

cc @IanDelMar

wporg-sync pushed a commit that referenced this pull request Oct 2, 2026
Four core calls passed a value to a deprecated parameter that did not match its documented type. None of these values are used, so there is no change in behavior.

These call sites were surfaced by narrowing the types of deprecated parameters in the PHPStan stubs. Fixing them first allows the corresponding PHPStan types to be added to core as docblock-only changes. The now-obsolete `add_option()` entry is removed from the PHPStan baseline.

Developed in #13872.
Follow-up to r20080, r23766, r31443, r63024.

Props marian1, swissspidy, westonruter.
See #65817.


git-svn-id: https://develop.svn.wordpress.org/trunk@64045 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 2, 2026
Four core calls passed a value to a deprecated parameter that did not match its documented type. None of these values are used, so there is no change in behavior.

These call sites were surfaced by narrowing the types of deprecated parameters in the PHPStan stubs. Fixing them first allows the corresponding PHPStan types to be added to core as docblock-only changes. The now-obsolete `add_option()` entry is removed from the PHPStan baseline.

Developed in WordPress/wordpress-develop#13872.
Follow-up to r20080, r23766, r31443, r63024.

Props marian1, swissspidy, westonruter.
See #65817.

Built from https://develop.svn.wordpress.org/trunk@64045


git-svn-id: http://core.svn.wordpress.org/trunk@63204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@westonruter westonruter closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants