2020-07-18 18:57:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
|
2020-09-12 23:19:08 +02:00
|
|
|
use Rector\CakePHP\ValueObject\ModalToGetSet;
|
2020-07-18 18:57:24 +02:00
|
|
|
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
2020-08-18 17:57:30 +02:00
|
|
|
use Rector\Renaming\Rector\Name\RenameClassRector;
|
2020-08-25 00:26:14 +02:00
|
|
|
use Rector\Renaming\ValueObject\MethodCallRename;
|
|
|
|
use function Rector\SymfonyPhpConfig\inline_value_objects;
|
2020-07-18 18:57:24 +02:00
|
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
|
|
|
2020-07-18 19:00:36 +02:00
|
|
|
# source: https://book.cakephp.org/3.0/en/appendices/3-5-migration-guide.html
|
2020-07-18 18:57:24 +02:00
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
|
|
$services = $containerConfigurator->services();
|
|
|
|
|
|
|
|
$services->set(RenameClassRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-07-30 01:39:41 +02:00
|
|
|
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
2020-07-30 00:43:06 +02:00
|
|
|
'Cake\Http\Client\CookieCollection' => 'Cake\Http\Cookie\CookieCollection',
|
|
|
|
'Cake\Console\ShellDispatcher' => 'Cake\Console\CommandRunner',
|
|
|
|
],
|
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
|
|
|
|
$services->set(RenameMethodRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-08-25 00:37:12 +02:00
|
|
|
RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([
|
2020-08-25 00:26:14 +02:00
|
|
|
new MethodCallRename('Cake\Database\Schema\TableSchema', 'column', 'getColumn'),
|
|
|
|
new MethodCallRename('Cake\Database\Schema\TableSchema', 'constraint', 'getConstraint'),
|
|
|
|
new MethodCallRename('Cake\Database\Schema\TableSchema', 'index', 'getIndex'),
|
|
|
|
]),
|
2020-07-30 00:43:06 +02:00
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
|
|
|
|
$services->set(ModalToGetSetRector::class)
|
2020-07-30 00:43:06 +02:00
|
|
|
->call('configure', [[
|
2020-08-26 12:54:53 +02:00
|
|
|
ModalToGetSetRector::UNPREFIXED_METHODS_TO_GET_SET => inline_value_objects([
|
2020-09-12 23:19:08 +02:00
|
|
|
new ModalToGetSet('Cake\Cache\Cache', 'config'),
|
|
|
|
new ModalToGetSet('Cake\Cache\Cache', 'registry'),
|
|
|
|
new ModalToGetSet('Cake\Console\Shell', 'io'),
|
|
|
|
new ModalToGetSet('Cake\Console\ConsoleIo', 'outputAs'),
|
|
|
|
new ModalToGetSet('Cake\Console\ConsoleOutput', 'outputAs'),
|
|
|
|
new ModalToGetSet('Cake\Database\Connection', 'logger'),
|
|
|
|
new ModalToGetSet('Cake\Database\TypedResultInterface', 'returnType'),
|
|
|
|
new ModalToGetSet('Cake\Database\TypedResultTrait', 'returnType'),
|
|
|
|
new ModalToGetSet('Cake\Database\Log\LoggingStatement', 'logger'),
|
|
|
|
new ModalToGetSet('Cake\Datasource\ModelAwareTrait', 'modelType'),
|
|
|
|
new ModalToGetSet('Cake\Database\Query', 'valueBinder', 'getValueBinder', 'valueBinder'),
|
|
|
|
new ModalToGetSet('Cake\Database\Schema\TableSchema', 'columnType'),
|
|
|
|
new ModalToGetSet('Cake\Datasource\QueryTrait', 'eagerLoaded', 'isEagerLoaded', 'eagerLoaded'),
|
|
|
|
new ModalToGetSet('Cake\Event\EventDispatcherInterface', 'eventManager'),
|
|
|
|
new ModalToGetSet('Cake\Event\EventDispatcherTrait', 'eventManager'),
|
|
|
|
new ModalToGetSet('Cake\Error\Debugger', 'outputAs', 'getOutputFormat', 'setOutputFormat'),
|
|
|
|
new ModalToGetSet('Cake\Http\ServerRequest', 'env', 'getEnv', 'withEnv'),
|
|
|
|
new ModalToGetSet('Cake\Http\ServerRequest', 'charset', 'getCharset', 'withCharset'),
|
|
|
|
new ModalToGetSet('Cake\I18n\I18n', 'locale'),
|
|
|
|
new ModalToGetSet('Cake\I18n\I18n', 'translator'),
|
|
|
|
new ModalToGetSet('Cake\I18n\I18n', 'defaultLocale'),
|
|
|
|
new ModalToGetSet('Cake\I18n\I18n', 'defaultFormatter'),
|
|
|
|
new ModalToGetSet('Cake\ORM\Association\BelongsToMany', 'sort'),
|
|
|
|
new ModalToGetSet('Cake\ORM\LocatorAwareTrait', 'tableLocator'),
|
|
|
|
new ModalToGetSet('Cake\ORM\Table', 'validator'),
|
|
|
|
new ModalToGetSet('Cake\Routing\RouteBuilder', 'extensions'),
|
|
|
|
new ModalToGetSet('Cake\Routing\RouteBuilder', 'routeClass'),
|
|
|
|
new ModalToGetSet('Cake\Routing\RouteCollection', 'extensions'),
|
|
|
|
new ModalToGetSet('Cake\TestSuite\TestFixture', 'schema'),
|
|
|
|
new ModalToGetSet('Cake\Utility\Security', 'salt'),
|
|
|
|
new ModalToGetSet('Cake\View\View', 'template'),
|
|
|
|
new ModalToGetSet('Cake\View\View', 'layout'),
|
|
|
|
new ModalToGetSet('Cake\View\View', 'theme'),
|
|
|
|
new ModalToGetSet('Cake\View\View', 'templatePath'),
|
|
|
|
new ModalToGetSet('Cake\View\View', 'layoutPath'),
|
|
|
|
new ModalToGetSet('Cake\View\View', 'autoLayout', 'isAutoLayoutEnabled', 'enableAutoLayout'),
|
2020-08-26 12:54:53 +02:00
|
|
|
]),
|
2020-07-30 00:43:06 +02:00
|
|
|
]]);
|
2020-07-18 18:57:24 +02:00
|
|
|
};
|