Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe committed May 11, 2020
1 parent cf872db commit ec7e03c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
23 changes: 12 additions & 11 deletions lib/Service/AbstractService.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ public function getClient()
*/
private static function formatParams($params)
{
if (null === $params) {
return $params;
}
$formatted = [];
foreach ($params as $k => $v) {
if (null === $v) {
$formatted[$k] = "";
} else {
$formatted[$k] = $v;
if (null === $params) {
return $params;
}
}
return $formatted;
$formatted = [];
foreach ($params as $k => $v) {
if (null === $v) {
$formatted[$k] = '';
} else {
$formatted[$k] = $v;
}
}

return $formatted;
}

protected function request($method, $path, $params, $opts)
Expand Down
8 changes: 4 additions & 4 deletions tests/Stripe/Service/AbstractServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public function setUpMockService()

public function testNullGetsEmptyStringified()
{
$this->expectException(\Stripe\Exception\InvalidRequestException::class);
$this->service->update("id", [
"doesnotexist" => null
]);
$this->expectException(\Stripe\Exception\InvalidRequestException::class);
$this->service->update('id', [
'doesnotexist' => null,
]);
}

public function testRetrieveThrowsIfIdNullIsNull()
Expand Down

0 comments on commit ec7e03c

Please sign in to comment.