File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,8 @@ public function prepend(Closure|array|null $prepend = null): static
313313
314314 if (is_array ($ this ->prepend ) && isset ($ this ->prepend ['name ' ], $ this ->prepend ['value ' ])) {
315315 $ this ->prepend ['value ' ] = (string ) $ this ->prepend ['value ' ];
316+ } else if (is_null ($ this ->prepend )){
317+ # Avoid throwing an exception in case $prepend is explicitly set to null, or a Closure evaluates to null.
316318 } else {
317319 throw new InvalidArgumentException ('The provided prepend value must be an array with "name" and "value" keys. ' );
318320 }
@@ -326,6 +328,8 @@ public function append(Closure|array|null $append = null): static
326328
327329 if (is_array ($ this ->append ) && isset ($ this ->append ['name ' ], $ this ->append ['value ' ])) {
328330 $ this ->append ['value ' ] = (string ) $ this ->append ['value ' ];
331+ } else if (is_null ($ this ->append )) {
332+ // Avoid throwing an exception in case $append is explicitly set to null, or a Closure evaluates to null.
329333 } else {
330334 throw new \InvalidArgumentException ('The provided append value must be an array with "name" and "value" keys. ' );
331335 }
You can’t perform that action at this time.
0 commit comments