Skip to content

Commit c637d00

Browse files
committed
add validation for configureCurl method
1 parent 7375680 commit c637d00

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Request/Message/Body/JsonBody.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ public function __construct(array $bodyData)
2222
$this->bodyData = $bodyData;
2323
}
2424

25-
public function configureCurl(\CurlHandle $curl): self
25+
public function configureCurl(\CurlHandle|false $curl): self
2626
{
27+
if ($curl === false) {
28+
throw new \TypeError('cURL is not a valid CurlHandle class.');
29+
}
30+
2731
$jsonBody = json_encode($this->bodyData);
2832
if ($jsonBody === false) {
2933
throw new HttpRequestMessageException('JSON body data not serializable.');

0 commit comments

Comments
 (0)