/**
  * @param mixed           $result       Deserialized result
  * @param string          $expectedType Expected result type
  * @param \Exception|null $previous     Previous exception
  */
 public function __construct($result, $expectedType, \Exception $previous = null)
 {
     $this->result = $result;
     $this->expectedType = $expectedType;
     parent::__construct(sprintf('Expected "%s" object, got "%s"', $expectedType, $this->getResultType()));
 }
 /**
  * Constructor from format
  *
  * @param string          $format   Expected format
  * @param string          $reason   Error reason
  * @param \Exception|null $previous Previous exception
  */
 public function __construct($format, $reason, \Exception $previous = null)
 {
     $this->format = $format;
     parent::__construct(sprintf('Wrong data format for "%s" deserialization: %s', $format, $reason), $previous);
 }