Skip to content

Commit

Permalink
refactor(HasHttpClient): adjust multipart options handling
Browse files Browse the repository at this point in the history
  - Update HasHttpClient.php to handle multipart options differently
  - Modify Utils.php to adjust multipartFor method signature
  • Loading branch information
guanguans committed Mar 8, 2024
1 parent 57dcf59 commit f2353ea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.22.2@d768d914152dbbf3486c36398802f74e80cfde48"/>
<files psalm-version="5.22.2@d768d914152dbbf3486c36398802f74e80cfde48">
<file src="src/Foundation/Concerns/HasHttpClient.php">
<UndefinedConstant>
<code><![CDATA[MULTIPART_TRY_OPEN_FILE]]></code>
</UndefinedConstant>
</file>
</files>
5 changes: 4 additions & 1 deletion src/Foundation/Concerns/HasHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ public function defaultHttpOptions(): array
public function normalizeHttpOptions(array $options): array
{
if (isset($options[RequestOptions::MULTIPART])) {
$options[RequestOptions::MULTIPART] = Utils::multipartFor($options[RequestOptions::MULTIPART]);
$options[RequestOptions::MULTIPART] = Utils::multipartFor(
$options[RequestOptions::MULTIPART],
MULTIPART_TRY_OPEN_FILE
);
}

return $options;
Expand Down
2 changes: 1 addition & 1 deletion src/Foundation/Support/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Utils
/**
* Convert a form array into a multipart array.
*/
public static function multipartFor(array $form, int $options = MULTIPART_TRY_OPEN_FILE): array
public static function multipartFor(array $form, int $options = 0): array
{
/**
* @param array-key $name
Expand Down

0 comments on commit f2353ea

Please sign in to comment.