src/Options/DBALConnection.php
changed.
Other files ignored by Codecov
tests/Assets/Entity/TargetEntity.php
has changed.
psalm.xml
has changed.
tests/Assets/Entity/EntityWithoutRepository.php
has changed.
11 | 11 | use DoctrineORMModule\Options\DBALConnection; |
|
12 | 12 | use Interop\Container\ContainerInterface; |
|
13 | 13 | use Laminas\ServiceManager\ServiceLocatorInterface; |
|
14 | + | use PDO; |
|
14 | 15 | ||
15 | 16 | use function array_key_exists; |
|
16 | 17 | use function array_merge; |
35 | 36 | ||
36 | 37 | if (is_string($pdo)) { |
|
37 | 38 | $pdo = $serviceLocator->get($pdo); |
|
39 | + | assert($pdo instanceof PDO); |
|
38 | 40 | } |
|
39 | 41 | ||
40 | 42 | $params = [ |
55 | 57 | $configuration = $serviceLocator->get($options->getConfiguration()); |
|
56 | 58 | $eventManager = $serviceLocator->get($options->getEventManager()); |
|
57 | 59 | ||
60 | + | /** @psalm-suppress InvalidArgument */ |
|
58 | 61 | $connection = DriverManager::getConnection($params, $configuration, $eventManager); |
|
59 | 62 | foreach ($options->getDoctrineTypeMappings() as $dbType => $doctrineType) { |
|
60 | 63 | $connection->getDatabasePlatform()->registerDoctrineTypeMapping($dbType, $doctrineType); |
4 | 4 | ||
5 | 5 | namespace DoctrineORMModule\Options; |
|
6 | 6 | ||
7 | - | use Doctrine\DBAL\Driver\PDO\MySQL\Driver; |
|
7 | + | use Doctrine\DBAL\Connection; |
|
8 | + | use Doctrine\DBAL\Driver; |
|
9 | + | use Doctrine\DBAL\Driver\PDO\MySQL\Driver as PDOMySQLDriver; |
|
8 | 10 | use Laminas\Stdlib\AbstractOptions; |
|
9 | 11 | use PDO; |
|
10 | 12 |
45 | 47 | * |
|
46 | 48 | * @var string |
|
47 | 49 | */ |
|
48 | - | protected $driverClass = Driver::class; |
|
50 | + | protected $driverClass = PDOMySQLDriver::class; |
|
49 | 51 | ||
50 | 52 | /** |
|
51 | 53 | * Set the wrapper class for the driver. In general, this should not |
146 | 148 | $this->driverClass = $driverClass; |
|
147 | 149 | } |
|
148 | 150 | ||
151 | + | /** |
|
152 | + | * @return class-string<Driver>|null |
|
153 | + | */ |
|
149 | 154 | public function getDriverClass(): ?string |
|
150 | 155 | { |
|
151 | 156 | return $this->driverClass; |
172 | 177 | $this->wrapperClass = $wrapperClass; |
|
173 | 178 | } |
|
174 | 179 | ||
180 | + | /** |
|
181 | + | * @return class-string<Connection>|null |
|
182 | + | */ |
|
175 | 183 | public function getWrapperClass(): ?string |
|
176 | 184 | { |
|
177 | 185 | return $this->wrapperClass; |
Files | Coverage |
---|---|
src | 84.06% |
Project Totals (32 files) | 84.06% |