Completed
Push — master ( 8c259e...a3e53b )
by Guilherme
27:10 queued 12:02
created

DatabasePlatformMock::setPrefersIdentityColumns()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\Mocks;
6
7
use Doctrine\DBAL\Platforms\AbstractPlatform;
8
9
/**
10
 * Mock class for DatabasePlatform.
11
 */
12
class DatabasePlatformMock extends AbstractPlatform
13
{
14
    /** @var string */
15
    private $sequenceNextValSql = '';
16
17
    /** @var bool */
18
    private $prefersIdentityColumns = true;
19
20
    /** @var bool */
21
    private $prefersSequences = false;
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function prefersIdentityColumns() : bool
27
    {
28
        return $this->prefersIdentityColumns;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function prefersSequences() : bool
35
    {
36
        return $this->prefersSequences;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getSequenceNextValSQL($sequenceName) : string
43
    {
44
        return $this->sequenceNextValSql;
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getBooleanTypeDeclarationSQL(array $columnDef) : string
51
    {
52
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function getIntegerTypeDeclarationSQL(array $columnDef) : string
58
    {
59
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function getBigIntTypeDeclarationSQL(array $columnDef) : string
65
    {
66
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function getSmallIntTypeDeclarationSQL(array $columnDef) : string
72
    {
73
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
74
75
    /**
76
     * {@inheritdoc}
77
     */
78
    protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) : string
79
    {
80
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
81
82
    /**
83
     * {@inheritdoc}
84
     */
85
    public function getVarcharTypeDeclarationSQL(array $columnDef) : string
86
    {
87
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
88
89
    /**
90
     * {@inheritdoc}
91
     */
92
    public function getBlobTypeDeclarationSQL(array $columnDef) : string
93
    {
94
        throw DBALException::notSupported(__METHOD__);
0 ignored issues
show
Bug introduced by
The type Doctrine\Tests\Mocks\DBALException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
95
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100
    public function getClobTypeDeclarationSQL(array $columnDef) : string
101
    {
102
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
103
104
    /* MOCK API */
105
106
    /**
107
     * @param bool $bool
108
     *
109
     * @return void
110
     */
111
    public function setPrefersIdentityColumns($bool)
112
    {
113
        $this->prefersIdentityColumns = $bool;
114
    }
115
116
    /**
117
     * @param bool $bool
118
     *
119
     * @return void
120
     */
121
    public function setPrefersSequences($bool)
122
    {
123
        $this->prefersSequences = $bool;
124
    }
125
126
    /**
127
     * @param string $sql
128
     *
129
     * @return void
130
     */
131
    public function setSequenceNextValSql($sql)
132
    {
133
        $this->sequenceNextValSql = $sql;
134
    }
135
136
    /**
137
     * {@inheritdoc}
138
     */
139
    public function getName() : string
140
    {
141
        return 'mock';
142
    }
143
144
    /**
145
     * {@inheritdoc}
146
     */
147
    public function getCurrentDatabaseExpression() : string
148
    {
149
        return '';
150
    }
151
152
    /**
153
     * {@inheritdoc}
154
     */
155
    protected function initializeDoctrineTypeMappings() : void
156
    {
157
    }
158
}
159