Skip to content

Commit 2da238e

Browse files
committed
cs
1 parent 2b76751 commit 2da238e

File tree

9 files changed

+16
-24
lines changed

9 files changed

+16
-24
lines changed

src/Bridges/DatabaseTracy/ConnectionPanel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class ConnectionPanel implements Tracy\IBarPanel
3131
private float $totalTime = 0;
3232
private int $count = 0;
3333
private array $events = [];
34-
private Tracy\BlueScreen $blueScreen;
3534

3635

3736
public static function initialize(
@@ -58,10 +57,11 @@ public static function initialize(
5857
}
5958

6059

61-
public function __construct(Explorer $explorer, Tracy\BlueScreen $blueScreen)
62-
{
60+
public function __construct(
61+
Explorer $explorer,
62+
private readonly Tracy\BlueScreen $blueScreen,
63+
) {
6364
$explorer->onQuery[] = $this->logQuery(...);
64-
$this->blueScreen = $blueScreen;
6565
}
6666

6767

src/Database/Database.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public function setAutoCommit(bool $state): void
325325

326326
$this->autoCommit = $state;
327327
if (!$state && $this->connection) {
328-
$$this->beginTransaction();
328+
$this->beginTransaction();
329329
}
330330
}
331331

@@ -381,9 +381,9 @@ public function preprocess(string $sql, ...$params): array
381381
private function logOperation(\Closure $callback, SqlLiteral $query): Result
382382
{
383383
try {
384-
$time = microtime(true);
384+
$time = microtime(as_float: true);
385385
$result = $callback();
386-
$time = microtime(true) - $time;
386+
$time = microtime(as_float: true) - $time;
387387
} catch (DriverException $e) {
388388
$e = $this->convertException($e);
389389
Arrays::invoke($this->onQuery, $this, $e);

src/Database/Drivers/Accessory/LazyConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
final class LazyConnection implements Drivers\Connection
1616
{
1717
public function __construct(
18-
private \Closure $callback,
18+
private readonly \Closure $callback,
1919
) {
2020
}
2121

src/Database/Drivers/Engines/SQLiteEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public function getForeignKeys(string $table): array
237237

238238
public function convertToPhp(mixed $value, array $meta, TypeConverter $converter): mixed
239239
{
240-
return $converter->convertDateTime && in_array($meta['nativeType'], ['DATE', 'DATETIME'], true)
240+
return $converter->convertDateTime && in_array($meta['nativeType'], ['DATE', 'DATETIME'], strict: true)
241241
? (is_int($value) ? (new DateTime)->setTimestamp($value) : new DateTime($value))
242242
: $converter->convertToPhp($value, $meta);
243243
}

src/Database/Explorer.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
*/
2222
class Explorer extends Database
2323
{
24-
25-
2624
/** @internal */
2725
public function createActiveRow(Table\Selection $selection, array $row): Table\ActiveRow
2826
{

src/Database/Result.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
private readonly Explorer $explorer,
3131
private readonly SqlLiteral $query,
3232
private readonly ?Drivers\Result $result,
33-
private float $time,
33+
private readonly float $time,
3434
) {
3535
}
3636

src/Database/Table/GroupedSelection.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,9 @@
2020
*/
2121
class GroupedSelection extends Selection
2222
{
23-
/** referenced table */
24-
protected readonly Selection $refTable;
25-
2623
/** current assigned referencing array */
2724
protected mixed $refCacheCurrent;
2825

29-
/** grouping column name */
30-
protected readonly string $column;
31-
3226
/** primary key */
3327
protected int|string $active;
3428

@@ -39,11 +33,11 @@ class GroupedSelection extends Selection
3933
public function __construct(
4034
Explorer $explorer,
4135
string $tableName,
42-
string $column,
43-
Selection $refTable,
36+
/** grouping column name */
37+
protected readonly string $column,
38+
/** referenced table */
39+
protected readonly Selection $refTable,
4440
) {
45-
$this->refTable = $refTable;
46-
$this->column = $column;
4741
parent::__construct($explorer, $tableName);
4842
}
4943

src/Database/Table/Selection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ protected function getSpecificCacheKey(): string
669669

670670
/**
671671
* @internal
672-
* @param string|null column name or null to reload all columns
672+
* @param string|null $key column name or null to reload all columns
673673
* @return bool if selection requeried for more columns.
674674
*/
675675
public function accessColumn(?string $key, bool $selectColumn = true): bool

tests/Database/sqlsrv-loadFromFile.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ require __DIR__ . '/../bootstrap.php';
1414
$connection = connectToDB();
1515

1616
Assert::noError(
17-
fn() => Nette\Database\Helpers::loadFromFile($connection, __DIR__ . '/files/sqlsrv-loadFromFile.sql')
17+
fn() => Nette\Database\Helpers::loadFromFile($connection, __DIR__ . '/files/sqlsrv-loadFromFile.sql'),
1818
);

0 commit comments

Comments
 (0)