From 720b1268990b4fd349a0075c11c671c76cee12bf Mon Sep 17 00:00:00 2001 From: Thorsten Reiter Date: Tue, 4 Jun 2024 16:39:57 +0200 Subject: [PATCH 1/3] IBX-8357: Fixed item export --- src/lib/Service/ContentService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/Service/ContentService.php b/src/lib/Service/ContentService.php index 86aafff0..b41be9b2 100644 --- a/src/lib/Service/ContentService.php +++ b/src/lib/Service/ContentService.php @@ -259,9 +259,9 @@ private function getAuthor(APIContent $contentValue, APIContentType $contentType * * @return array */ - private function prepareFields(APIContentType $contentType, array $fields): array + private function prepareFields(APIContentType $contentType, ?array $fields = null): array { - if (empty($fields)) { + if (!empty($fields)) { return $fields; } From cfe53f25aeed231dfde946e8e4a16325bf9b6d0a Mon Sep 17 00:00:00 2001 From: Thorsten Reiter Date: Tue, 4 Jun 2024 16:43:24 +0200 Subject: [PATCH 2/3] fix phpstan --- phpstan-baseline.neon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 211af313..2611060a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -85,11 +85,6 @@ parameters: count: 1 path: src/bundle/DependencyInjection/ConfigurationMapper.php - - - message: "#^Parameter \\#1 \\$configuration of method Symfony\\\\Component\\\\DependencyInjection\\\\Extension\\\\Extension\\:\\:processConfiguration\\(\\) expects Symfony\\\\Component\\\\Config\\\\Definition\\\\ConfigurationInterface, Symfony\\\\Component\\\\Config\\\\Definition\\\\ConfigurationInterface\\|null given\\.$#" - count: 1 - path: src/bundle/DependencyInjection/EzRecommendationClientExtension.php - - message: "#^Method EzSystems\\\\EzRecommendationClientBundle\\\\EzRecommendationClientBundle\\:\\:build\\(\\) has no return type specified\\.$#" count: 1 @@ -880,6 +875,11 @@ parameters: count: 1 path: src/lib/Service/ContentService.php + - + message: "#^Method EzSystems\\\\EzRecommendationClient\\\\Service\\\\ContentService\\:\\:prepareFields\\(\\) should return array\\ but returns array\\, mixed\\>\\|null\\.$#" + count: 1 + path: src/lib/Service/ContentService.php + - message: "#^Method EzSystems\\\\EzRecommendationClient\\\\Service\\\\ContentService\\:\\:setContent\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 From bee1b71c701e83720da6411be0f7d5bfb88ccb2d Mon Sep 17 00:00:00 2001 From: Thorsten Reiter Date: Wed, 5 Jun 2024 10:24:27 +0200 Subject: [PATCH 3/3] Apply suggested change --- phpstan-baseline.neon | 5 ----- src/lib/Service/ContentService.php | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 2611060a..f16c7e02 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -875,11 +875,6 @@ parameters: count: 1 path: src/lib/Service/ContentService.php - - - message: "#^Method EzSystems\\\\EzRecommendationClient\\\\Service\\\\ContentService\\:\\:prepareFields\\(\\) should return array\\ but returns array\\, mixed\\>\\|null\\.$#" - count: 1 - path: src/lib/Service/ContentService.php - - message: "#^Method EzSystems\\\\EzRecommendationClient\\\\Service\\\\ContentService\\:\\:setContent\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 diff --git a/src/lib/Service/ContentService.php b/src/lib/Service/ContentService.php index b41be9b2..1f2d770c 100644 --- a/src/lib/Service/ContentService.php +++ b/src/lib/Service/ContentService.php @@ -265,6 +265,7 @@ private function prepareFields(APIContentType $contentType, ?array $fields = nul return $fields; } + $fields = []; foreach ($contentType->getFieldDefinitions() as $field) { $fields[] = $field->identifier; }