Skip to content

Commit

Permalink
add rector
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho committed Feb 7, 2025
1 parent 474177a commit 513dc0f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@
},
"require-dev": {
"contao/test-case": "^4.0 || ^5.0",
"contao/manager-plugin": "^2.0",
"friendsofphp/php-cs-fixer": "^2.2",
"contao/manager-plugin": "^2.13",
"phpunit/phpunit": "^8.0 || ^9.0",
"php-coveralls/php-coveralls": "^2.0",
"symfony/phpunit-bridge": "^3.2 || ^4.0 || ^5.0 || ^6.0",
"heimrichhannot/contao-test-utilities-bundle": "^0.1.4",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-symfony": "^1.2"
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-symfony": "^1.4",
"rector/rector": "^1.2",
"contao/contao-rector": "dev-main",
"symplify/easy-coding-standard": "^12.5"
},
"autoload": {
"psr-4": {
Expand Down
33 changes: 33 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

use Contao\Rector\Set\ContaoLevelSetList;
use Contao\Rector\Set\ContaoSetList;
use Rector\Config\RectorConfig;
use Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
])
->withRules([
AddVoidReturnTypeWhereNoReturnRector::class,
# In Vorbereitung für PHP 8.4:
// ExplicitNullableParamTypeRector::class
])

->withImportNames(importShortClasses: false, removeUnusedImports: true)
->withSets([
LevelSetList::UP_TO_PHP_74,
SymfonySetList::SYMFONY_44,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
# Erst mit Symfony 6 (Contao 5) nutzen:
// SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
ContaoLevelSetList::UP_TO_CONTAO_49,
ContaoSetList::FQCN,
ContaoSetList::ANNOTATIONS_TO_ATTRIBUTES,
]);

0 comments on commit 513dc0f

Please sign in to comment.