From cbc19c17ca151e960da26be7ea994bb5180cb0e7 Mon Sep 17 00:00:00 2001 From: nextcloud-command Date: Fri, 10 Mar 2023 05:12:02 +0000 Subject: [PATCH 1/2] Update psalm baseline Signed-off-by: GitHub --- php/psalm-baseline.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/psalm-baseline.xml b/php/psalm-baseline.xml index 9efde3ff..2a811d04 100644 --- a/php/psalm-baseline.xml +++ b/php/psalm-baseline.xml @@ -1,2 +1,2 @@ - + From c5bfdbb6535367eccac6a40f9ae58123574cea38 Mon Sep 17 00:00:00 2001 From: Simon L Date: Fri, 10 Mar 2023 11:17:25 +0100 Subject: [PATCH 2/2] fix psalm Signed-off-by: Simon L --- php/psalm.xml | 2 ++ php/src/Data/ConfigurationManager.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/php/psalm.xml b/php/psalm.xml index 49c40fd4..59601afa 100644 --- a/php/psalm.xml +++ b/php/psalm.xml @@ -6,6 +6,8 @@ xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config" errorBaseline="psalm-baseline.xml" + findUnusedBaselineEntry="true" + findUnusedCode="false" > diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index b7f48176..1c257946 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -78,7 +78,10 @@ class ConfigurationManager } $lastBackupLines = explode("\n", $content); - $lastBackupLine = $lastBackupLines[sizeof($lastBackupLines) - 2]; + $lastBackupLine = ""; + if (count($lastBackupLines) >= 2) { + $lastBackupLine = $lastBackupLines[sizeof($lastBackupLines) - 2]; + } if ($lastBackupLine === "") { return ''; }