Instant upgrade and refactoring for the TYPO3 schema extension code by using Rector

v1.0.0 2021-04-12 09:38 UTC

This package is auto-updated.

Last update: 2023-09-12 14:47:04 UTC


CI Status

This package provides Rector rules for migrating code from older versions of the TYPO3 extension schema.

Note: If you don't know already, you can also migrate TYPO3 core-specific code with Rector for TYPO3.


The package can be installed with composer:

composer req --dev brotkrueml/schema-rector

Caution: Never run this tool on production, only on development environment where code is under version control (e.g. git). Always review and test automatic changes before releasing to production.


Create a rector.php file in the project's root folder:



use Brotkrueml\SchemaRector\Rules\RenameSchemaManagerSetMainEntityOfWebPageRector;use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();


Afterwards you can start a dry-run to see the possible changes (assuming the extensions of your projects are available under the packages folder):

vendor/bin/rector process packages --dry-run

If everything is okay for you than you can omit the dry-run option to write the changes to your code.


The following rules are available:


This Rector migrates the deprecated SchemaManager->setMainEntityOfWebPage() method call to the new SchemaManager->addMainEntityOfWebPage().

🔧 configure it!

use Brotkrueml\SchemaRector\Rules\RenameSchemaManagerSetMainEntityOfWebPageRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();


 $schemaManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(Brotkrueml\Schema\Manager\SchemaManager::class);
 $type = new \Brotkrueml\Schema\Model\Type\Thing();