Skip to content

Commit

Permalink
Rename Redis class to RedisService (#631)
Browse files Browse the repository at this point in the history
.. to avoid class collision with native Redis
  • Loading branch information
mischabraam committed Feb 19, 2024
1 parent 6cf2403 commit fa0ddf9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
6 changes: 3 additions & 3 deletions cli/ValetPlus/DriverConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions cli/ValetPlus/Extended/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,7 +23,7 @@ class Status extends ValetStatus
protected $mailhog;
/** @var Varnish */
protected $varnish;
/** @var Redis */
/** @var RedisService */
protected $redis;
/** @var Rabbitmq */
protected $rabbitmq;
Expand All @@ -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(
Expand All @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion cli/ValetPlus/Redis.php → cli/ValetPlus/RedisService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

use function Valet\info;

class Redis extends AbstractService
/**
* We name this class RedisService to avoid class collision when `shivammathur/extensions/[email protected]` is installed.
*/
class RedisService extends AbstractService
{
/** @var string */
protected const SERVICE_NAME = 'redis';
Expand Down
2 changes: 1 addition & 1 deletion cli/includes/facades.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Elasticsearch extends ValetPlusFacade
class Varnish extends ValetPlusFacade
{
}
class Redis extends ValetPlusFacade
class RedisService extends ValetPlusFacade
{
}
class Rabbitmq extends ValetPlusFacade
Expand Down
22 changes: 11 additions & 11 deletions cli/valet.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
Mysql::restart();
Mailhog::restart();
Varnish::restart();
Redis::restart();
RedisService::restart();
Rabbitmq::restart();
break;
case 'mysql':
Expand All @@ -135,7 +135,7 @@

return info('Varnish has been started.');
case 'redis':
Redis::restart();
RedisService::restart();

return info('Redis has been started.');
case 'rabbitmq':
Expand All @@ -157,7 +157,7 @@
Mysql::restart();
Mailhog::restart();
Varnish::restart();
Redis::restart();
RedisService::restart();
Rabbitmq::restart();
break;
case 'mysql':
Expand All @@ -173,7 +173,7 @@

return info('Varnish has been restarted.');
case 'redis':
Redis::restart();
RedisService::restart();

return info('Redis has been restarted.');
case 'rabbitmq':
Expand All @@ -195,7 +195,7 @@
Mysql::stop();
Mailhog::stop();
Varnish::stop();
Redis::stop();
RedisService::stop();
Rabbitmq::stop();
break;
case 'mysql':
Expand All @@ -211,7 +211,7 @@

return info('Varnish has been stopped.');
case 'redis':
Redis::stop();
RedisService::stop();

return info('Redis has been stopped.');
case 'rabbitmq':
Expand Down Expand Up @@ -246,7 +246,7 @@
info('Removing varnish...');
Varnish::uninstall();
info('Removing redis...');
Redis::uninstall();
RedisService::uninstall();
info('Removing rabbitmq...');
Rabbitmq::uninstall();
info('Removing elasticsearch...');
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit fa0ddf9

Please sign in to comment.