/** * @param \TYPO3\CMS\Extbase\Error\Result $validationResult * @return Error */ protected function findFirstError(\TYPO3\CMS\Extbase\Error\Result $validationResult) { $error = $validationResult->getFirstError(); if ($error instanceof Error) { return $error; } foreach ($validationResult->getSubResults() as $argumentName => $subValidationResult) { /** @var $subValidationResult \TYPO3\CMS\Extbase\Error\Result */ $error = $this->findFirstError($subValidationResult); if ($error instanceof Error) { return $error; } } }