Skip to content

Commit a208850

Browse files
committed
Connection::getDsn() deprecated (BC break)
1 parent 4761023 commit a208850

File tree

5 files changed

+5
-6
lines changed

5 files changed

+5
-6
lines changed

src/Bridges/DatabaseTracy/templates/ConnectionPanel.panel.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use Tracy\Helpers;
1616
#tracy-debug td.nette-DbConnectionPanel-sql-update { background: #E7FBFF !important }
1717
</style>
1818

19-
<h1 title="<?= Helpers::escapeHtml($connection->getDsn()) ?>">Queries: <?php
19+
<h1>Queries: <?php
2020
echo $count, ($totalTime ? sprintf(', time: %0.3f ms', $totalTime * 1000) : ''), ', ', Helpers::escapeHtml($name) ?></h1>
2121

2222
<div class="tracy-inner">

src/Database/Connection.php

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

4646

4747
public function __construct(
48-
private readonly string $dsn,
48+
string $dsn,
4949
?string $username = null,
5050
#[\SensitiveParameter]
5151
?string $password = null,
@@ -108,9 +108,10 @@ public function disconnect(): void
108108
}
109109

110110

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

116117

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">
55
<div class="tracy-inner-container">

0 commit comments

Comments
 (0)