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
![]() |
|||
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 |