brotkrueml/schema

[BUG] Multiple types set dynamically

ste101 opened this issue · 2 comments

Setting multiple types like this works:
TypeFactory::createType('Product', 'Service');

But if I want to set them dynamically through a variable I'm getting errors:
e.g:

$types = "'Product', 'Service'";
TypeFactory::createType($types);

I tried every writing, also arrays don't work.

Use argument unpacking:

$types = ['Product', 'Service'];
TypeFactory::createType(...$types);

See: https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.splat

Thank you for your help