Skip to content

Commit

Permalink
Fix minor errors and doc comments (#2120)
Browse files Browse the repository at this point in the history
* Fix minor errors and doc comments

* 2 anonymous functions were declaring using a variable that wasn't
used in the end, so this has been removed
* The 'delay' field of RetryMiddleware was not declared
* new TransferStats was called with 0 instead of null
* incorrect type was supplied to withHeader()
* various DocComments fixes

* revert back to 0
  • Loading branch information
NicolasCARPi authored and Nyholm committed Sep 12, 2018
1 parent dc4532a commit c7faf23
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Cookie/CookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function clear($domain = null, $path = null, $name = null)
} elseif (!$path) {
$this->cookies = array_filter(
$this->cookies,
function (SetCookie $cookie) use ($path, $domain) {
function (SetCookie $cookie) use ($domain) {
return !$cookie->matchesDomain($domain);
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/Handler/StreamHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __invoke(RequestInterface $request, array $options)
// Append a content-length header if body size is zero to match
// cURL's behavior.
if (0 === $request->getBody()->getSize()) {
$request = $request->withHeader('Content-Length', 0);
$request = $request->withHeader('Content-Length', '0');
}

return $this->createResponse(
Expand Down
8 changes: 4 additions & 4 deletions src/HandlerStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function resolve()
}

/**
* @param $name
* @param string $name
* @return int
*/
private function findByName($name)
Expand All @@ -223,10 +223,10 @@ private function findByName($name)
/**
* Splices a function into the middleware list at a specific position.
*
* @param $findName
* @param $withName
* @param string $findName
* @param string $withName
* @param callable $middleware
* @param $before
* @param bool $before
*/
private function splice($findName, $withName, callable $middleware, $before)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function httpErrors()
return $handler($request, $options);
}
return $handler($request, $options)->then(
function (ResponseInterface $response) use ($request, $handler) {
function (ResponseInterface $response) use ($request) {
$code = $response->getStatusCode();
if ($code < 400) {
return $response;
Expand Down
5 changes: 4 additions & 1 deletion src/RetryMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class RetryMiddleware
/** @var callable */
private $decider;

/** @var callable */
private $delay;

/**
* @param callable $decider Function that accepts the number of retries,
* a request, [response], and [exception] and
Expand All @@ -42,7 +45,7 @@ public function __construct(
/**
* Default exponential backoff delay function.
*
* @param $retries
* @param int $retries
*
* @return int
*/
Expand Down

0 comments on commit c7faf23

Please sign in to comment.