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

Commit 1197027

Browse files
committed
Minor fixes
1 parent 34af9ae commit 1197027

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Starting with version 5, the Facebook PHP SDK follows [SemVer](http://semver.org
55

66
## 6.x
77

8-
98
- 6.0 (201?-??-??)
109
- We use an HTTP client abstraction called HTTPlug to give the user more control over *how* to send PSR7 messages. See updated installation instructions.
1110
- Removed option `http_client_handler`

src/Facebook/Facebook.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
use Facebook\Helpers\FacebookPageTabHelper;
4040
use Facebook\Helpers\FacebookRedirectLoginHelper;
4141
use Facebook\Exceptions\FacebookSDKException;
42+
use Http\Client\HttpClient;
4243

4344
/**
4445
* Class Facebook
@@ -132,6 +133,9 @@ public function __construct(array $config = [])
132133
if (!$config['app_secret']) {
133134
throw new FacebookSDKException('Required "app_secret" key not supplied in config and could not find fallback environment variable "' . static::APP_SECRET_ENV_NAME . '"');
134135
}
136+
if ($config['http_client'] !== null && !$config['http_client'] instanceof HttpClient) {
137+
throw new \InvalidArgumentException('Required "http_client" key to be null or an instance of \Http\Client\HttpClient');
138+
}
135139

136140
$this->app = new FacebookApp($config['app_id'], $config['app_secret']);
137141
$this->client = new FacebookClient(

src/Facebook/FacebookClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ public function sendRequest(FacebookRequest $request)
193193

194194
list($url, $method, $headers, $body) = $this->prepareRequestMessage($request);
195195

196-
// Should throw `FacebookSDKException` exception on HTTP client error.
197-
// Don't catch to allow it to bubble up.
198196
$psr7Request = MessageFactoryDiscovery::find()->createRequest($method, $url, $headers, $body);
199197
$psr7Response = $this->httpClient->sendRequest($psr7Request);
200198

tests/FacebookTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function testInstantiatingWithoutAppSecretThrows()
6868
}
6969

7070
/**
71-
* @expectedException \Throwable
71+
* @expectedException \InvalidArgumentException
7272
*/
7373
public function testSettingAnInvalidHttpClientTypeThrows()
7474
{
@@ -79,7 +79,7 @@ public function testSettingAnInvalidHttpClientTypeThrows()
7979
}
8080

8181
/**
82-
* @expectedException \Throwable
82+
* @expectedException \InvalidArgumentException
8383
*/
8484
public function testSettingAnInvalidHttpClientClassThrows()
8585
{

0 commit comments

Comments
 (0)