From f1ef1846ef42d82f544ed46850fca59ef73a4a27 Mon Sep 17 00:00:00 2001 From: jekuaitk Date: Tue, 25 Apr 2023 13:22:26 +0200 Subject: [PATCH] SUPP0RT-963: Code cleanup --- src/Helper/ArchiveHelper.php | 7 +++---- src/Plugin/WebformHandler/GetOrganizedWebformHandler.php | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Helper/ArchiveHelper.php b/src/Helper/ArchiveHelper.php index 6863980..de2982a 100644 --- a/src/Helper/ArchiveHelper.php +++ b/src/Helper/ArchiveHelper.php @@ -214,10 +214,6 @@ private function archiveToCitizen(string $submissionId, array $handlerConfigurat if (0 === $parentCaseCount) { $parentCaseId = $this->createCitizenCase($cprElementValue, $cprNameElementValue); - if (empty($parentCaseId)) { - $message = sprintf('Could not create citizen case'); - throw new CitizenArchivingException($message); - } } elseif (1 < $parentCaseCount) { $message = sprintf('Too many (%d) parent cases.', $parentCaseCount); @@ -293,6 +289,9 @@ private function createCitizenCase(string $cprElementValue, string $cprNameEleme $response = $this->caseService->createCase(self::CITIZEN_CASE_TYPE_PREFIX, $metadataArray); + if (empty($response)) { + throw new CitizenArchivingException('Could not create citizen case'); + } // Example response. // {"CaseID":"BOR-2022-000046","CaseRelativeUrl":"\/cases\/BOR12\/BOR-2022-000046",...}. return $response['CaseID']; diff --git a/src/Plugin/WebformHandler/GetOrganizedWebformHandler.php b/src/Plugin/WebformHandler/GetOrganizedWebformHandler.php index c3eb6b5..845de2a 100644 --- a/src/Plugin/WebformHandler/GetOrganizedWebformHandler.php +++ b/src/Plugin/WebformHandler/GetOrganizedWebformHandler.php @@ -284,7 +284,7 @@ public function postSave(WebformSubmissionInterface $webform_submission, $update /** * Get available elements by type. * - * @phpstan-param array $types + * @phpstan-param array $types * @phpstan-param array $elements * @phpstan-return array */