Add rector rules for cakephp/authentication 4.x upgrade#370
Conversation
Adds rules to automate the 3.x to 4.x migration for the authentication plugin: - Rename CakeRouterUrlChecker to DefaultUrlChecker - Rename DefaultUrlChecker (framework-agnostic) to GenericUrlChecker - Rename Plugin to AuthenticationPlugin - Remove loadIdentifier() method calls See: cakephp/authentication#748
| 'Authentication\UrlChecker\DefaultUrlChecker' => 'Authentication\UrlChecker\StringUrlChecker', | ||
| // CakeRouterUrlChecker renamed to DefaultUrlChecker | ||
| 'Authentication\UrlChecker\CakeRouterUrlChecker' => 'Authentication\UrlChecker\DefaultUrlChecker', |
There was a problem hiding this comment.
If you run this more than once will all the UrlChecker references end up as StringUrlChecker?
There was a problem hiding this comment.
Yeah, that is not really idempotent right now
I dont have any great ideas other than: Marker comment
// @upgraded-authentication-4.0
use Authentication\UrlChecker\DefaultUrlChecker;
and then skip it.
This could be a bit difficult with inline usage of FQCN.
Alternative: file-level docblock
<?php
/**
* @rector-upgraded authentication40
*/
once we run it.
There was a problem hiding this comment.
Or: we just drop the old Default one rename.
And only rename the cake to default one.
No one outside of cake would use the upgrade tool here, and the few cases of people using the "external" over the cake router internal one would be almost irrelevant I assume.
There was a problem hiding this comment.
Skipping the rename on the existing default checker could work. I agree that there are likely few references to it in application code.
Summary
Adds rector rules to automate the Authentication plugin 3.x to 4.x migration:
Class renames:
Authentication\UrlChecker\CakeRouterUrlChecker→Authentication\UrlChecker\DefaultUrlCheckerAuthentication\UrlChecker\DefaultUrlChecker(framework-agnostic) →Authentication\UrlChecker\GenericUrlCheckerAuthentication\Plugin→Authentication\AuthenticationPluginMethod removal:
AuthenticationService::loadIdentifier()- removed in 4.xUsage
Or in custom rector config:
Not automated
Some changes require manual intervention and are documented in the upgrade guide:
CREDENTIAL_USERNAME/CREDENTIAL_PASSWORDmoved fromAbstractIdentifiertoPasswordIdentifier/LdapIdentifierRelated