2323/**
2424 * Lightweight PSR-11 container that supports the Mezzio ConfigProvider format
2525 * (factories, aliases, invokables, delegators) without requiring laminas-servicemanager.
26+ *
27+ * @phpstan-type MezzioDependencyConfig array{
28+ * services?: array<string, mixed>,
29+ * factories?: array<string, (callable(): mixed)|string>,
30+ * aliases?: array<string, string>,
31+ * invokables?: array<int|string, string>,
32+ * delegators?: array<string, array<int|string, (callable(): mixed)|string>>
33+ * }|array<string, string[]>
2634 */
2735final class SimpleContainer implements ContainerInterface
2836{
@@ -35,7 +43,7 @@ final class SimpleContainer implements ContainerInterface
3543 /** @var array<string, string> */
3644 private array $ aliases = [];
3745
38- /** @var array<string, list< callable|string>> */
46+ /** @var array<string, array<int|string, callable|string>> */
3947 private array $ delegators = [];
4048
4149 public function get (string $ id ): mixed
@@ -112,15 +120,16 @@ public function has(string $id): bool
112120 /**
113121 * Process a Mezzio-style dependency configuration array.
114122 *
115- * @param array{
116- * factories?: array<string, callable|string>,
117- * aliases?: array<string, string>,
118- * invokables?: array<int|string, string>,
119- * delegators?: array<string, list<callable|string>>
120- * } $config
123+ * @param MezzioDependencyConfig $config
121124 */
122125 public function configure (array $ config ): void
123126 {
127+ if (isset ($ config ['services ' ]) && is_array ($ config ['services ' ])) {
128+ foreach ($ config ['services ' ] as $ name => $ service ) {
129+ $ this ->setService ($ name , $ service );
130+ }
131+ }
132+
124133 if (isset ($ config ['invokables ' ]) && is_array ($ config ['invokables ' ])) {
125134 foreach ($ config ['invokables ' ] as $ name => $ class ) {
126135 $ this ->setInvokableClass (is_int ($ name ) ? $ class : $ name , $ class );
0 commit comments