/**
* Generates: "Argument '{$argumentName}' is invalid: expected value to be of type '{$expectedType}'[, got '{$value}']".
*
* @param string $argumentName
* @param string $expectedType
* @param mixed|null $value Optionally to output the type that was received
* @param \Exception|null $previous
*/
public function __construct($argumentName, $expectedType, $value = null, Exception $previous = null)
{
if ($value === null) {
$valueString = '';
} elseif (is_object($value)) {
$valueString = ", got '" . get_class($value) . "'";
} else {
$valueString = ", got '" . gettype($value) . "'";
}
parent::__construct($argumentName, "expected value to be of type '{$expectedType}'" . $valueString, $previous);
}