File tree 6 files changed +11
-30
lines changed
6 files changed +11
-30
lines changed Original file line number Diff line number Diff line change 9
9
use Spiral \Core \Attribute \Singleton ;
10
10
11
11
/**
12
- * @implements RegistryInterface<SourceConfigInterface>
12
+ * @template TImport of SourceConfigInterface
13
+ * @implements RegistryInterface<TImport>
13
14
*/
14
15
#[Singleton]
15
16
final class ImportRegistry implements RegistryInterface
16
17
{
17
- /** @var array<SourceConfigInterface > */
18
+ /** @var list<TImport > */
18
19
private array $ imports = [];
19
20
20
21
/**
21
22
* Register an import in the registry
23
+ * @param TImport $import
22
24
*/
23
25
public function register (SourceConfigInterface $ import ): self
24
26
{
@@ -27,19 +29,11 @@ public function register(SourceConfigInterface $import): self
27
29
return $ this ;
28
30
}
29
31
30
- /**
31
- * Gets the type of the registry.
32
- */
33
32
public function getType (): string
34
33
{
35
34
return 'import ' ;
36
35
}
37
36
38
- /**
39
- * Gets all items in the registry.
40
- *
41
- * @return array<SourceConfigInterface>
42
- */
43
37
public function getItems (): array
44
38
{
45
39
return $ this ->imports ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public function getType(): string;
19
19
/**
20
20
* Get all items in the registry
21
21
*
22
- * @return array <TItem>
22
+ * @return list <TItem>
23
23
*/
24
24
public function getItems (): array ;
25
25
}
Original file line number Diff line number Diff line change 7
7
use Butschster \ContextGenerator \Config \Registry \RegistryInterface ;
8
8
9
9
/**
10
- * @implements RegistryInterface<Document>
10
+ * @template TDocument of Document
11
+ * @implements RegistryInterface<TDocument>
12
+ * @implements \ArrayAccess<array-key, TDocument>
11
13
*/
12
14
final class DocumentRegistry implements RegistryInterface, \ArrayAccess
13
15
{
14
16
public function __construct (
15
- /** @var array<Document > */
17
+ /** @var list<TDocument > */
16
18
private array $ documents = [],
17
19
) {}
18
20
@@ -23,6 +25,7 @@ public function getType(): string
23
25
24
26
/**
25
27
* Register a document in the registry
28
+ * @param TDocument $document
26
29
*/
27
30
public function register (Document $ document ): self
28
31
{
Original file line number Diff line number Diff line change @@ -63,19 +63,11 @@ public function allTemplates(): array
63
63
);
64
64
}
65
65
66
- /**
67
- * Gets the type of the registry.
68
- */
69
66
public function getType (): string
70
67
{
71
68
return 'prompts ' ;
72
69
}
73
70
74
- /**
75
- * Gets all items in the registry.
76
- *
77
- * @return array<TPrompt>
78
- */
79
71
public function getItems (): array
80
72
{
81
73
return \array_values (
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public function get(string $id): ToolDefinition;
23
23
/**
24
24
* Gets all tools.
25
25
*
26
- * @return array<string, ToolDefinition>
26
+ * @return list< ToolDefinition>
27
27
*/
28
28
public function all (): array ;
29
29
}
Original file line number Diff line number Diff line change @@ -48,19 +48,11 @@ public function all(): array
48
48
return $ this ->getItems ();
49
49
}
50
50
51
- /**
52
- * Gets the type of the registry.
53
- */
54
51
public function getType (): string
55
52
{
56
53
return 'tools ' ;
57
54
}
58
55
59
- /**
60
- * Gets all items in the registry.
61
- *
62
- * @return array<TTool>
63
- */
64
56
public function getItems (): array
65
57
{
66
58
return \array_values ($ this ->tools );
You can’t perform that action at this time.
0 commit comments