GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 1144b4...828920 )
by Márk
07:09 queued 04:40
created

Driver::info()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace Bernard\Driver\Predis;
4
5
use Predis\ClientInterface;
6
7
/**
8
 * @package Bernard
9
 */
10
final class Driver extends \Bernard\Driver\PhpRedis\Driver
11
{
12
    /**
13
     * @param ClientInterface $redis
14
     */
15
    public function __construct(ClientInterface $redis)
16
    {
17
        $this->redis = $redis;
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function popMessage($queueName, $duration = 5)
24
    {
25
        list(, $message) = $this->redis->blpop($this->resolveKey($queueName), $duration) ?: null;
0 ignored issues
show
Bug introduced by
The method blpop does only exist in Redis, but not in Predis\ClientInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
26
27
        return [$message, null];
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function info()
34
    {
35
        // Temporarily change the command use to get info as earlier and newer redis
36
        // versions breaks it into sections.
37
        $commandClass = $this->redis->getProfile()->getCommandClass('info');
0 ignored issues
show
Bug introduced by
The method getProfile does only exist in Predis\ClientInterface, but not in Redis.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
38
        $this->redis->getProfile()->defineCommand('info', 'Predis\Command\ServerInfo');
39
40
        $info = $this->redis->info();
0 ignored issues
show
Bug introduced by
The method info does only exist in Redis, but not in Predis\ClientInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
41
42
        $this->redis->getProfile()->defineCommand('info', $commandClass);
43
44
        return $info;
45
    }
46
}
47