Skip to content

Narrow return type and parameter type for wp_get_[inline_]script_tag #311

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

Merged
merged 1 commit into from
Aug 6, 2025

Conversation

IanDelMar
Copy link
Contributor

Both wp_get_script_tag() and wp_get_inline_script_tag():

  • Always return a <script> tag, even if the input is minimal or empty. Therefore, the return type is narrowed to non-falsy-string.
  • Accept an $attributes array containing HTML attribute name–value pairs. The value true is allowed to represent boolean attributes, so the parameter type is narrowed to array<string, string|true>.

@szepeviktor szepeviktor merged commit 9abea79 into php-stubs:master Aug 6, 2025
6 checks passed
@IanDelMar IanDelMar deleted the wp_get_script_tag branch August 6, 2025 10:51
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