contao/rector
Automate Contao CMS code upgrades with Rector rules and presets. contao/rector helps refactor PHP codebases to newer Contao and PHP versions, applying safe transformations to reduce manual migration work and keep projects consistent.
This package includes the Rector configuration for Contao.
Add the package to your Contao installation via Composer:
composer require contao/rector --dev
Create a file named rector.php in the root directory of your project.
<?php
declare(strict_types=1);
use Contao\Rector\Set\SetList;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withSets([SetList::CONTAO])
// Adjust the configuration according to your needs.
;
Then run the script like this:
vendor/bin/rector
The package contains the following custom rectors:
| Class | Description |
|---|---|
SimplifyObjectOrNullCheckRector |
Replaces null comparisons that check for object|null with boolean comparisons. |
Contao is licensed under the terms of the LGPLv3.
Visit the support page to learn about the available support options.
How can I help you explore Laravel packages today?