fix syntax error under PHP 7.3

7.3 is still the minimum requirement for 21.1
This commit is contained in:
Ralf Becker 2021-12-01 19:59:22 +02:00
parent 26595b4cba
commit c688315141

View File

@ -569,7 +569,10 @@ class Widget
$types = $paramType instanceof \ReflectionUnionType $types = $paramType instanceof \ReflectionUnionType
? $paramType->getTypes() ? $paramType->getTypes()
: [$paramType]; : [$paramType];
if(in_array('array', array_map(fn(\ReflectionNamedType $t) => $t->getName(), $types)) && !is_array($params[$index])) if(in_array('array', array_map(static function(\ReflectionNamedType $t)
{
return $t->getName();
}, $types)) && !is_array($params[$index]))
{ {
error_log("$method_name expects an array for {$param->getPosition()}: {$param->getName()}"); error_log("$method_name expects an array for {$param->getPosition()}: {$param->getName()}");
$params[$index] = (array)$params[$index]; $params[$index] = (array)$params[$index];