Use exception instead of early return
[MAILPOET-4047]
This commit is contained in:
@@ -4,6 +4,7 @@ namespace MailPoet\Cron\Workers\KeyCheck;
|
||||
|
||||
use MailPoet\Config\ServicesChecker;
|
||||
use MailPoet\Cron\CronWorkerScheduler;
|
||||
use MailPoet\InvalidStateException;
|
||||
use MailPoet\Mailer\Mailer;
|
||||
use MailPoet\Mailer\MailerLog;
|
||||
use MailPoet\Services\Bridge;
|
||||
@@ -47,7 +48,9 @@ class SendingServiceKeyCheck extends KeyCheckWorker {
|
||||
|
||||
public function checkKey() {
|
||||
// for phpstan because we set bridge property in the init function
|
||||
if (!$this->bridge) return;
|
||||
if (!$this->bridge) {
|
||||
throw new InvalidStateException('The class was not initialized properly. Please call the Init method before.');
|
||||
};
|
||||
|
||||
$wasPendingApproval = $this->servicesChecker->isMailPoetAPIKeyPendingApproval();
|
||||
|
||||
|
Reference in New Issue
Block a user