Skip to content

Commit 277296d

Browse files
committed
phpDoc: added $var name to @param, improved typehints
1 parent bd9bfcc commit 277296d

File tree

13 files changed

+41
-65
lines changed

13 files changed

+41
-65
lines changed

src/Database/Connection.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,24 +110,17 @@ public function getSupplementalDriver(): ISupplementalDriver
110110
}
111111

112112

113-
/**
114-
* @param string sequence object
115-
*/
116-
public function getInsertId(string $name = null): string
113+
public function getInsertId(string $sequence = null): string
117114
{
118115
try {
119-
$res = $this->getPdo()->lastInsertId($name);
116+
$res = $this->getPdo()->lastInsertId($sequence);
120117
return $res === false ? '0' : $res;
121118
} catch (PDOException $e) {
122119
throw $this->driver->convertException($e);
123120
}
124121
}
125122

126123

127-
/**
128-
* @param string string to be quoted
129-
* @param int data type hint
130-
*/
131124
public function quote(string $string, int $type = PDO::PARAM_STR): string
132125
{
133126
try {
@@ -180,7 +173,7 @@ public function queryArgs(string $sql, array $params): ResultSet
180173

181174

182175
/**
183-
* @return [string, array]
176+
* @return array [string, array]
184177
*/
185178
public function preprocess($sql, ...$params): array
186179
{

src/Database/Context.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,9 @@ public function rollBack(): void
6060
}
6161

6262

63-
/**
64-
* @param string sequence object
65-
*/
66-
public function getInsertId(string $name = null): string
63+
public function getInsertId(string $sequence = null): string
6764
{
68-
return $this->connection->getInsertId($name);
65+
return $this->connection->getInsertId($sequence);
6966
}
7067

7168

src/Database/Conventions/StaticConventions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ class StaticConventions implements IConventions
3232

3333
/**
3434
* Create static conventional structure.
35-
* @param string %s stands for table name
36-
* @param string %1$s stands for key used after ->, %2$s for table name
37-
* @param string %1$s stands for key used after ->, %2$s for table name
35+
* @param string $primary %s stands for table name
36+
* @param string $foreign %1$s stands for key used after ->, %2$s for table name
37+
* @param string $table %1$s stands for key used after ->, %2$s for table name
3838
*/
3939
public function __construct(string $primary = 'id', string $foreign = '%s_id', string $table = '%s')
4040
{

src/Database/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public static function detectType(string $type): string
177177

178178
/**
179179
* Import SQL dump from file - extremely fast.
180-
* @param $onProgress function (int $count, ?float $percent): void
180+
* @param callable $onProgress function (int $count, ?float $percent): void
181181
* @return int count of commands
182182
*/
183183
public static function loadFromFile(Connection $connection, string $file, callable $onProgress = null): int

src/Database/IConventions.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ function getPrimary(string $table);
2626
* Example:
2727
* (author, book) returns array(book, author_id)
2828
*
29-
* @param string source table
30-
* @param string referencing key
3129
* @return array|null array(referenced table, referenced column)
3230
* @throws AmbiguousReferenceKeyException
3331
*/
@@ -39,8 +37,6 @@ function getHasManyReference(string $table, string $key): ?array;
3937
* (book, author) returns array(author, author_id)
4038
* (book, translator) returns array(author, translator_id)
4139
*
42-
* @param string source table
43-
* @param string referencing key
4440
* @return array|null array(referenced table, referencing column)
4541
*/
4642
function getBelongsToReference(string $table, string $key): ?array;

src/Database/IRowContainer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ function fetchField();
2929

3030
/**
3131
* Fetches all rows as associative array.
32-
* @param string|int column name used for an array key or null for numeric index
33-
* @param string|int column name used for an array value or null for the whole row
32+
* @param string|int $key column name used for an array key or null for numeric index
33+
* @param string|int $value column name used for an array value or null for the whole row
3434
*/
3535
function fetchPairs($key = null, $value = null): array;
3636

@@ -42,7 +42,7 @@ function fetchAll(): array;
4242

4343
/**
4444
* Fetches all rows and returns associative tree.
45-
* @param string associative descriptor
45+
* @param string $path associative descriptor
4646
*/
4747
function fetchAssoc(string $path): array;
4848
}

src/Database/ISupplementalDriver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function formatLike(string $value, int $pos): string;
5555

5656
/**
5757
* Injects LIMIT/OFFSET to the SQL query.
58-
* @param string SQL query that will be modified.
58+
* @param string $sql query that will be modified.
5959
*/
6060
function applyLimit(string &$sql, ?int $limit, ?int $offset): void;
6161

@@ -91,7 +91,7 @@ function getColumnTypes(\PDOStatement $statement): array;
9191

9292
/**
9393
* Cheks if driver supports specific property
94-
* @param string self::SUPPORT_* property
94+
* @param string $item self::SUPPORT_* property
9595
*/
9696
function isSupported(string $item): bool;
9797
}

src/Database/Row.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __get($key)
2626

2727
/**
2828
* Returns a item.
29-
* @param mixed key or index
29+
* @param string|int $key key or index
3030
* @return mixed
3131
*/
3232
public function offsetGet($key)
@@ -44,7 +44,7 @@ public function offsetGet($key)
4444

4545
/**
4646
* Checks if $key exists.
47-
* @param mixed key or index
47+
* @param string|int $key key or index
4848
*/
4949
public function offsetExists($key): bool
5050
{

src/Database/Table/ActiveRow.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ public function getIterator(): \Iterator
214214

215215
/**
216216
* Stores value in column.
217-
* @param string
218-
* @param mixed
217+
* @param string $column
218+
* @param mixed $value
219219
*/
220220
public function offsetSet($column, $value): void
221221
{
@@ -225,7 +225,7 @@ public function offsetSet($column, $value): void
225225

226226
/**
227227
* Returns value of column.
228-
* @param string
228+
* @param string $column
229229
* @return mixed
230230
*/
231231
public function offsetGet($column)
@@ -236,7 +236,7 @@ public function offsetGet($column)
236236

237237
/**
238238
* Tests if column exists.
239-
* @param string
239+
* @param string $column
240240
*/
241241
public function offsetExists($column): bool
242242
{
@@ -246,7 +246,7 @@ public function offsetExists($column): bool
246246

247247
/**
248248
* Removes column from data.
249-
* @param string
249+
* @param string $column
250250
*/
251251
public function offsetUnset($column): void
252252
{

src/Database/Table/ColumnAccessCache.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,6 @@ public function &loadFromRefCache(&$referencing): string
177177
}
178178

179179

180-
/**
181-
* @param Selection
182-
*/
183180
public function setObserveCache(Selection $observeCache): void
184181
{
185182
$this->observeCache = $observeCache;

0 commit comments

Comments
 (0)