Skip to content
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

Fix type mismatch for condition in am_enqueue_script #71

Open
jessicamgoddard opened this issue Mar 4, 2025 · 0 comments
Open

Fix type mismatch for condition in am_enqueue_script #71

jessicamgoddard opened this issue Mar 4, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@jessicamgoddard
Copy link

Description of the bug

PHPStan error when passing condition as an array in $handle for am_enqueue_script.

Steps To Reproduce

Using am_enqueue_script, pass $handle as an array containing condition which is also an array.

https://github.com/newscorp-ghfb/ncu-gtf/blob/eb5b7ffa4d8b37431194f4d84c3f39fde2768d2b/themes/gtf/inc/assets/class-nypost-assets.php#L157-L171

Additional Information

The condition parameter accepts either an array or a string, as correctly indicated in the type hint and PHPDoc. However, in the @phpstan-param for $handle, condition it is set to string. We need to update the @phpstan-param to support array<string>|string.

@jessicamgoddard jessicamgoddard added the bug Something isn't working label Mar 4, 2025
@jessicamgoddard jessicamgoddard changed the title Fix type mismatch in $condition parameter for am_enqueue_script Fix type mismatch for condition in am_enqueue_script Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant