@@ -22,7 +22,7 @@ abstract class Multipart
22
22
private $ contentType ;
23
23
24
24
/**
25
- * @var array<string|resource|callable> the parts that form this multipart object.
25
+ * @var array<string|resource|callable(int):string > the parts that form this multipart object.
26
26
*/
27
27
private $ parts = [];
28
28
@@ -188,11 +188,11 @@ final protected function endHeaders()
188
188
/**
189
189
* Adds the content of a part.
190
190
*
191
- * @param string|resource|callable $content The content.
192
- * If it's a callable it should take a length argument
193
- * and return a string that is not larger than the input.
194
- * @param int $length The length of the part, or -1 if not known.
195
- * Ignored if the part is a string.
191
+ * @param string|resource|callable(int):string $content The content.
192
+ * If it's a callable it should take a length argument
193
+ * and return a string that is not larger than the input.
194
+ * @param int $length The length of the part, or -1 if not known.
195
+ * Ignored if the part is a string.
196
196
*
197
197
* @return void
198
198
*/
@@ -251,11 +251,11 @@ final public function isFinished()
251
251
/**
252
252
* Adds a piece of a part.
253
253
*
254
- * @param string|resource|callable $part The part to add.
255
- * If it's a callable it should take a length argument
256
- * and return a string that is not larger than the input.
257
- * @param int $length The length of the part, or -1 if not known.
258
- * Ignored if the part is a string.
254
+ * @param string|resource|callable(int):string $part The part to add.
255
+ * If it's a callable it should take a length argument
256
+ * and return a string that is not larger than the input.
257
+ * @param int $length The length of the part, or -1 if not known.
258
+ * Ignored if the part is a string.
259
259
*
260
260
* @return void
261
261
*/
@@ -345,16 +345,16 @@ private function doReadFromPart($length)
345
345
$ result = $ length === 0 ? '' : substr ($ part , $ this ->partIndex , $ length );
346
346
$ this ->partIndex += $ length ;
347
347
return $ result ;
348
- } elseif (is_resource ($ this -> parts [ $ this -> index ] )) {
348
+ } elseif (is_resource ($ part )) {
349
349
$ result = @fread ($ part , $ length );
350
350
if ($ result === false ) {
351
351
throw new \ErrorException (error_get_last ()['message ' ]);
352
352
}
353
353
return $ result ;
354
- } elseif (is_callable ($ this -> parts [ $ this -> index ] )) {
354
+ } elseif (is_callable ($ part )) {
355
355
return call_user_func ($ part , $ length );
356
356
} else {
357
- throw new \UnexpectedValueException ('non-supported part type: ' . gettype ($ this -> parts [ $ this -> index ] ));
357
+ throw new \UnexpectedValueException ('non-supported part type: ' . gettype ($ part ));
358
358
}
359
359
}
360
360
0 commit comments