Skip to content

Commit 75ddf0c

Browse files
committed
replaced IRow with Row/ActiveRow in typehints
1 parent e50696b commit 75ddf0c

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

src/Database/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function getLastQueryString(): ?string
216216
/**
217217
* Shortcut for query()->fetch()
218218
*/
219-
public function fetch(string $sql, ...$params): ?IRow
219+
public function fetch(string $sql, ...$params): ?Row
220220
{
221221
return $this->query($sql, ...$params)->fetch();
222222
}

src/Database/Context.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function getConventions(): IConventions
124124
/**
125125
* Shortcut for query()->fetch()
126126
*/
127-
public function fetch(string $sql, ...$params): ?IRow
127+
public function fetch(string $sql, ...$params): ?Row
128128
{
129129
return $this->connection->query($sql, ...$params)->fetch();
130130
}

src/Database/ResultSet.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ class ResultSet implements \Iterator, IRowContainer
2626
/** @var \PDOStatement|null */
2727
private $pdoStatement;
2828

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

3232
/** @var int */
3333
private $resultKey = -1;
3434

35-
/** @var IRow[] */
35+
/** @var Row[] */
3636
private $results;
3737

3838
/** @var float */
@@ -223,13 +223,10 @@ public function valid(): bool
223223
}
224224

225225

226-
/********************* interface IRowContainer ****************d*g**/
227-
228-
229226
/**
230227
* Fetches single row object.
231228
*/
232-
public function fetch(): ?IRow
229+
public function fetch(): ?Row
233230
{
234231
$data = $this->pdoStatement ? $this->pdoStatement->fetch() : null;
235232
if (!$data) {

src/Database/SqlPreprocessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private function formatValue($value, string $mode = null): string
166166
} elseif ($value === null) {
167167
return 'NULL';
168168

169-
} elseif ($value instanceof Table\IRow) {
169+
} elseif ($value instanceof Table\ActiveRow) {
170170
$this->remaining[] = $value->getPrimary();
171171
return '?';
172172

@@ -195,7 +195,7 @@ private function formatValue($value, string $mode = null): string
195195
return $this->delimite($value);
196196
}
197197

198-
if ($value instanceof \Traversable && !$value instanceof Table\IRow) {
198+
if ($value instanceof \Traversable && !$value instanceof Table\ActiveRow) {
199199
$value = iterator_to_array($value);
200200
}
201201

src/Database/Table/ActiveRow.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function getSignature(bool $throw = true): string
123123
* Returns referenced row.
124124
* @return self|null if the row does not exist
125125
*/
126-
public function ref(string $key, string $throughColumn = null): ?IRow
126+
public function ref(string $key, string $throughColumn = null): ?self
127127
{
128128
$row = $this->table->getReferencedTable($this, $key, $throughColumn);
129129
if ($row === false) {

src/Database/Table/Selection.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ class Selection implements \Iterator, IRowContainer, \ArrayAccess, \Countable
4343
/** @var string|bool primary column sequence name, false for autodetection */
4444
protected $primarySequence = false;
4545

46-
/** @var IRow[] data read from database in [primary key => IRow] format */
46+
/** @var ActiveRow[] data read from database in [primary key => ActiveRow] format */
4747
protected $rows;
4848

49-
/** @var IRow[] modifiable data in [primary key => IRow] format */
49+
/** @var ActiveRow[] modifiable data in [primary key => ActiveRow] format */
5050
protected $data;
5151

5252
/** @var bool */
@@ -64,7 +64,7 @@ class Selection implements \Iterator, IRowContainer, \ArrayAccess, \Countable
6464
/** @var string|null */
6565
protected $specificCacheKey;
6666

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

7070
/** @var array|false|null of touched columns */
@@ -201,9 +201,8 @@ public function get($key): ?ActiveRow
201201

202202
/**
203203
* Fetches single row object.
204-
* @return ActiveRow|null if there is no such row
205204
*/
206-
public function fetch(): ?Nette\Database\IRow
205+
public function fetch(): ?ActiveRow
207206
{
208207
$this->execute();
209208
$return = current($this->data);
@@ -791,7 +790,7 @@ public function getDataRefreshed(): bool
791790
/**
792791
* Inserts row in a table.
793792
* @param array|\Traversable|Selection $data [$column => $value]|\Traversable|Selection for INSERT ... SELECT
794-
* @return ActiveRow|int|bool Returns IRow or number of affected rows for Selection or table without primary key
793+
* @return ActiveRow|int|bool Returns ActiveRow or number of affected rows for Selection or table without primary key
795794
*/
796795
public function insert(iterable $data)
797796
{
@@ -1029,7 +1028,7 @@ public function valid(): bool
10291028
/**
10301029
* Mimic row.
10311030
* @param string $key
1032-
* @param IRow $value
1031+
* @param ActiveRow $value
10331032
*/
10341033
public function offsetSet($key, $value): void
10351034
{

0 commit comments

Comments
 (0)