diff --git a/lib/Service/MailFilter/FilterBuilder.php b/lib/Service/MailFilter/FilterBuilder.php index 5d0b2731c1..5b8673dc8d 100644 --- a/lib/Service/MailFilter/FilterBuilder.php +++ b/lib/Service/MailFilter/FilterBuilder.php @@ -58,6 +58,11 @@ public function buildSieveScript(array $filters, string $untouchedScript): strin } } + if (count($tests) === 0) { + // skip filter without tests + continue; + } + $actions = []; foreach ($filter['actions'] as $action) { if ($action['type'] === 'fileinto') { @@ -82,8 +87,6 @@ public function buildSieveScript(array $filters, string $untouchedScript): strin } } - // Error: lib/Service/MailFilter/FilterBuilder.php:88:15: PossiblyUndefinedArrayOffset: Possibly undefined array key $tests[0] on list{0?: non-empty-string} (see https://psalm.dev/167) - if (count($tests) > 1) { $ifTest = sprintf('%s (%s)', $filter['operator'], implode(', ', $tests)); } else {