Skip to content

Commit 633016f

Browse files
committed
Merge branch 'hotfix/fix_bc_break' into 'release/2.3.0'
Fix for a BC Break See merge request metamodels/core!380
2 parents 09216ec + 97491b5 commit 633016f

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

src/ItemList.php

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
use function array_merge;
6161
use function func_num_args;
6262
use function in_array;
63+
use function is_int;
6364
use function is_object;
6465
use function sprintf;
6566
use function strtoupper;
@@ -510,13 +511,33 @@ public function overrideOutputFormat(string $outputFormat = null): self
510511
/**
511512
* Set MetaModel and render settings.
512513
*
513-
* @param string $intMetaModel The MetaModel to use.
514-
* @param string $intView The render settings to use (if 0, the default will be used).
514+
* @param string|int $intMetaModel The MetaModel to use.
515+
* @param string|int $intView The render settings to use (if 0, the default will be used).
515516
*
516517
* @return ItemList
517518
*/
518-
public function setMetaModel(string $intMetaModel, string $intView): self
519+
public function setMetaModel(string|int $intMetaModel, string|int $intView): self
519520
{
521+
if (is_int($intMetaModel)) {
522+
$intMetaModel = (string) $intMetaModel;
523+
// @codingStandardsIgnoreStart Silencing errors is discouraged
524+
@trigger_error(
525+
'Parameter $intMetaModel in "' . __CLASS__ . '::' .__METHOD__. '" has been changed from int to string.',
526+
E_USER_DEPRECATED
527+
);
528+
// @codingStandardsIgnoreEnd
529+
}
530+
531+
if (is_int($intView)) {
532+
$intView = (string) $intView;
533+
// @codingStandardsIgnoreStart Silencing errors is discouraged
534+
@trigger_error(
535+
'Parameter $intView in "' . __CLASS__ . '::' .__METHOD__. '" has been changed from int to string.',
536+
E_USER_DEPRECATED
537+
);
538+
// @codingStandardsIgnoreEnd
539+
}
540+
520541
$this->intMetaModel = $intMetaModel;
521542
$this->intView = $intView;
522543

@@ -663,14 +684,24 @@ protected function prepareView(): void
663684
/**
664685
* Set the filter setting to use.
665686
*
666-
* @param string $intFilter The filter setting id to use.
687+
* @param string|int $intFilter The filter setting id to use.
667688
*
668689
* @return $this
669690
*
670691
* @throws RuntimeException When the filter settings can not be found.
671692
*/
672-
public function setFilterSettings(string $intFilter): self
693+
public function setFilterSettings(string|int $intFilter): self
673694
{
695+
if (is_int($intFilter)) {
696+
$intFilter = (string) $intFilter;
697+
// @codingStandardsIgnoreStart Silencing errors is discouraged
698+
@trigger_error(
699+
'Parameter $intFilter in "' . __CLASS__ . '::' .__METHOD__. '" has been changed from int to string.',
700+
E_USER_DEPRECATED
701+
);
702+
// @codingStandardsIgnoreEnd
703+
}
704+
674705
$this->objFilterSettings = $this->getFilterFactory()->createCollection($intFilter);
675706

676707
return $this;

0 commit comments

Comments
 (0)