1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-14 12:44:03 +00:00

get down to 59 phpstan errors

This commit is contained in:
Samuel Štancl 2022-09-29 22:20:55 +02:00
parent 193e044777
commit a94227a19c
26 changed files with 130 additions and 130 deletions

View file

@ -22,18 +22,21 @@ class RedisTenancyBootstrapper implements TenancyBootstrapper
$this->config = $config;
}
public function bootstrap(Tenant $tenant)
public function bootstrap(Tenant $tenant): void
{
foreach ($this->prefixedConnections() as $connection) {
$prefix = $this->config['tenancy.redis.prefix_base'] . $tenant->getTenantKey();
$client = Redis::connection($connection)->client();
$this->originalPrefixes[$connection] = $client->getOption($client::OPT_PREFIX);
/** @var string $originalPrefix */
$originalPrefix = $client->getOption($client::OPT_PREFIX);
$this->originalPrefixes[$connection] = $originalPrefix;
$client->setOption($client::OPT_PREFIX, $prefix);
}
}
public function revert()
public function revert(): void
{
foreach ($this->prefixedConnections() as $connection) {
$client = Redis::connection($connection)->client();
@ -44,7 +47,8 @@ class RedisTenancyBootstrapper implements TenancyBootstrapper
$this->originalPrefixes = [];
}
protected function prefixedConnections()
/** @return string[] */
protected function prefixedConnections(): array
{
return $this->config['tenancy.redis.prefixed_connections'];
}