55
55
class ContainerBuilder extends Container implements TaggedContainerInterface
56
56
{
57
57
/**
58
- * @var ExtensionInterface[]
58
+ * @var array<string, ExtensionInterface>
59
59
*/
60
60
private $ extensions = [];
61
61
62
62
/**
63
- * @var ExtensionInterface[]
63
+ * @var array<string, ExtensionInterface>
64
64
*/
65
65
private $ extensionsByNs = [];
66
66
67
67
/**
68
- * @var Definition[]
68
+ * @var array<string, Definition>
69
69
*/
70
70
private $ definitions = [];
71
71
72
72
/**
73
- * @var Alias[]
73
+ * @var array<string, Alias>
74
74
*/
75
75
private $ aliasDefinitions = [];
76
76
77
77
/**
78
- * @var ResourceInterface[]
78
+ * @var array<string, ResourceInterface>
79
79
*/
80
80
private $ resources = [];
81
81
82
+ /**
83
+ * @var array<string, array<array<string, mixed>>>
84
+ */
82
85
private $ extensionConfigs = [];
83
86
84
87
/**
85
88
* @var Compiler
86
89
*/
87
90
private $ compiler ;
88
91
92
+ /**
93
+ * @var bool
94
+ */
89
95
private $ trackResources ;
90
96
91
97
/**
@@ -123,15 +129,24 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
123
129
*/
124
130
private $ vendors ;
125
131
132
+ /**
133
+ * @var array<string, ChildDefinition>
134
+ */
126
135
private $ autoconfiguredInstanceof = [];
127
136
128
137
/**
129
- * @var callable[]
138
+ * @var array<string, callable>
130
139
*/
131
140
private $ autoconfiguredAttributes = [];
132
141
142
+ /**
143
+ * @var array<string, bool>
144
+ */
133
145
private $ removedIds = [];
134
146
147
+ /**
148
+ * @var array<int, bool>
149
+ */
135
150
private $ removedBindingIds = [];
136
151
137
152
private const INTERNAL_TYPES = [
@@ -159,7 +174,7 @@ public function __construct(ParameterBagInterface $parameterBag = null)
159
174
}
160
175
161
176
/**
162
- * @var \ReflectionClass[] a list of class reflectors
177
+ * @var array<string, \ReflectionClass>
163
178
*/
164
179
private $ classReflectors ;
165
180
@@ -224,7 +239,7 @@ public function getExtension(string $name)
224
239
/**
225
240
* Returns all registered extensions.
226
241
*
227
- * @return ExtensionInterface[]
242
+ * @return array<string, ExtensionInterface>
228
243
*/
229
244
public function getExtensions ()
230
245
{
@@ -272,7 +287,7 @@ public function addResource(ResourceInterface $resource)
272
287
/**
273
288
* Sets the resources for this configuration.
274
289
*
275
- * @param ResourceInterface[] $resources An array of resources
290
+ * @param array<string, ResourceInterface> $ resources
276
291
*
277
292
* @return $this
278
293
*/
@@ -417,8 +432,8 @@ public function fileExists(string $path, $trackContents = true): bool
417
432
/**
418
433
* Loads the configuration for an extension.
419
434
*
420
- * @param string $extension The extension alias or namespace
421
- * @param array $values An array of values that customizes the extension
435
+ * @param string $extension The extension alias or namespace
436
+ * @param array<string, mixed>|null $values An array of values that customizes the extension
422
437
*
423
438
* @return $this
424
439
*
@@ -431,13 +446,9 @@ public function loadFromExtension(string $extension, array $values = null)
431
446
throw new BadMethodCallException ('Cannot load from an extension on a compiled container. ' );
432
447
}
433
448
434
- if (\func_num_args () < 2 ) {
435
- $ values = [];
436
- }
437
-
438
449
$ namespace = $ this ->getExtension ($ extension )->getAlias ();
439
450
440
- $ this ->extensionConfigs [$ namespace ][] = $ values ;
451
+ $ this ->extensionConfigs [$ namespace ][] = $ values ?? [] ;
441
452
442
453
return $ this ;
443
454
}
@@ -684,7 +695,7 @@ public function merge(self $container)
684
695
/**
685
696
* Returns the configuration array for the given extension.
686
697
*
687
- * @return array
698
+ * @return array<array<string, mixed>>
688
699
*/
689
700
public function getExtensionConfig (string $ name )
690
701
{
@@ -697,6 +708,8 @@ public function getExtensionConfig(string $name)
697
708
698
709
/**
699
710
* Prepends a config array to the configs of the given extension.
711
+ *
712
+ * @param array<string, mixed> $config
700
713
*/
701
714
public function prependExtensionConfig (string $ name , array $ config )
702
715
{
@@ -779,7 +792,7 @@ public function getServiceIds()
779
792
/**
780
793
* Gets removed service or alias ids.
781
794
*
782
- * @return array
795
+ * @return array<string, bool>
783
796
*/
784
797
public function getRemovedIds ()
785
798
{
@@ -788,6 +801,8 @@ public function getRemovedIds()
788
801
789
802
/**
790
803
* Adds the service aliases.
804
+ *
805
+ * @param array<string, string|Alias> $aliases
791
806
*/
792
807
public function addAliases (array $ aliases )
793
808
{
@@ -798,6 +813,8 @@ public function addAliases(array $aliases)
798
813
799
814
/**
800
815
* Sets the service aliases.
816
+ *
817
+ * @param array<string, string|Alias> $aliases
801
818
*/
802
819
public function setAliases (array $ aliases )
803
820
{
@@ -854,7 +871,7 @@ public function hasAlias(string $id)
854
871
}
855
872
856
873
/**
857
- * @return Alias[]
874
+ * @return array<string, Alias>
858
875
*/
859
876
public function getAliases ()
860
877
{
@@ -904,7 +921,7 @@ public function autowire(string $id, string $class = null)
904
921
/**
905
922
* Adds the service definitions.
906
923
*
907
- * @param Definition[] $definitions An array of service definitions
924
+ * @param array<string, Definition> $ definitions
908
925
*/
909
926
public function addDefinitions (array $ definitions )
910
927
{
@@ -916,7 +933,7 @@ public function addDefinitions(array $definitions)
916
933
/**
917
934
* Sets the service definitions.
918
935
*
919
- * @param Definition[] $definitions An array of service definitions
936
+ * @param array<string, Definition> $ definitions
920
937
*/
921
938
public function setDefinitions (array $ definitions )
922
939
{
@@ -927,7 +944,7 @@ public function setDefinitions(array $definitions)
927
944
/**
928
945
* Gets all service definitions.
929
946
*
930
- * @return Definition[]
947
+ * @return array<string, Definition>
931
948
*/
932
949
public function getDefinitions ()
933
950
{
@@ -1142,7 +1159,7 @@ private function createService(Definition $definition, array &$inlineServices, b
1142
1159
/**
1143
1160
* Replaces service references by the real service instance and evaluates expressions.
1144
1161
*
1145
- * @param mixed $value A value
1162
+ * @param mixed $value
1146
1163
*
1147
1164
* @return mixed The same value with all service references replaced by
1148
1165
* the real service instances and all expressions evaluated
@@ -1236,7 +1253,7 @@ private function doResolveServices($value, array &$inlineServices = [], bool $is
1236
1253
* }
1237
1254
* }
1238
1255
*
1239
- * @return array An array of tags with the tagged service as key, holding a list of attribute arrays
1256
+ * @return array<string, array> An array of tags with the tagged service as key, holding a list of attribute arrays
1240
1257
*/
1241
1258
public function findTaggedServiceIds (string $ name , bool $ throwOnAbstract = false )
1242
1259
{
@@ -1257,7 +1274,7 @@ public function findTaggedServiceIds(string $name, bool $throwOnAbstract = false
1257
1274
/**
1258
1275
* Returns all tags the defined services use.
1259
1276
*
1260
- * @return array
1277
+ * @return string[]
1261
1278
*/
1262
1279
public function findTags ()
1263
1280
{
@@ -1346,15 +1363,15 @@ public function registerAliasForArgument(string $id, string $type, string $name
1346
1363
/**
1347
1364
* Returns an array of ChildDefinition[] keyed by interface.
1348
1365
*
1349
- * @return ChildDefinition[]
1366
+ * @return array<string, ChildDefinition>
1350
1367
*/
1351
1368
public function getAutoconfiguredInstanceof ()
1352
1369
{
1353
1370
return $ this ->autoconfiguredInstanceof ;
1354
1371
}
1355
1372
1356
1373
/**
1357
- * @return callable[]
1374
+ * @return array<string, callable>
1358
1375
*/
1359
1376
public function getAutoconfiguredAttributes (): array
1360
1377
{
@@ -1495,6 +1512,8 @@ final public static function willBeAvailable(string $package, string $class, arr
1495
1512
/**
1496
1513
* Gets removed binding ids.
1497
1514
*
1515
+ * @return array<int, bool>
1516
+ *
1498
1517
* @internal
1499
1518
*/
1500
1519
public function getRemovedBindingIds (): array
@@ -1522,6 +1541,8 @@ public function removeBindings(string $id)
1522
1541
*
1523
1542
* @param mixed $value An array of conditionals to return
1524
1543
*
1544
+ * @return string[]
1545
+ *
1525
1546
* @internal
1526
1547
*/
1527
1548
public static function getServiceConditionals ($ value ): array
@@ -1544,6 +1565,8 @@ public static function getServiceConditionals($value): array
1544
1565
*
1545
1566
* @param mixed $value An array of conditionals to return
1546
1567
*
1568
+ * @return string[]
1569
+ *
1547
1570
* @internal
1548
1571
*/
1549
1572
public static function getInitializedConditionals ($ value ): array
0 commit comments