Skip to content

Instantly share code, notes, and snippets.

@fballiano
Created September 25, 2021 09:36
Show Gist options
  • Save fballiano/9b9040355ec05c5e8a0c9377c15c8c13 to your computer and use it in GitHub Desktop.
Save fballiano/9b9040355ec05c5e8a0c9377c15c8c13 to your computer and use it in GitHub Desktop.
Rector PHP8 Magento1/OpenMage
<?php
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Rector\Core\ValueObject\PhpVersion;
return static function (ContainerConfigurator $containerConfigurator): void {
// get parameters
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/app/code/local',
__DIR__ . '/app/code/community',
]);
$parameters->set(Option::AUTOLOAD_PATHS, [
// discover specific file
__DIR__ . '/shell/',
__DIR__ . '/lib/',
__DIR__ . '/app/code/local/',
__DIR__ . '/app/code/community/',
__DIR__ . '/app/code/core/',
__DIR__ . '/vendor/',
]);
// Define what rule sets will be applied
//$containerConfigurator->import(SetList::CODE_QUALITY);
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_80);
$containerConfigurator->import(SetList::PHP_80);
// get services (needed for register a single rule)
// $services = $containerConfigurator->services();
// register a single rule
// $services->set(TypedPropertyRector::class);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment