54
54
class ContainerBuilder extends Container implements TaggedContainerInterface
55
55
{
56
56
/**
57
- * @var ExtensionInterface[]
57
+ * @var array<string, ExtensionInterface>
58
58
*/
59
59
private array $ extensions = [];
60
60
61
61
/**
62
- * @var ExtensionInterface[]
62
+ * @var array<string, ExtensionInterface>
63
63
*/
64
64
private array $ extensionsByNs = [];
65
65
66
66
/**
67
- * @var Definition[]
67
+ * @var array<string, Definition>
68
68
*/
69
69
private array $ definitions = [];
70
70
71
71
/**
72
- * @var Alias[]
72
+ * @var array<string, Alias>
73
73
*/
74
74
private array $ aliasDefinitions = [];
75
75
76
76
/**
77
- * @var ResourceInterface[]
77
+ * @var array<string, ResourceInterface>
78
78
*/
79
79
private array $ resources = [];
80
80
81
+ /**
82
+ * @var array<string, array<array<string, mixed>>>
83
+ */
81
84
private array $ extensionConfigs = [];
85
+
82
86
private Compiler $ compiler ;
83
87
private bool $ trackResources ;
84
88
private ?InstantiatorInterface $ proxyInstantiator = null ;
@@ -109,15 +113,24 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
109
113
*/
110
114
private array $ vendors ;
111
115
116
+ /**
117
+ * @var array<string, ChildDefinition>
118
+ */
112
119
private array $ autoconfiguredInstanceof = [];
113
120
114
121
/**
115
- * @var callable[]
122
+ * @var array<string, callable>
116
123
*/
117
124
private array $ autoconfiguredAttributes = [];
118
125
126
+ /**
127
+ * @var array<string, bool>
128
+ */
119
129
private array $ removedIds = [];
120
130
131
+ /**
132
+ * @var array<int, bool>
133
+ */
121
134
private array $ removedBindingIds = [];
122
135
123
136
private const INTERNAL_TYPES = [
@@ -143,7 +156,7 @@ public function __construct(ParameterBagInterface $parameterBag = null)
143
156
}
144
157
145
158
/**
146
- * @var \ReflectionClass[] a list of class reflectors
159
+ * @var array<string, \ReflectionClass>
147
160
*/
148
161
private array $ classReflectors ;
149
162
@@ -204,7 +217,7 @@ public function getExtension(string $name): ExtensionInterface
204
217
/**
205
218
* Returns all registered extensions.
206
219
*
207
- * @return ExtensionInterface[]
220
+ * @return array<string, ExtensionInterface>
208
221
*/
209
222
public function getExtensions (): array
210
223
{
@@ -250,7 +263,7 @@ public function addResource(ResourceInterface $resource): static
250
263
/**
251
264
* Sets the resources for this configuration.
252
265
*
253
- * @param ResourceInterface[] $resources An array of resources
266
+ * @param array<string, ResourceInterface> $ resources
254
267
*
255
268
* @return $this
256
269
*/
@@ -395,8 +408,8 @@ public function fileExists(string $path, bool|string $trackContents = true): boo
395
408
/**
396
409
* Loads the configuration for an extension.
397
410
*
398
- * @param string $extension The extension alias or namespace
399
- * @param array $values An array of values that customizes the extension
411
+ * @param string $extension The extension alias or namespace
412
+ * @param array<string, mixed>|null $values An array of values that customizes the extension
400
413
*
401
414
* @return $this
402
415
*
@@ -409,13 +422,9 @@ public function loadFromExtension(string $extension, array $values = null): stat
409
422
throw new BadMethodCallException ('Cannot load from an extension on a compiled container. ' );
410
423
}
411
424
412
- if (\func_num_args () < 2 ) {
413
- $ values = [];
414
- }
415
-
416
425
$ namespace = $ this ->getExtension ($ extension )->getAlias ();
417
426
418
- $ this ->extensionConfigs [$ namespace ][] = $ values ;
427
+ $ this ->extensionConfigs [$ namespace ][] = $ values ?? [] ;
419
428
420
429
return $ this ;
421
430
}
@@ -644,6 +653,8 @@ public function merge(self $container)
644
653
645
654
/**
646
655
* Returns the configuration array for the given extension.
656
+ *
657
+ * @return array<array<string, mixed>>
647
658
*/
648
659
public function getExtensionConfig (string $ name ): array
649
660
{
@@ -656,6 +667,8 @@ public function getExtensionConfig(string $name): array
656
667
657
668
/**
658
669
* Prepends a config array to the configs of the given extension.
670
+ *
671
+ * @param array<string, mixed> $config
659
672
*/
660
673
public function prependExtensionConfig (string $ name , array $ config )
661
674
{
@@ -737,6 +750,8 @@ public function getServiceIds(): array
737
750
738
751
/**
739
752
* Gets removed service or alias ids.
753
+ *
754
+ * @return array<string, bool>
740
755
*/
741
756
public function getRemovedIds (): array
742
757
{
@@ -745,6 +760,8 @@ public function getRemovedIds(): array
745
760
746
761
/**
747
762
* Adds the service aliases.
763
+ *
764
+ * @param array<string, string|Alias> $aliases
748
765
*/
749
766
public function addAliases (array $ aliases )
750
767
{
@@ -755,6 +772,8 @@ public function addAliases(array $aliases)
755
772
756
773
/**
757
774
* Sets the service aliases.
775
+ *
776
+ * @param array<string, string|Alias> $aliases
758
777
*/
759
778
public function setAliases (array $ aliases )
760
779
{
@@ -801,7 +820,7 @@ public function hasAlias(string $id): bool
801
820
}
802
821
803
822
/**
804
- * @return Alias[]
823
+ * @return array<string, Alias>
805
824
*/
806
825
public function getAliases (): array
807
826
{
@@ -845,7 +864,7 @@ public function autowire(string $id, string $class = null): Definition
845
864
/**
846
865
* Adds the service definitions.
847
866
*
848
- * @param Definition[] $definitions An array of service definitions
867
+ * @param array<string, Definition> $ definitions
849
868
*/
850
869
public function addDefinitions (array $ definitions )
851
870
{
@@ -857,7 +876,7 @@ public function addDefinitions(array $definitions)
857
876
/**
858
877
* Sets the service definitions.
859
878
*
860
- * @param Definition[] $definitions An array of service definitions
879
+ * @param array<string, Definition> $ definitions
861
880
*/
862
881
public function setDefinitions (array $ definitions )
863
882
{
@@ -868,7 +887,7 @@ public function setDefinitions(array $definitions)
868
887
/**
869
888
* Gets all service definitions.
870
889
*
871
- * @return Definition[]
890
+ * @return array<string, Definition>
872
891
*/
873
892
public function getDefinitions (): array
874
893
{
@@ -1165,7 +1184,7 @@ private function doResolveServices(mixed $value, array &$inlineServices = [], bo
1165
1184
* }
1166
1185
* }
1167
1186
*
1168
- * @return array An array of tags with the tagged service as key, holding a list of attribute arrays
1187
+ * @return array<string, array> An array of tags with the tagged service as key, holding a list of attribute arrays
1169
1188
*/
1170
1189
public function findTaggedServiceIds (string $ name , bool $ throwOnAbstract = false ): array
1171
1190
{
@@ -1185,6 +1204,8 @@ public function findTaggedServiceIds(string $name, bool $throwOnAbstract = false
1185
1204
1186
1205
/**
1187
1206
* Returns all tags the defined services use.
1207
+ *
1208
+ * @return string[]
1188
1209
*/
1189
1210
public function findTags (): array
1190
1211
{
@@ -1271,15 +1292,15 @@ public function registerAliasForArgument(string $id, string $type, string $name
1271
1292
/**
1272
1293
* Returns an array of ChildDefinition[] keyed by interface.
1273
1294
*
1274
- * @return ChildDefinition[]
1295
+ * @return array<string, ChildDefinition>
1275
1296
*/
1276
1297
public function getAutoconfiguredInstanceof (): array
1277
1298
{
1278
1299
return $ this ->autoconfiguredInstanceof ;
1279
1300
}
1280
1301
1281
1302
/**
1282
- * @return callable[]
1303
+ * @return array<string, callable>
1283
1304
*/
1284
1305
public function getAutoconfiguredAttributes (): array
1285
1306
{
@@ -1419,6 +1440,8 @@ final public static function willBeAvailable(string $package, string $class, arr
1419
1440
/**
1420
1441
* Gets removed binding ids.
1421
1442
*
1443
+ * @return array<int, bool>
1444
+ *
1422
1445
* @internal
1423
1446
*/
1424
1447
public function getRemovedBindingIds (): array
@@ -1442,6 +1465,8 @@ public function removeBindings(string $id)
1442
1465
}
1443
1466
1444
1467
/**
1468
+ * @return string[]
1469
+ *
1445
1470
* @internal
1446
1471
*/
1447
1472
public static function getServiceConditionals (mixed $ value ): array
@@ -1460,6 +1485,8 @@ public static function getServiceConditionals(mixed $value): array
1460
1485
}
1461
1486
1462
1487
/**
1488
+ * @return string[]
1489
+ *
1463
1490
* @internal
1464
1491
*/
1465
1492
public static function getInitializedConditionals (mixed $ value ): array
0 commit comments