Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

Commit 089aeae

Browse files
committed
Merge pull request #526 from EmanueleMinotto/best-practice
headers type + empty function
2 parents 29503dd + d4ae9ff commit 089aeae

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Facebook/HttpClients/FacebookStream.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class FacebookStream
4141
/**
4242
* @var array Response headers from the stream wrapper
4343
*/
44-
protected $responseHeaders;
44+
protected $responseHeaders = [];
4545

4646
/**
4747
* Make a new context stream reference instance
@@ -56,7 +56,7 @@ public function streamContextCreate(array $options)
5656
/**
5757
* The response headers from the stream wrapper
5858
*
59-
* @return array|null
59+
* @return array
6060
*/
6161
public function getResponseHeaders()
6262
{
@@ -73,7 +73,7 @@ public function getResponseHeaders()
7373
public function fileGetContents($url)
7474
{
7575
$rawResponse = file_get_contents($url, false, $this->stream);
76-
$this->responseHeaders = $http_response_header;
76+
$this->responseHeaders = $http_response_header ?: [];
7777

7878
return $rawResponse;
7979
}

src/Facebook/HttpClients/FacebookStreamHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function send($url, $method, $body, array $headers, $timeOut)
6666
$rawBody = $this->facebookStream->fileGetContents($url);
6767
$rawHeaders = $this->facebookStream->getResponseHeaders();
6868

69-
if ($rawBody === false || !$rawHeaders) {
69+
if ($rawBody === false || empty($rawHeaders)) {
7070
throw new FacebookSDKException('Stream returned an empty response', 660);
7171
}
7272

src/Facebook/Url/FacebookUrlManipulator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static function removeParamsFromUrl($url, array $paramsToFilter)
7676
*/
7777
public static function appendParamsToUrl($url, array $newParams = [])
7878
{
79-
if (!$newParams) {
79+
if (empty($newParams)) {
8080
return $url;
8181
}
8282

0 commit comments

Comments
 (0)