RedisArrayThrottleTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 6
c 1
b 0
f 0
dl 0
loc 16
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createConnection() 0 3 1
A setUpBeforeClass() 0 8 3
1
<?php
2
3
namespace Zenstruck\Governator\Tests\Integration\Redis;
4
5
/**
6
 * @requires extension redis
7
 * @group time-sensitive
8
 *
9
 * @author Kevin Bond <[email protected]>
10
 */
11
final class RedisArrayThrottleTest extends BaseRedisThrottleTest
12
{
13
    public static function setUpBeforeClass(): void
14
    {
15
        if (!\class_exists('RedisArray')) {
16
            self::markTestSkipped('The RedisArray class is required.');
17
        }
18
19
        if (!\getenv('REDIS_HOST')) {
20
            self::markTestSkipped('REDIS_HOST not configured.');
21
        }
22
    }
23
24
    protected function createConnection(): object
25
    {
26
        return new \RedisArray([\getenv('REDIS_HOST')]);
0 ignored issues
show
Bug introduced by
array(getenv('REDIS_HOST')) of type array<integer,string> is incompatible with the type string expected by parameter $name of RedisArray::__construct(). ( Ignorable by Annotation )

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

26
        return new \RedisArray(/** @scrutinizer ignore-type */ [\getenv('REDIS_HOST')]);
Loading history...
27
    }
28
}
29