|
| 1 | +<?php |
| 2 | +declare(strict_types=1); |
| 3 | + |
| 4 | +use Cake\Upgrade\Rector\Rector\MethodCall\RemoveMethodCallRector; |
| 5 | +use Cake\Upgrade\Rector\ValueObject\RemoveMethodCall; |
| 6 | +use Rector\Config\RectorConfig; |
| 7 | +use Rector\Renaming\Rector\Name\RenameClassRector; |
| 8 | + |
| 9 | +/** |
| 10 | + * @see https://github.com/cakephp/authentication/blob/4.x/docs/en/upgrade-3-to-4.rst |
| 11 | + */ |
| 12 | +return static function (RectorConfig $rectorConfig): void { |
| 13 | + // URL checker class renames |
| 14 | + // Note: Order matters - StringUrlChecker rename must come first to avoid |
| 15 | + // CakeRouterUrlChecker -> DefaultUrlChecker -> StringUrlChecker chain |
| 16 | + $rectorConfig->ruleWithConfiguration(RenameClassRector::class, [ |
| 17 | + // Old DefaultUrlChecker renamed to StringUrlChecker |
| 18 | + 'Authentication\UrlChecker\DefaultUrlChecker' => 'Authentication\UrlChecker\StringUrlChecker', |
| 19 | + // CakeRouterUrlChecker renamed to DefaultUrlChecker |
| 20 | + 'Authentication\UrlChecker\CakeRouterUrlChecker' => 'Authentication\UrlChecker\DefaultUrlChecker', |
| 21 | + // Plugin class renamed |
| 22 | + 'Authentication\Plugin' => 'Authentication\AuthenticationPlugin', |
| 23 | + ]); |
| 24 | + |
| 25 | + // Remove loadIdentifier() method calls from AuthenticationService |
| 26 | + $rectorConfig->ruleWithConfiguration(RemoveMethodCallRector::class, [ |
| 27 | + new RemoveMethodCall('Authentication\AuthenticationService', 'loadIdentifier'), |
| 28 | + new RemoveMethodCall('Authentication\AuthenticationServiceInterface', 'loadIdentifier'), |
| 29 | + ]); |
| 30 | +}; |
0 commit comments