From fa0ddf9fd8dbd894c7f06a929c30755961113260 Mon Sep 17 00:00:00 2001 From: Mischa Braam Date: Mon, 19 Feb 2024 13:18:38 +0100 Subject: [PATCH] Rename Redis class to RedisService (#631) .. to avoid class collision with native Redis --- cli/ValetPlus/DriverConfigurator.php | 6 ++--- cli/ValetPlus/Extended/Status.php | 8 +++---- cli/ValetPlus/{Redis.php => RedisService.php} | 5 ++++- cli/includes/facades.php | 2 +- cli/valet.php | 22 +++++++++---------- 5 files changed, 23 insertions(+), 20 deletions(-) rename cli/ValetPlus/{Redis.php => RedisService.php} (88%) diff --git a/cli/ValetPlus/DriverConfigurator.php b/cli/ValetPlus/DriverConfigurator.php index 47b43bfe..5baa793e 100644 --- a/cli/ValetPlus/DriverConfigurator.php +++ b/cli/ValetPlus/DriverConfigurator.php @@ -19,20 +19,20 @@ class DriverConfigurator protected $files; /** @var Site */ protected $site; - /** @var Redis */ + /** @var RedisService */ protected $redis; /** * @param CommandLine $cli * @param Filesystem $files * @param Site $site - * @param Redis $redis + * @param RedisService $redis */ public function __construct( CommandLine $cli, Filesystem $files, Site $site, - Redis $redis + RedisService $redis ) { $this->cli = $cli; $this->files = $files; diff --git a/cli/ValetPlus/Extended/Status.php b/cli/ValetPlus/Extended/Status.php index 35c63198..1c71391b 100644 --- a/cli/ValetPlus/Extended/Status.php +++ b/cli/ValetPlus/Extended/Status.php @@ -12,7 +12,7 @@ use WeProvide\ValetPlus\Mailhog; use WeProvide\ValetPlus\Mysql; use WeProvide\ValetPlus\Rabbitmq; -use WeProvide\ValetPlus\Redis; +use WeProvide\ValetPlus\RedisService; use WeProvide\ValetPlus\Varnish; class Status extends ValetStatus @@ -23,7 +23,7 @@ class Status extends ValetStatus protected $mailhog; /** @var Varnish */ protected $varnish; - /** @var Redis */ + /** @var RedisService */ protected $redis; /** @var Rabbitmq */ protected $rabbitmq; @@ -36,7 +36,7 @@ class Status extends ValetStatus * @param Mysql $mysql * @param Mailhog $mailhog * @param Varnish $varnish - * @param Redis $redis + * @param RedisService $redis * @param Rabbitmq $rabbitmq */ public function __construct( @@ -47,7 +47,7 @@ public function __construct( Mysql $mysql, Mailhog $mailhog, Varnish $varnish, - Redis $redis, + RedisService $redis, Rabbitmq $rabbitmq ) { parent::__construct($config, $brew, $cli, $files); diff --git a/cli/ValetPlus/Redis.php b/cli/ValetPlus/RedisService.php similarity index 88% rename from cli/ValetPlus/Redis.php rename to cli/ValetPlus/RedisService.php index 5351e31f..c1e55796 100644 --- a/cli/ValetPlus/Redis.php +++ b/cli/ValetPlus/RedisService.php @@ -6,7 +6,10 @@ use function Valet\info; -class Redis extends AbstractService +/** + * We name this class RedisService to avoid class collision when `shivammathur/extensions/redis@8.1` is installed. + */ +class RedisService extends AbstractService { /** @var string */ protected const SERVICE_NAME = 'redis'; diff --git a/cli/includes/facades.php b/cli/includes/facades.php index 472e53e2..f33efdf5 100644 --- a/cli/includes/facades.php +++ b/cli/includes/facades.php @@ -41,7 +41,7 @@ class Elasticsearch extends ValetPlusFacade class Varnish extends ValetPlusFacade { } -class Redis extends ValetPlusFacade +class RedisService extends ValetPlusFacade { } class Rabbitmq extends ValetPlusFacade diff --git a/cli/valet.php b/cli/valet.php index 4b237b6a..7899a6cc 100755 --- a/cli/valet.php +++ b/cli/valet.php @@ -119,7 +119,7 @@ Mysql::restart(); Mailhog::restart(); Varnish::restart(); - Redis::restart(); + RedisService::restart(); Rabbitmq::restart(); break; case 'mysql': @@ -135,7 +135,7 @@ return info('Varnish has been started.'); case 'redis': - Redis::restart(); + RedisService::restart(); return info('Redis has been started.'); case 'rabbitmq': @@ -157,7 +157,7 @@ Mysql::restart(); Mailhog::restart(); Varnish::restart(); - Redis::restart(); + RedisService::restart(); Rabbitmq::restart(); break; case 'mysql': @@ -173,7 +173,7 @@ return info('Varnish has been restarted.'); case 'redis': - Redis::restart(); + RedisService::restart(); return info('Redis has been restarted.'); case 'rabbitmq': @@ -195,7 +195,7 @@ Mysql::stop(); Mailhog::stop(); Varnish::stop(); - Redis::stop(); + RedisService::stop(); Rabbitmq::stop(); break; case 'mysql': @@ -211,7 +211,7 @@ return info('Varnish has been stopped.'); case 'redis': - Redis::stop(); + RedisService::stop(); return info('Redis has been stopped.'); case 'rabbitmq': @@ -246,7 +246,7 @@ info('Removing varnish...'); Varnish::uninstall(); info('Removing redis...'); - Redis::uninstall(); + RedisService::uninstall(); info('Removing rabbitmq...'); Rabbitmq::uninstall(); info('Removing elasticsearch...'); @@ -347,21 +347,21 @@ switch ($mode) { case 'install': - Redis::install(); + RedisService::install(); break; case 'enable': case 'on': - Redis::enable(); + RedisService::enable(); break; case 'disable': case 'off': - Redis::disable(); + RedisService::disable(); break; case 'uninstall': - Redis::uninstall(); + RedisService::uninstall(); break; }