Require subjects by class name to have them type checked and autocompleted

[MAILPOET-4465]
This commit is contained in:
Jan Jakes
2022-07-05 14:59:26 +02:00
committed by Veljko V
parent 841ee97203
commit 3cccc52515
3 changed files with 37 additions and 4 deletions

View File

@ -95,6 +95,12 @@ class Exceptions {
->withMessage(__(sprintf("Subject with key '%s' not found.", $key), 'mailpoet'));
}
public static function subjectClassNotFound(string $key): NotFoundException {
return NotFoundException::create()
->withErrorCode(self::SUBJECT_NOT_FOUND)
->withMessage(__(sprintf("Subject of class '%s' not found.", $key), 'mailpoet'));
}
public static function subjectLoadFailed(string $key, array $args): InvalidStateException {
return InvalidStateException::create()
->withErrorCode(self::SUBJECT_LOAD_FAILED)