Skip to content

Commit

Permalink
Start ruleset for CakePHP 4.2 (#4526)
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 31, 2020
1 parent 2c5693c commit 4d2a0e7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions config/set/cakephp42.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use function Rector\SymfonyPhpConfig\inline_value_objects;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

# source: https://book.cakephp.org/4/en/appendices/4-2-migration-guide.html
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
'Cake\Core\Exception\Exception' => 'Cake\Core\Exception\CakeException',
'Cake\Database\Exception' => 'Cake\Database\Exception\DatabaseException',
],
],
]);

$services->set(RenameMethodRector::class)
->call('configure', [[
RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([
new MethodCallRename('Cake\ORM\Behavior', 'getTable', 'table'),
]),
]]);
};

0 comments on commit 4d2a0e7

Please sign in to comment.