Handle invalid (object) value in cell value while generating exception message - add classname to message

This commit is contained in:
Andrii Dembitskyi 2021-06-22 16:15:32 +03:00
parent 9533accd73
commit 1a06aa624d
2 changed files with 6 additions and 2 deletions

View File

@ -243,7 +243,9 @@ class WorksheetManager implements WorksheetManagerInterface
} elseif ($cell->isEmpty()) {
$data .= '/>';
} else {
throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . \gettype($cell->getValue()));
$value = $cell->getValue();
throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . (\is_object($value) ? \get_class($value) : \gettype($value)));
}
return $data;

View File

@ -253,7 +253,9 @@ EOD;
$cellXML = '';
}
} else {
throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . \gettype($cell->getValue()));
$value = $cell->getValue();
throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . (\is_object($value) ? \get_class($value) : \gettype($value)));
}
return $cellXML;