Skip to content

Commit 86c7dcf

Browse files
committed
Fix psalm
1 parent 96fe621 commit 86c7dcf

File tree

6 files changed

+11
-30
lines changed

6 files changed

+11
-30
lines changed

src/Config/Import/ImportRegistry.php

+4-10
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@
99
use Spiral\Core\Attribute\Singleton;
1010

1111
/**
12-
* @implements RegistryInterface<SourceConfigInterface>
12+
* @template TImport of SourceConfigInterface
13+
* @implements RegistryInterface<TImport>
1314
*/
1415
#[Singleton]
1516
final class ImportRegistry implements RegistryInterface
1617
{
17-
/** @var array<SourceConfigInterface> */
18+
/** @var list<TImport> */
1819
private array $imports = [];
1920

2021
/**
2122
* Register an import in the registry
23+
* @param TImport $import
2224
*/
2325
public function register(SourceConfigInterface $import): self
2426
{
@@ -27,19 +29,11 @@ public function register(SourceConfigInterface $import): self
2729
return $this;
2830
}
2931

30-
/**
31-
* Gets the type of the registry.
32-
*/
3332
public function getType(): string
3433
{
3534
return 'import';
3635
}
3736

38-
/**
39-
* Gets all items in the registry.
40-
*
41-
* @return array<SourceConfigInterface>
42-
*/
4337
public function getItems(): array
4438
{
4539
return $this->imports;

src/Config/Registry/RegistryInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function getType(): string;
1919
/**
2020
* Get all items in the registry
2121
*
22-
* @return array<TItem>
22+
* @return list<TItem>
2323
*/
2424
public function getItems(): array;
2525
}

src/Document/DocumentRegistry.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
use Butschster\ContextGenerator\Config\Registry\RegistryInterface;
88

99
/**
10-
* @implements RegistryInterface<Document>
10+
* @template TDocument of Document
11+
* @implements RegistryInterface<TDocument>
12+
* @implements \ArrayAccess<array-key, TDocument>
1113
*/
1214
final class DocumentRegistry implements RegistryInterface, \ArrayAccess
1315
{
1416
public function __construct(
15-
/** @var array<Document> */
17+
/** @var list<TDocument> */
1618
private array $documents = [],
1719
) {}
1820

@@ -23,6 +25,7 @@ public function getType(): string
2325

2426
/**
2527
* Register a document in the registry
28+
* @param TDocument $document
2629
*/
2730
public function register(Document $document): self
2831
{

src/McpServer/Prompt/PromptRegistry.php

-8
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,11 @@ public function allTemplates(): array
6363
);
6464
}
6565

66-
/**
67-
* Gets the type of the registry.
68-
*/
6966
public function getType(): string
7067
{
7168
return 'prompts';
7269
}
7370

74-
/**
75-
* Gets all items in the registry.
76-
*
77-
* @return array<TPrompt>
78-
*/
7971
public function getItems(): array
8072
{
8173
return \array_values(

src/McpServer/Tool/ToolProviderInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function get(string $id): ToolDefinition;
2323
/**
2424
* Gets all tools.
2525
*
26-
* @return array<string, ToolDefinition>
26+
* @return list<ToolDefinition>
2727
*/
2828
public function all(): array;
2929
}

src/McpServer/Tool/ToolRegistry.php

-8
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,11 @@ public function all(): array
4848
return $this->getItems();
4949
}
5050

51-
/**
52-
* Gets the type of the registry.
53-
*/
5451
public function getType(): string
5552
{
5653
return 'tools';
5754
}
5855

59-
/**
60-
* Gets all items in the registry.
61-
*
62-
* @return array<TTool>
63-
*/
6456
public function getItems(): array
6557
{
6658
return \array_values($this->tools);

0 commit comments

Comments
 (0)