From ebeff7c68378509bdfb288f63842b4980cb2f0f9 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Mon, 13 Jan 2025 16:20:23 +0100 Subject: [PATCH 1/2] Fix for a BC Break We've made some changes to the ItemList class. Previously, some parameters were marked as int, but they have been redefined as String. To avoid any backward compatibility breaks, we're allowing both types. --- src/ItemList.php | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/src/ItemList.php b/src/ItemList.php index 1083e77d6..adeb163ed 100644 --- a/src/ItemList.php +++ b/src/ItemList.php @@ -510,13 +510,33 @@ public function overrideOutputFormat(string $outputFormat = null): self /** * Set MetaModel and render settings. * - * @param string $intMetaModel The MetaModel to use. - * @param string $intView The render settings to use (if 0, the default will be used). + * @param string|int $intMetaModel The MetaModel to use. + * @param string|int $intView The render settings to use (if 0, the default will be used). * * @return ItemList */ - public function setMetaModel(string $intMetaModel, string $intView): self + public function setMetaModel(string|int $intMetaModel, string|int $intView): self { + if (is_int($intMetaModel)) { + $intMetaModel = (string) $intMetaModel; + // @codingStandardsIgnoreStart Silencing errors is discouraged + @trigger_error( + 'Parameter $intMetaModel in "' . __CLASS__ . '::' .__METHOD__. '" has been changed from int to string.', + E_USER_DEPRECATED + ); + // @codingStandardsIgnoreEnd + } + + if (is_int($intView)) { + $intView = (string) $intView; + // @codingStandardsIgnoreStart Silencing errors is discouraged + @trigger_error( + 'Parameter $intView in "' . __CLASS__ . '::' .__METHOD__. '" has been changed from int to string.', + E_USER_DEPRECATED + ); + // @codingStandardsIgnoreEnd + } + $this->intMetaModel = $intMetaModel; $this->intView = $intView; @@ -663,14 +683,24 @@ protected function prepareView(): void /** * Set the filter setting to use. * - * @param string $intFilter The filter setting id to use. + * @param string|int $intFilter The filter setting id to use. * * @return $this * * @throws RuntimeException When the filter settings can not be found. */ - public function setFilterSettings(string $intFilter): self + public function setFilterSettings(string|int $intFilter): self { + if (is_int($intFilter)) { + $intFilter = (string) $intFilter; + // @codingStandardsIgnoreStart Silencing errors is discouraged + @trigger_error( + 'Parameter $intFilter in "' . __CLASS__ . '::' .__METHOD__. '" has been changed from int to string.', + E_USER_DEPRECATED + ); + // @codingStandardsIgnoreEnd + } + $this->objFilterSettings = $this->getFilterFactory()->createCollection($intFilter); return $this; From 97491b574aa5b860bfcb26c1987d6bc0930543b7 Mon Sep 17 00:00:00 2001 From: Stefan Heimes Date: Mon, 13 Jan 2025 16:52:22 +0100 Subject: [PATCH 2/2] Add a missing "use" --- src/ItemList.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ItemList.php b/src/ItemList.php index adeb163ed..0966df5c3 100644 --- a/src/ItemList.php +++ b/src/ItemList.php @@ -60,6 +60,7 @@ use function array_merge; use function func_num_args; use function in_array; +use function is_int; use function is_object; use function sprintf; use function strtoupper;