Skip to content

Commit

Permalink
Fix session app ID and app secret nullability
Browse files Browse the repository at this point in the history
  • Loading branch information
cvaclav committed Apr 12, 2024
1 parent 37777aa commit 4f91382
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/FacebookAds/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public function __construct(
}

/**
* @param string $app_id
* @param string $app_secret
* @param string|null $app_id
* @param string|null $app_secret
* @param string $access_token
* @return static
*/
Expand Down
6 changes: 5 additions & 1 deletion src/FacebookAds/CrashReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ public static function enable() {
if ($api == null) {
self::log('Could not initialize API' . PHP_EOL);
}
static::$instance = new static($api->getSession()->getAppId());
$appId = $api->getSession()->getAppId();
if ($appId == null) {
self::log('Missing session app ID' . PHP_EOL);
}
static::$instance = new static($appId);
static::$instance->registerExceptionHandler();
self::log('Enabled' . PHP_EOL);
}
Expand Down
12 changes: 6 additions & 6 deletions src/FacebookAds/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
class Session implements SessionInterface {

/**
* @var string
* @var string|null
*/
protected $appId;

/**
* @var string
* @var string|null
*/
protected $appSecret;

Expand All @@ -32,8 +32,8 @@ class Session implements SessionInterface {
protected $appSecretProof;

/**
* @param string $app_id
* @param string $app_secret
* @param string|null $app_id
* @param string|null $app_secret
* @param string $access_token
*/
public function __construct($app_id, $app_secret, $access_token) {
Expand All @@ -43,14 +43,14 @@ public function __construct($app_id, $app_secret, $access_token) {
}

/**
* @return string
* @return string|null
*/
public function getAppId() {
return $this->appId;
}

/**
* @return string
* @return string|null
*/
public function getAppSecret() {
return $this->appSecret;
Expand Down

0 comments on commit 4f91382

Please sign in to comment.