Fix phpstan error

This commit is contained in:
Aleksander Machniak 2024-04-04 16:14:10 +02:00
parent 4ef359115b
commit 0333d78048

View file

@ -1334,11 +1334,12 @@ class libcalendaring_vcalendar implements Iterator
foreach ((array) $event['attachments'] as $idx => $attach) { foreach ((array) $event['attachments'] as $idx => $attach) {
// check available memory and skip attachment export if we can't buffer it // check available memory and skip attachment export if we can't buffer it
// @todo: use rcube_utils::mem_check() // @todo: use rcube_utils::mem_check()
if (is_callable($get_attachment) && $memory_limit > 0 && ($memory_used = function_exists('memory_get_usage') ? memory_get_usage() : 16 * 1024 * 1024) if (is_callable($get_attachment) && $memory_limit > 0) {
&& !empty($attach['size']) && $memory_used + $attach['size'] * 3 > $memory_limit $memory_used = function_exists('memory_get_usage') ? memory_get_usage() : 16 * 1024 * 1024;
) { if (!empty($attach['size']) && $memory_used + $attach['size'] * 3 > $memory_limit) {
continue; continue;
} }
}
// embed attachments using the given callback function // embed attachments using the given callback function
if (is_callable($get_attachment) && ($data = call_user_func($get_attachment, $attach['id'] ?? $idx, $event))) { if (is_callable($get_attachment) && ($data = call_user_func($get_attachment, $attach['id'] ?? $idx, $event))) {