@@ -99,8 +99,13 @@ public static function parseDictionary(string $httpValue): array
99
99
* Returns a InnerList value object from an HTTP textual representation.
100
100
*
101
101
* @see https://www.rfc-editor.org/rfc/rfc8941.html#section-4.2.1.2
102
+ *
103
+ * @return array{
104
+ * 0:array<Item|ByteSequence|Token|bool|int|float|string>,
105
+ * 1:array<string,Item|ByteSequence|Token|bool|int|float|string>
106
+ * }
102
107
*/
103
- public static function parseInnerList (string $ httpValue ): InnerList
108
+ public static function parseInnerList (string $ httpValue ): array
104
109
{
105
110
if ('( ' !== $ httpValue [0 ]) {
106
111
throw new SyntaxError ("The HTTP textual representation ` $ httpValue` for a inner list is missing a parenthesis. " );
@@ -125,7 +130,9 @@ public static function parseInnerList(string $httpValue): InnerList
125
130
private static function parseItemOrInnerList (string $ httpValue ): array
126
131
{
127
132
if ('( ' === $ httpValue [0 ]) {
128
- return self ::parseInnerListValue ($ httpValue );
133
+ [$ innerList , $ offset ] = self ::parseInnerListValue ($ httpValue );
134
+
135
+ return [InnerList::fromList ($ innerList [0 ], $ innerList [1 ]), $ offset ];
129
136
}
130
137
131
138
[$ value , $ offset ] = self ::parseBareItem ($ httpValue );
@@ -142,7 +149,10 @@ private static function parseItemOrInnerList(string $httpValue): array
142
149
*
143
150
* @see https://www.rfc-editor.org/rfc/rfc8941.html#section-4.2.1.2
144
151
*
145
- * @return array{0:InnerList, 1:int}
152
+ * @return array{0:array{
153
+ * 0:array<Item|ByteSequence|Token|bool|int|float|string>,
154
+ * 1:array<string,Item|ByteSequence|Token|bool|int|float|string>
155
+ * }, 1:int}
146
156
*/
147
157
private static function parseInnerListValue (string $ httpValue ): array
148
158
{
@@ -156,7 +166,7 @@ private static function parseInnerListValue(string $httpValue): array
156
166
[$ parameters , $ offset ] = self ::parseParameters ($ remainder );
157
167
$ remainder = substr ($ remainder , $ offset );
158
168
159
- return [InnerList:: fromList ( $ members , $ parameters) , strlen ($ httpValue ) - strlen ($ remainder )];
169
+ return [[ $ members , $ parameters] , strlen ($ httpValue ) - strlen ($ remainder )];
160
170
}
161
171
162
172
[$ value , $ offset ] = self ::parseBareItem ($ remainder );
0 commit comments