Skip to content

Fix and improve shortcode_atts extension #265

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 2 commits into from
Nov 16, 2024

Conversation

IanDelMar
Copy link
Contributor

@IanDelMar IanDelMar commented Nov 16, 2024

The current shortcode_atts function extension unconditionally adds string types to all constant $pairs array values. This behaviour is overly broad, as string type values should only be added for keys that are also present in $atts. Additionally, it does not account for cases where $pairs is a general array or $atts is an array shape. Consequently, this results in imprecise and partially inaccurate type inference in such scenarios.

Changes introduced by this PR:

  • Support for non-constant $pairs,
  • Accurate handling of empty $atts, and
  • Improved merging logic.

@szepeviktor
Copy link
Owner

Thank you.

@szepeviktor szepeviktor merged commit 8c7f1b3 into szepeviktor:2.x Nov 16, 2024
1 of 2 checks passed
@IanDelMar IanDelMar deleted the shortcode-atts branch November 16, 2024 12:00
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.

None yet

2 participants