diff --git a/lib/Auth/AWS.php b/lib/Auth/AWS.php index e816f73..1e985e8 100644 --- a/lib/Auth/AWS.php +++ b/lib/Auth/AWS.php @@ -55,7 +55,7 @@ public function init(): bool { $authHeader = $this->request->getHeader('Authorization'); - if (is_null($authHeader)) { + if ($authHeader === null) { $this->errorCode = self::ERR_NOAWSHEADER; return false; diff --git a/lib/Client.php b/lib/Client.php index 16b2c7c..ebc86dd 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -196,7 +196,7 @@ public function poll(): bool ); if ($status && CURLMSG_DONE === $status['msg']) { - $resourceId = intval($status['handle']); + $resourceId = (int)$status['handle']; list( $request, $successCallback, @@ -461,7 +461,7 @@ protected function parseCurlResult(string $response, $curlHandle): array $response->setBody($responseBody); - $httpCode = intval($response->getStatus()); + $httpCode = (int)$response->getStatus(); return [ 'status' => $httpCode >= 400 ? self::STATUS_HTTPERROR : self::STATUS_SUCCESS, @@ -487,7 +487,7 @@ protected function sendAsyncInternal(RequestInterface $request, callable $succes $this->createCurlSettingsArray($request) ); curl_multi_add_handle($this->curlMultiHandle, $curl); - $this->curlMultiMap[intval($curl)] = [ + $this->curlMultiMap[(int)$curl] = [ $request, $success, $error, diff --git a/lib/Message.php b/lib/Message.php index 4972310..dff242c 100644 --- a/lib/Message.php +++ b/lib/Message.php @@ -52,7 +52,7 @@ public function getBodyAsStream() if (is_callable($this->body)) { $body = $this->getBodyAsString(); } - if (is_string($body) || is_null($body)) { + if (is_string($body) || $body === null) { $stream = fopen('php://temp', 'r+'); fwrite($stream, (string) $body); rewind($stream); @@ -75,7 +75,7 @@ public function getBodyAsString(): string if (is_string($body)) { return $body; } - if (is_null($body)) { + if ($body === null) { return ''; } if (is_callable($body)) { @@ -220,7 +220,7 @@ public function setHeaders(array $headers) * another value. Individual values can be retrieved with * getHeadersAsArray. * - * @param scalar $value + * @param string|string[] $value */ public function addHeader(string $name, $value) { diff --git a/lib/Response.php b/lib/Response.php index 024f211..d7bf2c2 100644 --- a/lib/Response.php +++ b/lib/Response.php @@ -105,13 +105,13 @@ class Response extends Message implements ResponseInterface */ public function __construct($status = 500, array $headers = null, $body = null) { - if (!is_null($status)) { + if ($status !== null) { $this->setStatus($status); } - if (!is_null($headers)) { + if ($headers !== null) { $this->setHeaders($headers); } - if (!is_null($body)) { + if ($body !== null) { $this->setBody($body); } } diff --git a/lib/Sapi.php b/lib/Sapi.php index 7859134..bf3daae 100644 --- a/lib/Sapi.php +++ b/lib/Sapi.php @@ -75,7 +75,7 @@ public static function sendResponse(ResponseInterface $response) } $body = $response->getBody(); - if (is_null($body)) { + if ($body === null) { return; } @@ -199,11 +199,11 @@ public static function createFromServerArray(array $serverArray): Request } } - if (is_null($url)) { + if ($url === null) { throw new InvalidArgumentException('The _SERVER array must have a REQUEST_URI key'); } - if (is_null($method)) { + if ($method === null) { throw new InvalidArgumentException('The _SERVER array must have a REQUEST_METHOD key'); } $r = new Request($method, $url, $headers); diff --git a/lib/functions.php b/lib/functions.php index 373d19e..161d261 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -138,7 +138,7 @@ function negotiateContentType($acceptHeaderValue, array $availableOptions) foreach ($proposals as $proposal) { // Ignoring broken values. - if (is_null($proposal)) { + if ($proposal === null) { continue; }