2020-07-18 16:57:24 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-07-28 23:41:20 +00:00
|
|
|
use Rector\Generic\Rector\Property\PropertyToMethodRector;
|
2020-07-18 16:57:24 +00:00
|
|
|
use Rector\Renaming\Rector\Class_\RenameClassRector;
|
|
|
|
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
|
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
|
|
|
|
|
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
|
|
$services = $containerConfigurator->services();
|
|
|
|
|
2020-07-18 17:00:36 +00:00
|
|
|
# source: https://book.cakephp.org/3.0/en/appendices/3-6-migration-guide.html
|
2020-07-18 16:57:24 +00:00
|
|
|
$services->set(RenameMethodRector::class)
|
2020-07-29 22:43:06 +00:00
|
|
|
->call('configure', [[
|
|
|
|
'$oldToNewMethodsByClass' => [
|
|
|
|
'Cake\ORM\Table' => [
|
|
|
|
'association' => 'getAssociation',
|
|
|
|
],
|
|
|
|
'Cake\Validation\ValidationSet' => [
|
|
|
|
'isPresenceRequired' => 'requirePresence',
|
|
|
|
'isEmptyAllowed' => 'allowEmpty',
|
|
|
|
],
|
2020-07-18 16:57:24 +00:00
|
|
|
],
|
2020-07-29 22:43:06 +00:00
|
|
|
]]);
|
2020-07-18 16:57:24 +00:00
|
|
|
|
|
|
|
$services->set(PropertyToMethodRector::class)
|
2020-07-29 22:43:06 +00:00
|
|
|
->call('configure', [[
|
|
|
|
'$perClassPropertyToMethods' => [
|
|
|
|
'Cake\Controller\Controller' => [
|
|
|
|
'name' => [
|
|
|
|
'get' => 'getName',
|
|
|
|
'set' => 'setName',
|
|
|
|
],
|
|
|
|
'plugin' => [
|
|
|
|
'get' => 'getPlugin',
|
|
|
|
'set' => 'setPlugin',
|
|
|
|
],
|
2020-07-18 16:57:24 +00:00
|
|
|
],
|
2020-07-29 22:43:06 +00:00
|
|
|
'Cake\Form\Form' => [
|
|
|
|
'validator' => [
|
|
|
|
'get' => 'getValidator',
|
|
|
|
'set' => 'setValidator',
|
|
|
|
],
|
2020-07-18 16:57:24 +00:00
|
|
|
],
|
|
|
|
],
|
2020-07-29 22:43:06 +00:00
|
|
|
]]);
|
2020-07-18 16:57:24 +00:00
|
|
|
|
|
|
|
$services->set(RenameClassRector::class)
|
2020-07-29 22:43:06 +00:00
|
|
|
->call('configure', [[
|
|
|
|
'$oldToNewClasses' => [
|
|
|
|
'Cake\Cache\Engine\ApcEngine' => 'Cake\Cache\Engine\ApcuEngine',
|
|
|
|
'Cake\Network\Exception\BadRequestException' => 'Cake\Http\Exception\BadRequestException',
|
|
|
|
'Cake\Network\Exception\ConflictException' => 'Cake\Http\Exception\ConflictException',
|
|
|
|
'Cake\Network\Exception\ForbiddenException' => 'Cake\Http\Exception\ForbiddenException',
|
|
|
|
'Cake\Network\Exception\GoneException' => 'Cake\Http\Exception\GoneException',
|
|
|
|
'Cake\Network\Exception\HttpException' => 'Cake\Http\Exception\HttpException',
|
|
|
|
'Cake\Network\Exception\InternalErrorException' => 'Cake\Http\Exception\InternalErrorException',
|
|
|
|
'Cake\Network\Exception\InvalidCsrfTokenException' => 'Cake\Http\Exception\InvalidCsrfTokenException',
|
|
|
|
'Cake\Network\Exception\MethodNotAllowedException' => 'Cake\Http\Exception\MethodNotAllowedException',
|
|
|
|
'Cake\Network\Exception\NotAcceptableException' => 'Cake\Http\Exception\NotAcceptableException',
|
|
|
|
'Cake\Network\Exception\NotFoundException' => 'Cake\Http\Exception\NotFoundException',
|
|
|
|
'Cake\Network\Exception\NotImplementedException' => 'Cake\Http\Exception\NotImplementedException',
|
|
|
|
'Cake\Network\Exception\ServiceUnavailableException' => 'Cake\Http\Exception\ServiceUnavailableException',
|
|
|
|
'Cake\Network\Exception\UnauthorizedException' => 'Cake\Http\Exception\UnauthorizedException',
|
|
|
|
'Cake\Network\Exception\UnavailableForLegalReasonsException' => 'Cake\Http\Exception\UnavailableForLegalReasonsException',
|
|
|
|
'Cake\Network\Session' => 'Cake\Http\Session',
|
|
|
|
'Cake\Network\Session\DatabaseSession' => 'Cake\Http\Session\DatabaseSession',
|
|
|
|
'Cake\Network\Session\CacheSession' => 'Cake\Http\Session\CacheSession',
|
|
|
|
'Cake\Network\CorsBuilder' => 'Cake\Http\CorsBuilder',
|
|
|
|
'Cake\View\Widget\WidgetRegistry' => 'Cake\View\Widget\WidgetLocator',
|
|
|
|
],
|
|
|
|
]]);
|
2020-07-18 16:57:24 +00:00
|
|
|
};
|