Skip to content

Commit b508f5c

Browse files
committed
Replace a switch with an if
1 parent 4912355 commit b508f5c

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/Request.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -649,14 +649,12 @@ public function getOptions() : array
649649
'Invalid Request Protocol: ' . $this->getProtocol()
650650
)
651651
};
652-
switch ($this->getMethod()) {
653-
case Method::POST:
654-
$options[\CURLOPT_POSTFIELDS] = $this->getPostAndFiles();
655-
break;
656-
case Method::PATCH:
657-
case Method::PUT:
658-
$options[\CURLOPT_POSTFIELDS] = $this->getBody();
659-
break;
652+
if (\in_array($this->getMethod(), [
653+
Method::PATCH,
654+
Method::POST,
655+
Method::PUT,
656+
], true)) {
657+
$options[\CURLOPT_POSTFIELDS] = $this->getPostAndFiles();
660658
}
661659
$options[\CURLOPT_CUSTOMREQUEST] = $this->getMethod();
662660
$options[\CURLOPT_HEADER] = false;

0 commit comments

Comments
 (0)