[Schema] Fix: correct Resource type hints in ListResourcesResult (#191)
* fix: correct Resource type hints in ListResourcesResult * fix: phpstan errors * fix: phpstan errors
This commit is contained in:
parent
69cd04f752
commit
3818173d2f
1 changed files with 6 additions and 6 deletions
|
|
@ -14,20 +14,20 @@ namespace Mcp\Schema\Result;
|
|||
use Mcp\Exception\InvalidArgumentException;
|
||||
use Mcp\Schema\JsonRpc\Response;
|
||||
use Mcp\Schema\JsonRpc\ResultInterface;
|
||||
use Mcp\Schema\Resource;
|
||||
use Mcp\Schema\Resource as ResourceSchema;
|
||||
|
||||
/**
|
||||
* The server's response to a resources/list request from the client.
|
||||
*
|
||||
* @phpstan-import-type ResourceData from Resource
|
||||
* @phpstan-import-type ResourceData from ResourceSchema
|
||||
*
|
||||
* @author Kyrian Obikwelu <koshnawaza@gmail.com>
|
||||
*/
|
||||
class ListResourcesResult implements ResultInterface
|
||||
{
|
||||
/**
|
||||
* @param array<resource> $resources the list of resource definitions
|
||||
* @param string|null $nextCursor An opaque token representing the pagination position after the last returned result.
|
||||
* @param array<ResourceSchema> $resources the list of resource definitions
|
||||
* @param string|null $nextCursor An opaque token representing the pagination position after the last returned result.
|
||||
*
|
||||
* If present, there may be more results available.
|
||||
*/
|
||||
|
|
@ -50,14 +50,14 @@ class ListResourcesResult implements ResultInterface
|
|||
}
|
||||
|
||||
return new self(
|
||||
array_map(fn (array $resource) => Resource::fromArray($resource), $data['resources']),
|
||||
array_map(fn (array $resource) => ResourceSchema::fromArray($resource), $data['resources']),
|
||||
$data['nextCursor'] ?? null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{
|
||||
* resources: array<resource>,
|
||||
* resources: array<ResourceSchema>,
|
||||
* nextCursor?: string,
|
||||
* }
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue