Repository navigation
wp-build: Pass false instead of empty string as src in wp_register_script - #86106
Merged
westonruter merged 4 commits intoNov 3, 2026
Merged
westonruter merged 4 commits into
westonruter merged 4 commits into
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the |
Member
|
Looks good. |
…ix/phpstan-wp-build-register-script-src
Register the `wp-core-data` alias in the collaboration settings test with `false` as the source, matching the `non-empty-string|false` type that `wp_register_script()` documents and the template fix in this branch. Co-Authored-By: Claude Opus 5.5 (medium effort) <noreply@anthropic.com> Claude-Code-Session-Id: 4cabd15-c517-4b36-900a-33071f846550
westonruter
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
See #86088
Passes
falseinstead of an empty string''as the$srcparameter ofwp_register_script()in the page registration templates, and removes the resolved entries from the PHPStan baseline.Why?
wp_register_script()expects$srcto bestring|false. When registering an alias/prerequisite script handle that has no physical source file and only exists to load dependencies or host inline scripts, WordPress Core conventions specify passingfalseas the source.Passing an empty string
''is flagged by PHPStan asargument.type(Parameter #2 $src of function wp_register_script expects non-empty-string|false, '' given). Together, these changes resolve 2 of the errors initially baselined in #66693.How?
packages/wp-build/templates/page.php.templateandpackages/wp-build/templates/page-wp-admin.php.template, changed the$srcargument inwp_register_script( ..., '', ... )tofalse.argument.typeentries fromtools/phpstan/baseline.neon.Testing Instructions
composer phpstanand confirm it passes with no unmatched ignored errors.composer phpstan:baselinesand confirmtools/phpstan/baseline.neonhas no further changes.npm run buildto verify page templates compile without errors.Testing Instructions for Keyboard
Not applicable. There are no UI changes.
Screenshots or screencast
Not applicable.
Use of AI Tools
I used Claude Code to identify the affected occurrences and draft the change. I reviewed the diff and take responsibility for it.