Skip to content

Commit 14506d0

Browse files
committed
fixed phpDoc
1 parent 0e6aeb1 commit 14506d0

File tree

9 files changed

+181
-42
lines changed

9 files changed

+181
-42
lines changed

src/Database/IConventions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function getPrimary($table);
2727
*
2828
* @param string source table
2929
* @param string referencing key
30-
* @return array array(referenced table, referenced column)
30+
* @return array|NULL array(referenced table, referenced column)
3131
* @throws AmbiguousReferenceKeyException
3232
*/
3333
function getHasManyReference($table, $key);
@@ -40,7 +40,7 @@ function getHasManyReference($table, $key);
4040
*
4141
* @param string source table
4242
* @param string referencing key
43-
* @return array array(referenced table, referencing column)
43+
* @return array|NULL array(referenced table, referencing column)
4444
*/
4545
function getBelongsToReference($table, $key);
4646

src/Database/IRowContainer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ function fetch();
2222

2323
/**
2424
* Fetches all rows as associative array.
25-
* @param string column name used for an array key or NULL for numeric index
26-
* @param string column name used for an array value or NULL for the whole row
25+
* @param string|int column name used for an array key or NULL for numeric index
26+
* @param string|int column name used for an array value or NULL for the whole row
2727
* @return array
2828
*/
2929
function fetchPairs($key = NULL, $value = NULL);

src/Database/IStructure.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function getPrimaryKeySequence($table);
5757
* If a targetTable is not provided, returns references for all tables.
5858
* @param string
5959
* @param string|NULL
60-
* @return mixed
60+
* @return array|NULL
6161
*/
6262
function getHasManyReference($table, $targetTable = NULL);
6363

@@ -66,13 +66,13 @@ function getHasManyReference($table, $targetTable = NULL);
6666
* If a column is not provided, returns references for all columns.
6767
* @param string
6868
* @param string|NULL
69-
* @return mixed
69+
* @return array|NULL
7070
*/
7171
function getBelongsToReference($table, $column = NULL);
7272

7373
/**
7474
* Rebuilds database structure cache.
75-
* @return mixed
75+
* @return void
7676
*/
7777
function rebuild();
7878

src/Database/ISupplementalDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function delimite($name);
3535
/**
3636
* Formats boolean for use in a SQL statement.
3737
* @param bool
38-
* @return mixed
38+
* @return string
3939
*/
4040
function formatBool($value);
4141

src/Database/Table/ActiveRow.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function getSignature($need = TRUE)
129129
* Returns referenced row.
130130
* @param string
131131
* @param string
132-
* @return IRow or NULL if the row does not exist
132+
* @return IRow|NULL if the row does not exist
133133
*/
134134
public function ref($key, $throughColumn = NULL)
135135
{
@@ -161,7 +161,7 @@ public function related($key, $throughColumn = NULL)
161161

162162
/**
163163
* Updates row.
164-
* @param array|\Traversable (column => value)
164+
* @param iterable (column => value)
165165
* @return bool
166166
*/
167167
public function update($data)
@@ -228,50 +228,50 @@ public function getIterator()
228228

229229
/**
230230
* Stores value in column.
231-
* @param string column name
232-
* @param string value
231+
* @param string
232+
* @param mixed
233233
* @return void
234234
*/
235-
public function offsetSet($key, $value)
235+
public function offsetSet($column, $value)
236236
{
237-
$this->__set($key, $value);
237+
$this->__set($column, $value);
238238
}
239239

240240

241241
/**
242242
* Returns value of column.
243-
* @param string column name
244-
* @return string
243+
* @param string
244+
* @return mixed
245245
*/
246-
public function offsetGet($key)
246+
public function offsetGet($column)
247247
{
248-
return $this->__get($key);
248+
return $this->__get($column);
249249
}
250250

251251

252252
/**
253253
* Tests if column exists.
254-
* @param string column name
254+
* @param string
255255
* @return bool
256256
*/
257-
public function offsetExists($key)
257+
public function offsetExists($column)
258258
{
259-
return $this->__isset($key);
259+
return $this->__isset($column);
260260
}
261261

262262

263263
/**
264264
* Removes column from data.
265-
* @param string column name
265+
* @param string
266266
* @return void
267267
*/
268-
public function offsetUnset($key)
268+
public function offsetUnset($column)
269269
{
270-
$this->__unset($key);
270+
$this->__unset($column);
271271
}
272272

273273

274-
public function __set($key, $value)
274+
public function __set($column, $value)
275275
{
276276
throw new Nette\DeprecatedException('ActiveRow is read-only; use update() method instead.');
277277
}

src/Database/Table/GroupedSelection.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public function setActive($active)
6161
}
6262

