Preserve classname and PHP type together in error message

This commit is contained in:
Andrii Dembitskyi 2021-06-23 16:32:27 +03:00
parent aef099faf3
commit c7f2612685

View File

@ -245,7 +245,12 @@ class WorksheetManager implements WorksheetManagerInterface
} else {
$value = $cell->getValueEvenIfError();
throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . (\is_object($value) ? \get_class($value) : \gettype($value)));
$errorMessage = 'Trying to add a value with an unsupported type: ' . \gettype($value);
if (\is_object($value)) {
$errorMessage .= ' (' . \get_class($value) . ' given)';
}
throw new InvalidArgumentException($errorMessage);
}
return $data;