• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

brick / lock / 17475241346

04 Sep 2025 07:59PM UTC coverage: 5.5%. Remained the same
17475241346

push

github

BenMorel
Apply coding standard

11 of 200 relevant lines covered (5.5%)

3.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Database/Connection/DoctrineConnection.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\Lock\Database\Connection;
6

7
use Brick\Lock\Database\ConnectionInterface;
8
use Brick\Lock\Database\QueryException;
9
use Doctrine\DBAL\Connection;
10
use Doctrine\DBAL\Exception;
11
use Override;
12

13
use function count;
14
use function sprintf;
15

16
/**
17
 * Wraps a Doctrine DBAL connection.
18
 */
19
final readonly class DoctrineConnection implements ConnectionInterface
20
{
21
    public function __construct(
22
        private Connection $connection,
23
    ) {
24
    }
×
25

26
    #[Override]
27
    public function querySingleValue(string $sql, array $params = []): mixed
28
    {
29
        try {
30
            $rows = $this->connection->fetchAllNumeric($sql, $params);
×
31
        } catch (Exception $e) {
×
32
            throw new QueryException(sprintf('An error occurred while executing the query "%s"', $sql), $e);
×
33
        }
34

35
        if (count($rows) !== 1) {
×
36
            throw new QueryException(sprintf('Query "%s" returned %d rows, expected 1.', $sql, count($rows)));
×
37
        }
38

39
        $columns = $rows[0];
×
40

41
        if (count($columns) !== 1) {
×
42
            throw new QueryException(sprintf('Query "%s" returned %d columns, expected 1.', $sql, count($columns)));
×
43
        }
44

45
        /** @var scalar|null */
46
        return $columns[0];
×
47
    }
48

49
    #[Override]
50
    public function beginTransaction(): void
51
    {
52
        $this->connection->beginTransaction();
×
53
    }
54

55
    #[Override]
56
    public function commit(): void
57
    {
58
        $this->connection->commit();
×
59
    }
60

61
    #[Override]
62
    public function rollBack(): void
63
    {
64
        $this->connection->rollBack();
×
65
    }
66
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc