diff options
author | Bennet Becker <dev@bennet.cc> | 2022-12-23 21:48:52 +0100 |
---|---|---|
committer | Bennet Becker <dev@bennet.cc> | 2022-12-23 21:48:52 +0100 |
commit | 411467af57cf94eb2ee6a90538017640a76d0dcb (patch) | |
tree | 89b3e3a4f8313516c577b3d8f6438895c805408d /lib | |
parent | 4b992cdf7f2b1b5fa998cca7949a821122dd582f (diff) | |
download | nextcloud-server-411467af57cf94eb2ee6a90538017640a76d0dcb.tar.gz nextcloud-server-411467af57cf94eb2ee6a90538017640a76d0dcb.zip |
fix static-analysis error and formatting code
Signed-off-by: Bennet Becker <dev@bennet.cc>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Mail/Message.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php index d074befcae4..417b64d0f3a 100644 --- a/lib/private/Mail/Message.php +++ b/lib/private/Mail/Message.php @@ -307,18 +307,23 @@ class Message implements IMessage { * Add the Auto-Submitted header to the email, preventing most automated * responses to automated messages. * - * @param string $value (one of AutoSubmittedValue::NO, AutoSubmittedValue::AUTO_GENERATED, AutoSubmittedValue::AUTO_REPLIED) + * @param AutoSubmittedValue::* $value (one of AutoSubmittedValue::NO, AutoSubmittedValue::AUTO_GENERATED, AutoSubmittedValue::AUTO_REPLIED) * @return $this */ public function setAutoSubmitted(string $value): IMessage { $headers = $this->swiftMessage->getHeaders(); - if($headers->has('Auto-Submitted')) { - $auto_submitted = $headers->get('Auto-Submitted'); - $auto_submitted->setValue($value); - } else { - $headers->addTextHeader('Auto-Submitted', $value); + + if ($headers->has('Auto-Submitted')) { + // if the header already exsists, remove it. + // the value can be modified with some implementations + // of the interface \Swift_Mime_Header, however the + // interface doesn't, and this makes the static-code + // analysis unhappy. + $headers->remove('Auto-Submitted'); } + $headers->addTextHeader('Auto-Submitted', $value); + return $this; } |