You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Deprecated the `Type::getCollectionKeyType()` and `Type::getCollectionValueType()` methods, use `Type::getCollectionKeyTypes()` and `Type::getCollectionValueTypes()` instead.
Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,12 @@
1
1
CHANGELOG
2
2
=========
3
3
4
+
5.3.0
5
+
-----
6
+
7
+
* Added support for multiple types for collection keys & values
8
+
* Deprecated the `Type::getCollectionKeyType()` and `Type::getCollectionValueType()` methods, use `Type::getCollectionKeyTypes()` and `Type::getCollectionValueTypes()` instead.
$this->expectDeprecation('Since symfony/property-info 5.3: The "Symfony\Component\PropertyInfo\Type::getCollectionKeyType()" method is deprecated, use "getCollectionKeyTypes()" instead.');
31
+
$this->expectDeprecation('Since symfony/property-info 5.3: The "Symfony\Component\PropertyInfo\Type::getCollectionValueType()" method is deprecated, use "getCollectionValueTypes()" instead.');
if (!is_null($collectionArgument) && !is_array($collectionArgument) && !$collectionArgumentinstanceof Type) {
85
+
thrownew \TypeError(sprintf('"%s()": Argument #%d (%s) must be of type "array", "%s" or "null", "%s" given.', __METHOD__, $argumentIndex, $argumentName, Type::class, get_debug_type($collectionArgument)));
86
+
}
87
+
88
+
if (is_array($collectionArgument)) {
89
+
foreach ($collectionArgumentas$type) {
90
+
if (!$typeinstanceof Type) {
91
+
thrownew \TypeError(sprintf('"%s()": Argument #%d (%s) must be an array with items of type "%s", "%s" given.', __METHOD__, $argumentIndex, $argumentName, Type::class, get_debug_type($collectionArgument)));
92
+
}
93
+
}
94
+
return$collectionArgument;
95
+
}
96
+
97
+
return [$collectionArgument];
74
98
}
75
99
76
100
/**
@@ -107,8 +131,27 @@ public function isCollection(): bool
107
131
* Gets collection key type.
108
132
*
109
133
* Only applicable for a collection type.
134
+
*
135
+
* @deprecated since Symfony 5.3, use "getCollectionKeyTypes()" instead
110
136
*/
111
137
publicfunctiongetCollectionKeyType(): ?self
138
+
{
139
+
trigger_deprecation('symfony/property-info', '5.3', 'The "%s()" method is deprecated, use "getCollectionKeyTypes()" instead.', __METHOD__);
140
+
141
+
$type = $this->getCollectionKeyTypes();
142
+
if (is_array($type)) {
143
+
[$type] = $type;
144
+
}
145
+
146
+
return$type;
147
+
}
148
+
149
+
/**
150
+
* Gets collection key types.
151
+
*
152
+
* Only applicable for a collection type.
153
+
*/
154
+
publicfunctiongetCollectionKeyTypes(): ?array
112
155
{
113
156
return$this->collectionKeyType;
114
157
}
@@ -117,8 +160,27 @@ public function getCollectionKeyType(): ?self
117
160
* Gets collection value type.
118
161
*
119
162
* Only applicable for a collection type.
163
+
*
164
+
* @deprecated since Symfony 5.3, use "getCollectionValueTypes()" instead
120
165
*/
121
166
publicfunctiongetCollectionValueType(): ?self
167
+
{
168
+
trigger_deprecation('symfony/property-info', '5.3', 'The "%s()" method is deprecated, use "getCollectionValueTypes()" instead.', __METHOD__);
0 commit comments