Failed Conditions
Pull Request — master (#32)
by Timon
03:20
created

Ordening::asc()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\Query;
5
6
use TBolier\RethinkQL\Message\MessageInterface;
7
use TBolier\RethinkQL\RethinkInterface;
8
use TBolier\RethinkQL\Types\Term\TermType;
9
10
class Ordening extends AbstractQuery implements OrdeningInterface
11
{
12
    /**
13
     * @var QueryInterface
14
     */
15
    private $query;
16
17
    /**
18
     * @param string $key
19
     * @param RethinkInterface $rethink
20
     * @param MessageInterface $message
21
     */
22
    public function __construct(string $key, RethinkInterface $rethink, MessageInterface $message)
23
    {
24
        parent::__construct($rethink, $message);
25
26
        $this->asc($key);
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function asc(string $key): OrdeningInterface
33
    {
34
        $this->query = [
0 ignored issues
show
Documentation Bug introduced by
It seems like array(TBolier\RethinkQL\...Type::ASC, array($key)) of type array<integer,array<integer,string>|integer> is incompatible with the declared type TBolier\RethinkQL\Query\QueryInterface of property $query.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
35
            TermType::ASC,
36
            [
37
                $key,
38
            ],
39
        ];
40
41
        return $this;
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    public function desc(string $key): OrdeningInterface
48
    {
49
        $this->query = [
0 ignored issues
show
Documentation Bug introduced by
It seems like array(TBolier\RethinkQL\...ype::DESC, array($key)) of type array<integer,array<integer,string>|integer> is incompatible with the declared type TBolier\RethinkQL\Query\QueryInterface of property $query.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
50
            TermType::DESC,
51
            [
52
                $key,
53
            ],
54
        ];
55
56
        return $this;
57
    }
58
59
    /**
60
     * @inheritdoc
61
     */
62
    public function toArray(): array
63
    {
64
        return $this->query;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->query returns the type TBolier\RethinkQL\Query\QueryInterface which is incompatible with the type-hinted return array.
Loading history...
65
    }
66
}
67