/** * @param string $path * @param ValidationException $exception * * @return ValidationException */ private function getExceptionForPath($path, ValidationException $exception) { if ($path === $exception->guessId()) { return $exception; } if (!$exception instanceof self) { return $exception; } foreach ($exception as $subException) { return $subException; } return $exception; }