Issues (4)

bootstrap/cli.php (2 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
require_once './vendor/autoload.php';
6
7
$memcached = new \Memcached();
8
$memcached->addServer(getenv('MEMCACHE_HOST') ?: '127.0.0.1', getenv('MEMCACHE_PORT') ?: 11211);
0 ignored issues
show
It seems like getenv('MEMCACHE_PORT') ?: 11211 can also be of type string; however, parameter $port of Memcached::addServer() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

8
$memcached->addServer(getenv('MEMCACHE_HOST') ?: '127.0.0.1', /** @scrutinizer ignore-type */ getenv('MEMCACHE_PORT') ?: 11211);
Loading history...
9
$memcached->flush();
10
11
$redis = new \Redis();
12
$redis->pconnect(getenv('REDIS_HOST') ?: '127.0.0.1', getenv('REDIS_PORT') ?: 6379, 30);
0 ignored issues
show
It seems like getenv('REDIS_PORT') ?: 6379 can also be of type string; however, parameter $port of Redis::pconnect() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

12
$redis->pconnect(getenv('REDIS_HOST') ?: '127.0.0.1', /** @scrutinizer ignore-type */ getenv('REDIS_PORT') ?: 6379, 30);
Loading history...
13
$redis->flushAll();
14
15
$memcachedAdapter = RemotelyLiving\PHPCacheAdapter\SimpleCache\Memcached::create($memcached);
16
$redisAdapter = RemotelyLiving\PHPCacheAdapter\SimpleCache\Redis::create($redis);
17
$memoryAdapter = RemotelyLiving\PHPCacheAdapter\SimpleCache\Memory::create();
18
$chainAdapter = RemotelyLiving\PHPCacheAdapter\SimpleCache\Chain::create($memcachedAdapter, $redisAdapter, $memoryAdapter);
19
$cacheItemPool = RemotelyLiving\PHPCacheAdapter\CacheItemPool\CacheItemPool::createFromSimpleCache($chainAdapter);