Skip to content

Commit

Permalink
docs: add type hint for psalm
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb committed Dec 7, 2022
1 parent 50aeb6f commit f523fa3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public function save(): void {
foreach (array_keys(array_flip($val['slice'])) as $slice) {
$data = [];
foreach (array_keys($s['s'], $slice) as $uid) {
/** @var int $uid */
$data[$uid] = is_array($d[$uid])
? serialize($d[$uid])
: $d[$uid];
Expand Down Expand Up @@ -387,7 +388,7 @@ protected function _loadUids($mailbox, $uids, $uidvalid = null): void {
* @return void
*/
protected function _loadSlice($mailbox, $slice) {
$cache_id = $this->_getCid($mailbox, $slice);
$cache_id = $this->_getCid($mailbox, (string)$slice);

if (!empty($this->_loaded[$cache_id])) {
return;
Expand Down
9 changes: 6 additions & 3 deletions lib/Service/MimeMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
namespace OCA\Mail\Service;

use DOMDocument;
use DOMElement;
use DOMNode;
use Horde_Mime_Part;
use Horde_Text_Filter;
Expand Down Expand Up @@ -53,7 +54,7 @@ public function build(bool $isHtml, string $content, array $attachments): Horde_

for ($i = 0; $i < $images->count(); $i++) {
$image = $images->item($i);
if ($image === null) {
if (!($image instanceof DOMElement)) {
continue;
}

Expand Down Expand Up @@ -164,8 +165,10 @@ public function build(bool $isHtml, string $content, array $attachments): Horde_
* @return string|null non-null, add this text to the output and skip further processing of the node.
*/
public function htmlToTextCallback(DOMDocument $doc, DOMNode $node) {
if ($node instanceof \DOMElement && strtolower($node->tagName) === 'p') {
return $node->textContent . "\n";
if ($node instanceof DOMElement) {
if (strtolower($node->tagName) === 'p') {
return $node->textContent . "\n";
}
}

return null;
Expand Down

0 comments on commit f523fa3

Please sign in to comment.