PHP code example of serendipity_hq / rector-config
1. Go to this page and download the library: Download serendipity_hq/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.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
serendipity_hq / rector-config example snippets
declare(strict_types = 1);
useSerendipityHQ\Integration\Rector\SerendipityHQ;
useSymfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
useRector\Core\Configuration\Option;
useRector\Core\ValueObject\PhpVersion;
returnstaticfunction(ContainerConfigurator $containerConfigurator) : void{
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_81);
$parameters->set(Option::PATHS, [__DIR__ . '/src', __DIR__ . '/tests']);
$parameters->set(Option::BOOTSTRAP_FILES, [__DIR__ . '/vendor-bin/phpunit/vendor/autoload.php']);
// Import directly the configuration from Serendipity HQ Rector Config
$containerConfigurator->import(SerendipityHQ::SHQ_SYMFONY_APP);
// Import the excluded rectors
$toSkip = SerendipityHQ::buildToSkip(SerendipityHQ::SHQ_SYMFONY_APP_SKIP);
// Set the rectors to exclude
$parameters->set(Option::SKIP, $toSkip);
};
declare(strict_types = 1);
useSerendipityHQ\Integration\Rector\SerendipityHQ;
useSymfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
useRector\Core\Configuration\Option;
useRector\Core\ValueObject\PhpVersion;
returnstaticfunction(ContainerConfigurator $containerConfigurator) : void{
...
$othersToSkip = [
\Rector\To\Exclude\Rector::class
];
// Import the excluded rectors
$toSkip = SerendipityHQ::buildToSkip(SerendipityHQ::SHQ_SYMFONY_APP_SKIP, $othersToSkip);
// Set the rectors to exclude
$parameters->set(Option::SKIP, $toSkip);
};
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.