PHP code example of eliashaeussler / rector-config
1. Go to this page and download the library: Download eliashaeussler/rector-config library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eliashaeussler / rector-config example snippets
# rector.php
use EliasHaeussler\RectorConfig\Config\Config;
use EliasHaeussler\RectorConfig\Set\CustomSet;
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
use Rector\Set\ValueObject\SetList;
use Rector\ValueObject\PhpVersion;
return static function (RectorConfig $rectorConfig): void {
// Optional: Configure PHP version explicitly
// Can be left out to use the current environment's PHP version
$phpVersion = PhpVersion::PHP_81;
// Create config from Rector config object
$config = Config::create($rectorConfig, $phpVersion)->in(
__DIR__.'/src',
__DIR__.'/tests',
);
// Skip specific paths
$config->not(
__DIR__.'/src/lib',
__DIR__.'/tests/test-application/vendor',
);
// Include default PHPUnit sets
$config->withPHPUnit();
// Include default Symfony sets
$config->withSymfony();
// Include default TYPO3 sets
$config->withTYPO3();
// Include custom sets
$config->withSets(
new CustomSet(
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
),
);
// Skip specific rectors
$config->skip(
AnnotationToAttributeRector::class,
[
__DIR__.'/src/Some/File.php',
],
);
// Apply configuration
$config->apply();
};
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.