protected function handleMismatch(\Closure $castFunction, $expectedType) { if ($this->getHydrator()->toleratesMismatches()) { return $castFunction($this->value); } $this->raiseMismatch($expectedType); }