Skip to content

Add conditional return type and narrow argument type for has_shortcode() #361

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 21, 2025

Conversation

IanDelMar
Copy link
Contributor

  • If either $tag or $content is '' the function has_shortcode() always returns false.
  • If has_shortcode() returns true, $content must be a non-falsy-string (it at least contains [tagName]) and $tag must be a non-empty-string (a valid tag name cannot be empty).

@szepeviktor szepeviktor merged commit 164f6f7 into php-stubs:master Aug 21, 2025
7 checks passed
@IanDelMar IanDelMar deleted the has_shortcode branch August 21, 2025 17:03
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