/** * @param Requirement $requirement * @param $data * @throws \Exception */ private function checkRequirementData(Requirement $requirement, $data) { if ($data === null && $requirement->isRequired()) { $requirement->fail(); throw new \Exception('Requirement "' . $requirement->getKey() . '" is required but could not be resolved'); } }