Skip to content

Commit

Permalink
Merge branch 'hotfix/fix_bc_break' into 'release/2.3.0'
Browse files Browse the repository at this point in the history
Fix for a BC Break

See merge request metamodels/core!380
  • Loading branch information
stefanheimes committed Jan 13, 2025
2 parents 09216ec + 97491b5 commit 633016f
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions src/ItemList.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -510,13 +511,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;

Expand Down Expand Up @@ -663,14 +684,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;
Expand Down

0 comments on commit 633016f

Please sign in to comment.