Skip to content

Commit bc8654c

Browse files
committed
Let nullable values be null without throwing an exception
1 parent 4428d1f commit bc8654c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/SelectTree.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ 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)){
316317
} else {
317318
throw new InvalidArgumentException('The provided prepend value must be an array with "name" and "value" keys.');
318319
}
@@ -326,6 +327,7 @@ public function append(Closure|array|null $append = null): static
326327

327328
if (is_array($this->append) && isset($this->append['name'], $this->append['value'])) {
328329
$this->append['value'] = (string) $this->append['value'];
330+
} else if (is_null($this->append)) {
329331
} else {
330332
throw new \InvalidArgumentException('The provided append value must be an array with "name" and "value" keys.');
331333
}

0 commit comments

Comments
 (0)