diff --git a/src/Attribute.php b/src/Attribute.php index ebe411a1..e526395a 100644 --- a/src/Attribute.php +++ b/src/Attribute.php @@ -88,7 +88,7 @@ public function toDate(){ * @param mixed $key * @return bool */ - public function offsetExists($key) { + public function offsetExists($key): bool { return array_key_exists($key, $this->values); } @@ -98,6 +98,7 @@ public function offsetExists($key) { * @param mixed $key * @return mixed */ + #[\ReturnTypeWillChange] public function offsetGet($key) { return $this->values[$key]; } @@ -109,7 +110,7 @@ public function offsetGet($key) { * @param mixed $value * @return void */ - public function offsetSet($key, $value) { + public function offsetSet($key, $value): void { if (is_null($key)) { $this->values[] = $value; } else { @@ -123,7 +124,7 @@ public function offsetSet($key, $value) { * @param string $key * @return void */ - public function offsetUnset($key) { + public function offsetUnset($key): void { unset($this->values[$key]); } diff --git a/src/EncodingAliases.php b/src/EncodingAliases.php index 1eb16c13..4d84061d 100644 --- a/src/EncodingAliases.php +++ b/src/EncodingAliases.php @@ -473,8 +473,8 @@ class EncodingAliases { * @return string */ public static function get($encoding, $fallback = null) { - if (isset(self::$aliases[strtolower($encoding)])) { - return self::$aliases[strtolower($encoding)]; + if (isset(self::$aliases[strtolower($encoding ?? '')])) { + return self::$aliases[strtolower($encoding ?? '')]; } return $fallback !== null ? $fallback : $encoding; } diff --git a/src/Message.php b/src/Message.php index be636e8a..7fb7aa45 100755 --- a/src/Message.php +++ b/src/Message.php @@ -570,7 +570,7 @@ private function fetchPart(Part $part) { $content = $this->convertEncoding($content, $encoding); } - $subtype = strtolower($part->subtype); + $subtype = strtolower($part->subtype ?? ''); $subtype = $subtype == "plain" || $subtype == "" ? "text" : $subtype; if (isset($this->bodies[$subtype])) { @@ -719,7 +719,7 @@ public function convertEncoding($str, $from = "ISO-8859-2", $to = "UTF-8") { // https://en.wikipedia.org/wiki/ASCII // // convertEncoding() function basically means convertToUtf8(), so when we convert ASCII string into UTF-8 it gets broken. - if (strtolower($from) == 'us-ascii' && $to == 'UTF-8') { + if (strtolower($from ?? '') == 'us-ascii' && $to == 'UTF-8') { return $str; } diff --git a/src/Part.php b/src/Part.php index 2ca0a1b6..028c5575 100644 --- a/src/Part.php +++ b/src/Part.php @@ -299,7 +299,7 @@ private function parseEncoding(){ * @return bool */ public function isAttachment(){ - $valid_disposition = in_array(strtolower($this->disposition), ClientManager::get('options.dispositions')); + $valid_disposition = in_array(strtolower($this->disposition ?? ''), ClientManager::get('options.dispositions')); if ($this->type == IMAP::MESSAGE_TYPE_TEXT && ($this->ifdisposition == 0 || empty($this->disposition) || !$valid_disposition)) { if (($this->subtype == null || in_array((strtolower($this->subtype)), ["plain", "html"])) && $this->filename == null && $this->name == null) {