Drop the isManual flag from ElementReference and the discovery-state methods from RegistryInterface. The Registry becomes a flat last-write-wins map; DiscoveryLoader owns its own owned-set bookkeeping so re-running discovery only removes elements it itself contributed. Adds ChainLoader for explicit composition. Manual-over-discovered precedence is preserved via loader ordering, not a flag on the reference.
27 lines
751 B
PHP
27 lines
751 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the official PHP MCP SDK.
|
|
*
|
|
* A collaboration between Symfony and the PHP Foundation.
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Mcp\Tests\Unit\Capability\Registry\Loader\Stub;
|
|
|
|
use Mcp\Capability\Discovery\DiscovererInterface;
|
|
use Mcp\Capability\Discovery\DiscoveryState;
|
|
|
|
final class MutableDiscoverer implements DiscovererInterface
|
|
{
|
|
public function __construct(public DiscoveryState $state)
|
|
{
|
|
}
|
|
|
|
public function discover(string $basePath, array $directories, array $excludeDirs = [], array $namePatterns = self::DEFAULT_NAME_PATERNS): DiscoveryState
|
|
{
|
|
return $this->state;
|
|
}
|
|
}
|