for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace PublishingKit\Cache\Factories;
use Psr\Cache\CacheItemPoolInterface;
use PublishingKit\Cache\Contracts\Factories\CacheFactory;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\ApcuAdapter;
final class SymfonyCacheFactory implements CacheFactory
{
public function make(array $config): CacheItemPoolInterface
return $this->createAdapter($config);
}
private function createAdapter(array $config): CacheItemPoolInterface
if (!isset($config['driver'])) {
$config['driver'] = 'filesystem';
switch ($config['driver']) {
case 'array':
$driver = $this->createArrayAdapter($config);
break;
case 'apcu':
$driver = $this->createApcuAdapter($config);
default:
$driver = $this->createFilesystemAdapter($config);
return $driver;
private function createFilesystemAdapter(array $config): FilesystemAdapter
$config
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
private function createFilesystemAdapter(/** @scrutinizer ignore-unused */ array $config): FilesystemAdapter
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return new FilesystemAdapter();
private function createArrayAdapter(array $config): ArrayAdapter
private function createArrayAdapter(/** @scrutinizer ignore-unused */ array $config): ArrayAdapter
return new ArrayAdapter();
private function createApcuAdapter(array $config): ApcuAdapter
private function createApcuAdapter(/** @scrutinizer ignore-unused */ array $config): ApcuAdapter
return new ApcuAdapter();
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.