I remember I read about it somewhere in the docs and saw it being used in the code, but can't remember its name. It was described as "fancy way of doing array_merge()" or something. It allowed to merge two arrays with parameters and included some simple type checking.
function doSomething ($params) {
$defaultParams = [
'foo' => false,
'bar' => 1,
];
$p = whatsTheFunctionName($params, $defaultParams, [/* foo is bool, bar is int */]);
}
CodePudding user response:
I think you're looking for the OptionsResolver component: "improved replacement for the array_replace PHP function".
See: https://symfony.com/doc/current/components/options_resolver.html