Closed cosminardeleanu closed 8 months ago
Maybe it's a good idea that we remove Redis from the list of affected classes :grin:.
@cosminardeleanu you can fix it by removing the set list LARAVEL_FACADE_ALIASES_TO_FULL_NAMES
entirely, and add this rule instead:
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
...Facade::defaultAliases()->toArray(),
]);
If you're on the latest versions of Laravel this should work immediately, the default list does not include Redis.
Otherwise, if the defaultAliases()
method is not available in your project, you can use a hardcoded list where you would have even more control and add other custom classes as well:
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
'App' => 'Illuminate\Support\Facades\App',
'Arr' => 'Illuminate\Support\Arr',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
'Auth' => 'Illuminate\Support\Facades\Auth',
'Blade' => 'Illuminate\Support\Facades\Blade',
'Broadcast' => 'Illuminate\Support\Facades\Broadcast',
'Bus' => 'Illuminate\Support\Facades\Bus',
'Cache' => 'Illuminate\Support\Facades\Cache',
'Config' => 'Illuminate\Support\Facades\Config',
'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB',
'Model' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Gate' => 'Illuminate\Support\Facades\Gate',
'Hash' => 'Illuminate\Support\Facades\Hash',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Notification' => 'Illuminate\Support\Facades\Notification',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Session' => 'Illuminate\Support\Facades\Session',
'Storage' => 'Illuminate\Support\Facades\Storage',
'Str' => 'Illuminate\Support\Str',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
]);
Fixed by @GeniJaho in #160
Example code:
This
Redis $redis
gets replaced with\Illuminate\Support\Facades\Redis $redis
.Redis
is not the facade in this case.I have no proposition on how you should this, this is just a FYI.