Skip to content

Commit a96a0d7

Browse files
committed
Connection::getDsn() deprecated (BC break)
1 parent a0ba636 commit a96a0d7

File tree

6 files changed

+6
-8
lines changed

6 files changed

+6
-8
lines changed

src/Bridges/DatabaseTracy/dist/panel.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ declare(strict_types=1);
1010
#tracy-debug td.nette-DbConnectionPanel-sql-update { background: #E7FBFF !important }
1111
</style>
1212

13-
<h1 title="<?= Tracy\Helpers::escapeHtml($connection->getDsn()) ?>
14-
">Queries: <?= Tracy\Helpers::escapeHtml($count) ?>
13+
<h1>Queries: <?= Tracy\Helpers::escapeHtml($count) ?>
1514
<?= Tracy\Helpers::escapeHtml($totalTime ? sprintf(', time: %0.3f ms', $totalTime * 1000) : '') ?>
1615
, <?= Tracy\Helpers::escapeHtml($name) ?>
1716
</h1>

src/Bridges/DatabaseTracy/panel.latte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#tracy-debug td.nette-DbConnectionPanel-sql-update { background: #E7FBFF !important }
88
</style>
99

10-
<h1 title="{$connection->getDsn()}">Queries: {$count}{$totalTime ? sprintf(', time: %0.3f ms', $totalTime * 1000) : ''}, {$name}</h1>
10+
<h1>Queries: {$count}{$totalTime ? sprintf(', time: %0.3f ms', $totalTime * 1000) : ''}, {$name}</h1>
1111

1212
<div class="tracy-inner" style="min-width: 600px">
1313
<table class="tracy-sortable">

src/Database/Connection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Connection
4646

4747

4848
public function __construct(
49-
private readonly string $dsn,
49+
string $dsn,
5050
?string $username = null,
5151
#[\SensitiveParameter]
5252
?string $password = null,
@@ -109,9 +109,10 @@ public function disconnect(): void
109109
}
110110

111111

112+
/** @deprecated */
112113
public function getDsn(): string
113114
{
114-
return $this->dsn;
115+
throw new Nette\DeprecatedException(__METHOD__ . '() is deprecated.');
115116
}
116117

117118

tests/Database.DI/DatabaseExtension.basic.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ test('', function () {
3838

3939
$connection = $container->getService('database.default');
4040
Assert::type(Nette\Database\Connection::class, $connection);
41-
Assert::same('sqlite::memory:', $connection->getDsn());
4241

4342
$explorer = $container->getService('database.default.explorer');
4443
Assert::type(Nette\Database\Explorer::class, $explorer);

tests/Database.DI/DatabaseExtension.multiple.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ test('', function () {
4444
$connection = $container->getService('database.first');
4545
Assert::type(Nette\Database\Connection::class, $connection);
4646
Assert::same($connection, $container->getByType(Nette\Database\Connection::class));
47-
Assert::same('sqlite::memory:', $connection->getDsn());
4847

4948
$explorer = $container->getService('database.first.explorer');
5049
Assert::type(Nette\Database\Explorer::class, $explorer);

tests/Database.Tracy/panel.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
%A%
2-
<h1 title="sqlite::memory:">Queries: 4, time: %a% ms, foo</h1>
2+
<h1>Queries: 4, time: %a% ms, foo</h1>
33

44
<div class="tracy-inner" style="min-width: 600px">
55
<table class="tracy-sortable">

0 commit comments

Comments
 (0)