6363

64+
/**
65+
* @return static
66+
*/
6467
public function select($columns, ...$params)
6568
{
6669
if (!$this->sqlBuilder->getSelect()) {
@@ -71,6 +74,9 @@ public function select($columns, ...$params)
7174
}
7275

7376

77+
/**
78+
* @return static
79+
*/
7480
public function order($columns, ...$params)
7581
{
7682
if (!$this->sqlBuilder->getOrder()) {
@@ -111,6 +117,9 @@ public function aggregation($function)
111117
}
112118

113119

120+
/**
121+
* @return int
122+
*/
114123
public function count($column = NULL)
115124
{
116125
$return = parent::count($column);
@@ -173,6 +182,9 @@ protected function execute()
173182
}
174183

175184

185+
/**
186+
* @return Selection
187+
*/
176188
protected function getRefTable(&$refPath)
177189
{
178190
$refObj = $this->refTable;

src/Database/Table/IRow.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,39 @@ interface IRow extends Database\IRow
1818

1919
function setTable(Selection $name);
2020

21+
/**
22+
* @return Selection
23+
*/
2124
function getTable();
2225

26+
/**
27+
* Returns primary key value.
28+
* @param bool
29+
* @return mixed
30+
*/
2331
function getPrimary($need = TRUE);
2432

33+
/**
34+
* Returns row signature (composition of primary keys)
35+
* @param bool
36+
* @return string
37+
*/
2538
function getSignature($need = TRUE);
2639

40+
/**
41+
* Returns referencing rows.
42+
* @param string
43+
* @param string
44+
* @return GroupedSelection
45+
*/
2746
function related($key, $throughColumn = NULL);
2847

48+
/**
49+
* Returns referenced row.
50+
* @param string
51+
* @param string
52+
* @return IRow|NULL if the row does not exist
53+
*/
2954
function ref($key, $throughColumn = NULL);
3055

3156
}

src/Database/Table/Selection.php

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function getPrimary($need = TRUE)
133133

134134

135135
/**
136-
* @return string
136+
* @return string|NULL
137137
*/
138138
public function getPrimarySequence()
139139
{
@@ -273,7 +273,7 @@ public function fetchAssoc($path)
273273

274274
/**
275275
* Adds select clause, more calls appends to the end.
276-
* @param string for example "column, MD5(column) AS column_md5"
276+
* @param string|string[] for example "column, MD5(column) AS column_md5"
277277
* @return static
278278
*/
279279
public function select($columns, ...$params)
@@ -311,7 +311,7 @@ public function wherePrimary($key)
311311

312312
/**
313313
* Adds where condition, more calls appends with AND.
314-
* @param string condition possibly containing ?
314+
* @param string|string[] condition possibly containing ?
315315
* @param mixed
316316
* @return static
317317
*/
@@ -338,7 +338,7 @@ public function joinWhere($tableChain, $condition, ...$params)
338338

339339
/**
340340
* Adds condition, more calls appends with AND.
341-
* @param string condition possibly containing ?
341+
* @param string|string[] condition possibly containing ?
342342
* @return void
343343
*/
344344
protected function condition($condition, array $params, $tableChain = NULL)
@@ -484,7 +484,7 @@ public function alias($tableChain, $alias)
484484
/**
485485
* Executes aggregation function.
486486
* @param string select call in "FUNCTION(column)" format
487-
* @return string
487+
* @return int
488488
*/
489489
public function aggregation($function)
490490
{
@@ -591,24 +591,36 @@ protected function execute()
591591
}
592592

593593

594+
/**
595+
* @return ActiveRow
596+
*/
594597
protected function createRow(array $row)
595598
{
596599
return new ActiveRow($row, $this);
597600
}
598601

599602

603+
/**
604+
* @return self
605+
*/
600606
public function createSelectionInstance($table = NULL)
601607
{
602608
return new self($this->context, $this->conventions, $table ?: $this->name, $this->cache ? $this->cache->getStorage() : NULL);
603609
}
604610

605611

612+
/**
613+
* @return GroupedSelection
614+
*/
606615
protected function createGroupedSelectionInstance($table, $column)
607616
{
608617
return new GroupedSelection($this->context, $this->conventions, $table, $column, $this, $this->cache ? $this->cache->getStorage() : NULL);
609618
}
610619

611620

621+
/**
622+
* @return Nette\Database\ResultSet
623+
*/
612624
protected function query($query)
613625
{
614626
return $this->context->queryArgs($query, $this->sqlBuilder->getParameters());
@@ -863,7 +875,7 @@ public function insert($data)
863875
/**
864876
* Updates all rows in result set.
865877
* Joins in UPDATE are supported only in MySQL
866-
* @param array|\Traversable ($column => $value)
878+
* @param iterable ($column => $value)
867879
* @return int number of affected rows
868880
*/
869881
public function update($data)
@@ -902,7 +914,7 @@ public function delete()
902914
/**
903915
* Returns referenced row.
904916
* @param ActiveRow
905-
* @param string
917+
* @param string|NULL
906918
* @param string|NULL
907919
* @return ActiveRow|NULL|FALSE NULL if the row does not exist, FALSE if the relationship does not exist
908920
*/
@@ -953,7 +965,7 @@ public function getReferencedTable(ActiveRow $row, $table, $column = NULL)
953965
* @param string
954966
* @param string
955967
* @param int primary key
956-
* @return GroupedSelection
968+
* @return GroupedSelection|NULL
957969
*/
958970
public function getReferencingTable($table, $column, $active = NULL)
959971
{
@@ -962,7 +974,7 @@ public function getReferencingTable($table, $column, $active = NULL)
962974
} elseif (!$column) {
963975
$hasMany = $this->conventions->getHasManyReference($this->name, $table);
964976
if (!$hasMany) {
965-
return FALSE;
977+
return NULL;
966978
}
967979
list($table, $column) = $hasMany;
968980
}
@@ -1002,7 +1014,7 @@ public function current()
10021014

10031015

10041016
/**
1005-
* @return string row ID
1017+
* @return string|int row ID
10061018
*/
10071019
public function key()
10081020
{
@@ -1031,7 +1043,7 @@ public function valid()
10311043
* Mimic row.
10321044
* @param string row ID
10331045
* @param IRow
1034-
* @return NULL
1046+
* @return void
10351047
*/
10361048
public function offsetSet($key, $value)
10371049
{
@@ -1043,7 +1055,7 @@ public function offsetSet($key, $value)
10431055
/**
10441056
* Returns specified row.
10451057
* @param string row ID
1046-
* @return IRow or NULL if there is no such row
1058+
* @return IRow|NULL if there is no such row
10471059
*/
10481060
public function offsetGet($key)
10491061
{
@@ -1067,7 +1079,7 @@ public function offsetExists($key)
10671079
/**
10681080
* Removes row from result set.
10691081
* @param string row ID
1070-
* @return NULL
1082+
* @return void
10711083
*/
10721084
public function offsetUnset($key)
10731085
{

0 commit comments

Comments
 (0)