From 512bcb61fc7f64bb57ef5f6a521d12a580c4b003 Mon Sep 17 00:00:00 2001 From: Michael Stilkerich Date: Sat, 11 Sep 2021 18:10:29 +0200 Subject: [PATCH] Fix psalm issues to fix CI build --- src/DataConversion.php | 1 + src/Db/AbstractDatabase.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/DataConversion.php b/src/DataConversion.php index 93daf977..e3588512 100644 --- a/src/DataConversion.php +++ b/src/DataConversion.php @@ -1130,6 +1130,7 @@ private static function composeDisplayname(array $save_data): string $dname = []; foreach (["firstname", "surname"] as $attr) { if (!empty($save_data[$attr])) { + /** @psalm-var string */ $dname[] = $save_data[$attr]; } } diff --git a/src/Db/AbstractDatabase.php b/src/Db/AbstractDatabase.php index 57505394..b68fc6ff 100644 --- a/src/Db/AbstractDatabase.php +++ b/src/Db/AbstractDatabase.php @@ -46,6 +46,7 @@ * } * * @psalm-import-type SaveDataFromDC from \MStilkerich\CardDavAddressbook4Roundcube\DataConversion + * @psalm-import-type SaveDataMultiField from \MStilkerich\CardDavAddressbook4Roundcube\DataConversion */ abstract class AbstractDatabase { @@ -191,7 +192,8 @@ public function storeContact( $email_keys = preg_grep('/^email(:|$)/', array_keys($save_data)); $email_addrs = []; foreach ($email_keys as $email_key) { - $email_addrs = array_merge($email_addrs, (array) $save_data[$email_key]); + /** @psalm-var SaveDataMultiField $save_data[$email_key] */ + $email_addrs = array_merge($email_addrs, $save_data[$email_key]); } $save_data['email'] = implode(', ', $email_addrs);