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 docblock to solve phpstan errors when passing an array to html()->div() #210

Merged
merged 1 commit into from
Jan 5, 2024
Merged

Fix docblock to solve phpstan errors when passing an array to html()->div() #210

merged 1 commit into from
Jan 5, 2024

Conversation

SanderMuller
Copy link
Contributor

Fixes the following phpstan error:

Parameter #1 $contents of method Spatie\Html\Html::div() expects               
         Spatie\Html\HtmlElement|string|null, array<int, Spatie\Html\Elements\Element>  
         given.      

for the given code:

html()->div([
    html()->p('example'),
    html()->p('second child'),
]);

This PR updates the docblock of div (html()->div()) to match the types of BaseElement::children() since it just forwards to that function.

@SanderMuller SanderMuller changed the title Fix div param docblock to solve phpstan errors when passing an array Fix docblock to solve phpstan errors when passing an array to html()->div() Jan 5, 2024
@freekmurze freekmurze merged commit 6093daf into spatie:main Jan 5, 2024
@freekmurze
Copy link
Member

Thanks!

@SanderMuller SanderMuller deleted the patch-1 branch January 5, 2024 16:45
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