Skip to content

Commit 6398476

Browse files
authored
Add comments
requested
1 parent bc8654c commit 6398476

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
@@ -314,6 +314,7 @@ public function prepend(Closure|array|null $prepend = null): static
314314
if (is_array($this->prepend) && isset($this->prepend['name'], $this->prepend['value'])) {
315315
$this->prepend['value'] = (string) $this->prepend['value'];
316316
} 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.
317318
} else {
318319
throw new InvalidArgumentException('The provided prepend value must be an array with "name" and "value" keys.');
319320
}
@@ -328,6 +329,7 @@ public function append(Closure|array|null $append = null): static
328329
if (is_array($this->append) && isset($this->append['name'], $this->append['value'])) {
329330
$this->append['value'] = (string) $this->append['value'];
330331
} 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.
331333
} else {
332334
throw new \InvalidArgumentException('The provided append value must be an array with "name" and "value" keys.');
333335
}

0 commit comments

Comments
 (0)