Deprecation: #102326 - RegularExpressionValidator validator option "errorMessage"

See forge#102326

Description

The errorMessage validator option provides a custom string as error message for validation failures of the RegularExpressionValidator. In order to streamline error message translation keys with other validators, the errorMessage validator option has been marked as deprecated in TYPO3 v13 and will be removed in TYPO3 v14.

Impact

Using the errorMessage validator option with the RegularExpressionValidator will trigger a PHP deprecation warning.

Affected installations

TYPO3 installations using the validator option errorMessage with the RegularExpressionValidator.

Migration

The new message validator option should be used to provide a custom translatable error message for failed validation.

Before:

use TYPO3\CMS\Extbase\Annotation as Extbase;

#[Extbase\Validate([
    'validator' => 'RegularExpression',
    'options' => [
        'regularExpression' => '/^simple[0-9]expression$/',
        'errorMessage' => 'Error message or LLL schema string',
    ],
])]
protected string $myProperty = '';
Copied!

After:

use TYPO3\CMS\Extbase\Annotation as Extbase;

#[Extbase\Validate([
    'validator' => 'RegularExpression',
    'options' => [
        'regularExpression' => '/^simple[0-9]expression$/',
        'message' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xlf:my.languageKey'
    ],
])]
protected string $myProperty = '';
Copied!