Preserve classname and PHP type together in error message

Co-authored-by: Adrien Loison <adrilo@users.noreply.github.com>
This commit is contained in:
Andrii Dembitskyi 2021-06-23 09:29:42 -04:00 committed by GitHub
parent 8b3b832359
commit aef099faf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -255,7 +255,12 @@ EOD;
} 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 $cellXML;