Improve discernable type safety in MDMailerHelper
This commit is contained in:
parent
c75eb5eb03
commit
25473f17de
|
@ -23,7 +23,7 @@ final class MDMailerHelper {
|
|||
public static function pgp_encrypt(string $to, string $msg):string {
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_EXCEPTION);
|
||||
$gpg->seterrormode(GNUPG_ERROR_EXCEPTION);
|
||||
|
||||
if (empty($recipients = $gpg->keyinfo($to))) {
|
||||
throw new \Exception("Cannot retrieve public key of recipient for GPG encryption");
|
||||
|
@ -42,7 +42,7 @@ final class MDMailerHelper {
|
|||
throw new \Exception("Cannot set private key for GPG encryption");
|
||||
}
|
||||
|
||||
if (($msg = $gpg->encrypt($msg)) === false) {
|
||||
if (empty($msg = $gpg->encrypt($msg))) {
|
||||
throw new \Exception("Failed to sign and encrypt the message");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user