Skip to content

Commit 4f25cc1

Browse files
committed
fixed bugs reported by PHPStan
1 parent f67b12f commit 4f25cc1

File tree

8 files changed

+14
-13
lines changed

8 files changed

+14
-13
lines changed

src/Bridges/DatabaseDI/DatabaseExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private function setupDatabase(\stdClass $config, string $name): void
106106
->setAutowired($config->autowired);
107107

108108
} else {
109-
$conventions = Nette\DI\Config\Processor::processArguments([$config['conventions']])[0];
109+
$conventions = Nette\DI\Helpers::filterArguments([$config->conventions])[0];
110110
}
111111

112112
$builder->addDefinition($this->prefix("$name.context"))

src/Bridges/DatabaseTracy/ConnectionPanel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ConnectionPanel implements Tracy\IBarPanel
3434
/** @var bool */
3535
public $disabled = false;
3636

37-
/** @var int logged time */
37+
/** @var float logged time */
3838
private $totalTime = 0;
3939

4040
/** @var int */

src/Database/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Connection
3939
/** @var SqlPreprocessor */
4040
private $preprocessor;
4141

42-
/** @var PDO */
42+
/** @var PDO|null */
4343
private $pdo;
4444

4545
/** @var string|null */
@@ -199,7 +199,7 @@ public function getLastQueryString(): ?string
199199
/**
200200
* Shortcut for query()->fetch()
201201
*/
202-
public function fetch(string $sql, ...$params): ?Row
202+
public function fetch(string $sql, ...$params): ?IRow
203203
{
204204
return $this->query($sql, ...$params)->fetch();
205205
}

src/Database/Context.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function getConventions(): IConventions
111111
/**
112112
* Shortcut for query()->fetch()
113113
*/
114-
public function fetch(string $sql, ...$params): ?Row
114+
public function fetch(string $sql, ...$params): ?IRow
115115
{
116116
return $this->connection->query($sql, ...$params)->fetch();
117117
}

src/Database/ResultSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ResultSet implements \Iterator, IRowContainer
2626
/** @var \PDOStatement|null */
2727
private $pdoStatement;
2828

29-
/** @var IRow */
29+
/** @var IRow|false */
3030
private $result;
3131

3232
/** @var int */

src/Database/SqlPreprocessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class SqlPreprocessor
6060
/** @var bool */
6161
private $useParams;
6262

63-
/** @var string values|set|and|order */
63+
/** @var string|null values|set|and|order */
6464
private $arrayMode;
6565

6666

src/Database/Table/ActiveRow.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function __toString()
6262
throw $e;
6363
}
6464
trigger_error('Exception in ' . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
65+
return '';
6566
}
6667
}
6768

src/Database/Table/Selection.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,23 @@ class Selection implements \Iterator, IRowContainer, \ArrayAccess, \Countable
5858
/** @var mixed */
5959
protected $refCache;
6060

61-
/** @var string */
61+
/** @var string|null */
6262
protected $generalCacheKey;
6363

64-
/** @var string */
64+
/** @var string|null */
6565
protected $specificCacheKey;
6666

6767
/** @var array of [conditions => [key => IRow]]; used by GroupedSelection */
6868
protected $aggregation = [];
6969

70-
/** @var array of touched columns */
70+
/** @var array|false|null of touched columns */
7171
protected $accessedColumns;
7272

73-
/** @var array of earlier touched columns */
73+
/** @var array|false|null of earlier touched columns */
7474
protected $previousAccessedColumns;
7575

76-
/** @var bool should instance observe accessed columns caching */
77-
protected $observeCache = false;
76+
/** @var self|null should instance observe accessed columns caching */
77+
protected $observeCache;
7878

7979
/** @var array of primary key values */
8080
protected $keys = [];

0 commit comments

Comments
 (0)