align addLoaders with addRequestHandlers (#183)
This commit is contained in:
parent
32757f6b45
commit
369932378f
2 changed files with 16 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ All notable changes to `mcp/sdk` will be documented in this file.
|
|||
-----
|
||||
|
||||
* Make `Protocol` stateless by decouple if from `TransportInterface`. Removed `Protocol::getTransport()`.
|
||||
* Change signature of `Builder::addLoaders(...$loaders)` to `Builder::addLoaders(iterable $loaders)`.
|
||||
|
||||
0.1.0
|
||||
-----
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue