ConnectionConfig::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 6
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of Cycle Database package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Cycle\Database\Config\MySQL;
13
14
use Cycle\Database\Config\PDOConnectionConfig as BaseConnectionConfig;
15
16
/**
17
 * @psalm-import-type PDOFlag from BaseConnectionConfig
18
 */
19
abstract class ConnectionConfig extends BaseConnectionConfig
20
{
21
    /**
22
     * General driver specific PDO options.
23
     *
24
     * @var array<PDOFlag, mixed>
25
     */
26
    protected const DEFAULT_PDO_OPTIONS = [
27
        \PDO::ATTR_CASE               => \PDO::CASE_NATURAL,
28
        \PDO::ATTR_ERRMODE            => \PDO::ERRMODE_EXCEPTION,
29
        // TODO Should be moved into common driver settings.
30
        \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "UTF8"',
31
        \PDO::ATTR_STRINGIFY_FETCHES  => false,
32
    ];
33
34
    /**
35
     * @param non-empty-string|null $user
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string|null at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string|null.
Loading history...
36
     * @param non-empty-string|null $password
37
     * @param array<int, non-empty-string|non-empty-string> $options
38
     */
39 4
    public function __construct(
40
        ?string $user = null,
41
        ?string $password = null,
42
        array $options = [],
43
    ) {
44 4
        parent::__construct($user, $password, $options);
45 4
    }
46
47
    public function getName(): string
48
    {
49
        return 'mysql';
50 8
    }
51
}
52