diff --git a/src/FacebookAds/Api.php b/src/FacebookAds/Api.php index 4abeea81..0e59b65d 100644 --- a/src/FacebookAds/Api.php +++ b/src/FacebookAds/Api.php @@ -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 */ diff --git a/src/FacebookAds/CrashReporter.php b/src/FacebookAds/CrashReporter.php index 650a61cb..f2980e32 100644 --- a/src/FacebookAds/CrashReporter.php +++ b/src/FacebookAds/CrashReporter.php @@ -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); } diff --git a/src/FacebookAds/Session.php b/src/FacebookAds/Session.php index 884130e6..f955a7b4 100644 --- a/src/FacebookAds/Session.php +++ b/src/FacebookAds/Session.php @@ -12,12 +12,12 @@ class Session implements SessionInterface { /** - * @var string + * @var string|null */ protected $appId; /** - * @var string + * @var string|null */ protected $appSecret; @@ -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) { @@ -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;