align addLoaders with addRequestHandlers (#183)

This commit is contained in:
Antoine Bluchet 2025-12-09 09:47:31 +01:00 • committed by GitHub
commit 369932378f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -434,11 +434,23 @@ final class Builder
}
/**
* @param LoaderInterface[] $loaders
* Register a single custom loader.
*/
public function addLoaders(...$loaders): self
public function addLoader(LoaderInterface $loader): self
{
$this->loaders = [...$this->loaders, ...$loaders];
$this->loaders[] = $loader;
return $this;
}
/**
* @param iterable<LoaderInterface> $loaders
*/
public function addLoaders(iterable $loaders): self
{
foreach ($loaders as $loader) {
$this->loaders = [$loader];
}
return $this;
}