1. Go to this page and download the library: Download remp/crm-rector 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/ */
remp / crm-rector example snippets
declare(strict_types=1);
use Crm\Utils\Rector\Set\CrmSetList;
use Rector\Config\RectorConfig;
use Rector\Core\Configuration\Option;
return static function (RectorConfig $rectorConfig): void {
$parameters = $rectorConfig->parameters();
// paths to refactor
$rectorConfig->paths([
__DIR__ . '/app/custom-modules', // path to custom modules
]);
// set with CRM v3 and CRM v4 changes; check README for details
$rectorConfig->sets([
CrmSetList::CRM_4,
]);
// run single rule if you don't want to run whole set
// $rectorConfig->rule(\Crm\Utils\Rector\UpgradeToCrm4\InputParamChangeRector::class);
// $rectorConfig->rule(\Crm\Utils\Rector\UpgradeToCrm4\RemoveParamsProcessorRector::class);
// automatically import/remove namespaces after all rules are applied
$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);
$rectorConfig->removeUnusedImports();
};
$rectorConfig->sets([\Crm\Utils\Rector\Set\CrmSetList::CRM_4]);
// removes import of Crm\ApiModule\Models\Params\InputParam
$rectorConfig->removeUnusedImports();
// imports new *InputParam classes
$rectorConfig->importNames();