Deprecation: #103965 - Deprecate namespaced shorthand validator usage in Extbase
See forge#103965
Description
It is possible to use undocumented namespaced shorthand notation in Extbase
to add validators to properties or arguments. For example,
TYPO3. will be resolved as
\TYPO3\ and
Vendor. will be resolved as
\Vendor\.
The namespaced shorthand notation for Extbase validators has been marked as deprecated and will be removed in TYPO3 v14.
Impact
Using namespaced shorthand notation in Extbase will trigger a PHP deprecation warning.
Affected installations
All installations using namespaced shorthand notation in Extbase.
Migration
Extensions using the namespaced shorthand notation must use the FQCN of the validator instead. For Extbase core validators, the well known shorthand validator name can be used.
Before
/**
* @Extbase\Validate("TYPO3.CMS.Extbase:NotEmpty")
*/
protected $myProperty1;
/**
* @Extbase\Validate("Vendor.Extension:Custom")
*/
protected $myProperty2;
After
/**
* @Extbase\Validate("NotEmpty")
*/
protected $myProperty1;
/**
* @Extbase\Validate("Vendor\Extension\Validation\Validator\CustomValidator")
*/
protected $myProperty2;
or
#[Extbase\Validate(['validator' => \TYPO3\CMS\Extbase\Validation\Validator\NotEmptyValidator::class])]
protected $myProperty1;
#[Extbase\Validate(['validator' => \Vendor\Extension\Validation\Validator\CustomValidator::class])]
protected $myProperty2;