Breaking: #107229 - Removed support for annotations in Extbase 

See forge#107229

Description 

Extbase no longer supports PHP annotations for Models, DTOs, and controller actions. Use PHP attributes (e.g. #[Extbase\Validate]) instead, which provide the same functionality with better performance and native language support.

Extbase made heavy use of annotation parsing, which can be detected via code such as this, where the annotation namespace was imported:

use TYPO3\CMS\Extbase\Annotation as Extbase;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

class MyModel extends AbstractEntity
{
    /**
     * @Extbase\Validate("NotEmpty")
     */
    protected string $foo = '';
}
Copied!

Since PHP 8.2 is used as minimum requirement in TYPO3, the well-established PHP attributes should be used instead. All Extbase-related annotations are already usable as PHP attributes since TYPO3 v12.

Impact 

By dropping support for Extbase annotations, the more type-safe and native use of PHP attributes comes into play. This will enhance validation and ORM-related integrations a lot, since developers can rely on well-established architectures without the need of maintaining an additional third-party feature.

Affected installations 

All Extbase models, DTOs and Extbase controllers which make use of Extbase annotations are affected. This covers all shipped annotations like Cascade, Lazy and Validate, as well as custom developed annotations.

Migration 

Switch from Extbase annotations to native PHP attributes.

Before (with annotations): 

use TYPO3\CMS\Extbase\Annotation as Extbase;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

class MyModel extends AbstractEntity
{
    /**
     * @Extbase\Validate("NotEmpty")
     */
    protected string $foo = '';
}
Copied!

After (with PHP Attributes): 

use TYPO3\CMS\Extbase\Attribute as Extbase;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

class MyModel extends AbstractEntity
{
    #[Extbase\Validate(['validator' => 'NotEmpty'])]
    protected string $foo = '';
}
Copied!