@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ***************/ |
89 | 89 | |
90 | 90 | /** |
91 | - * @param int|string $offset |
|
91 | + * @param integer $offset |
|
92 | 92 | * |
93 | 93 | * @return bool |
94 | 94 | */ |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
100 | - * @param int|string $offset |
|
100 | + * @param integer $offset |
|
101 | 101 | * |
102 | 102 | * @return \chillerlan\Database\DBResultRow|mixed|null |
103 | 103 | */ |
@@ -12,7 +12,9 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\Database; |
14 | 14 | |
15 | -use ArrayAccess, Countable, Iterator; |
|
15 | +use ArrayAccess; |
|
16 | +use Countable; |
|
17 | +use Iterator; |
|
16 | 18 | use chillerlan\Database\Traits\{Enumerable, Magic}; |
17 | 19 | |
18 | 20 | /** |
@@ -43,6 +43,9 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected $cacheDriver; |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $data |
|
48 | + */ |
|
46 | 49 | abstract protected function __escape($data); |
47 | 50 | |
48 | 51 | abstract protected function __raw(string $sql, string $index = null, bool $assoc = true); |
@@ -51,6 +54,9 @@ discard block |
||
51 | 54 | |
52 | 55 | abstract protected function __multi(string $sql, array $values); |
53 | 56 | |
57 | + /** |
|
58 | + * @param callable $callback |
|
59 | + */ |
|
54 | 60 | abstract protected function __multi_callback(string $sql, array $data, $callback); |
55 | 61 | |
56 | 62 | /** |
@@ -10,10 +10,10 @@ |
||
10 | 10 | |
11 | 11 | namespace chillerlan\Database\Drivers; |
12 | 12 | |
13 | +use Psr\SimpleCache\CacheInterface; |
|
13 | 14 | use chillerlan\Database\DBException; |
14 | 15 | use chillerlan\Database\DBOptions; |
15 | 16 | use chillerlan\Database\DBResult; |
16 | -use Psr\SimpleCache\CacheInterface; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Class DBDriverAbstract |
@@ -12,10 +12,12 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\Database\Drivers; |
14 | 14 | |
15 | +use ReflectionMethod; |
|
15 | 16 | use chillerlan\Database\DBException; |
16 | 17 | use chillerlan\Database\DBResult; |
17 | -use mysqli, mysqli_result, mysqli_sql_exception, mysqli_stmt; |
|
18 | -use ReflectionMethod, stdClass, Exception; |
|
18 | +use mysqli; |
|
19 | +use mysqli_result; |
|
20 | +use mysqli_stmt; |
|
19 | 21 | |
20 | 22 | /** |
21 | 23 | * |
@@ -263,7 +263,7 @@ |
||
263 | 263 | * |
264 | 264 | * @return void |
265 | 265 | */ |
266 | - protected function insertPreparedRow(mysqli_stmt &$stmt, ReflectionMethod &$reflectionMethod, array &$row){ |
|
266 | + protected function insertPreparedRow(mysqli_stmt&$stmt, ReflectionMethod&$reflectionMethod, array &$row){ |
|
267 | 267 | $reflectionMethod->invokeArgs($stmt, $this->getReferences($row)); |
268 | 268 | $stmt->execute(); |
269 | 269 | } |
@@ -199,7 +199,7 @@ |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
202 | - * @param $stmt |
|
202 | + * @param PDOStatement $stmt |
|
203 | 203 | * @param string|null $index |
204 | 204 | * @param bool $assoc |
205 | 205 | * |
@@ -11,12 +11,12 @@ |
||
11 | 11 | |
12 | 12 | namespace chillerlan\Database\Drivers\PDO; |
13 | 13 | |
14 | -use chillerlan\Database\DBException; |
|
15 | -use chillerlan\Database\Drivers\DBDriverAbstract; |
|
16 | -use chillerlan\Database\Drivers\DBDriverInterface; |
|
17 | 14 | use PDO; |
18 | 15 | use PDOException; |
19 | 16 | use PDOStatement; |
17 | +use chillerlan\Database\DBException; |
|
18 | +use chillerlan\Database\Drivers\DBDriverAbstract; |
|
19 | +use chillerlan\Database\Drivers\DBDriverInterface; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Class PDODriverAbstract |
@@ -163,7 +163,7 @@ |
||
163 | 163 | * |
164 | 164 | * @return void |
165 | 165 | */ |
166 | - protected function bindParams(PDOStatement &$stmt, array $values){ |
|
166 | + protected function bindParams(PDOStatement&$stmt, array $values){ |
|
167 | 167 | $param_no = 1; |
168 | 168 | |
169 | 169 | foreach($values as $v){ |
@@ -129,7 +129,7 @@ |
||
129 | 129 | * |
130 | 130 | * @var int |
131 | 131 | */ |
132 | - public $sqlite_flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE; |
|
132 | + public $sqlite_flags = SQLITE3_OPEN_READWRITE|SQLITE3_OPEN_CREATE; |
|
133 | 133 | |
134 | 134 | /** |
135 | 135 | * An optional encryption key used when encrypting and decrypting an SQLite database. |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * |
44 | 44 | * @return mixed|null |
45 | 45 | */ |
46 | - public function __get(string $name) { |
|
46 | + public function __get(string $name){ |
|
47 | 47 | |
48 | 48 | if(isset($this->array[$name])){ |
49 | 49 | return $this->array[$name]; |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * |
44 | 44 | * @return mixed|null |
45 | 45 | */ |
46 | - public function __get(string $name) { |
|
46 | + public function __get(string $name){ |
|
47 | 47 | |
48 | 48 | if(isset($this->array[$name])){ |
49 | 49 | return $this->array[$name]; |
@@ -12,8 +12,11 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\DatabaseTest; |
14 | 14 | |
15 | +use ArrayAccess; |
|
16 | +use Countable; |
|
17 | +use Iterator; |
|
15 | 18 | use chillerlan\Database\DBResult; |
16 | -use Iterator, ArrayAccess, Countable, stdClass; |
|
19 | +use stdClass; |
|
17 | 20 | |
18 | 21 | class DBResultTest extends TestAbstract{ |
19 | 22 |
@@ -14,21 +14,21 @@ |
||
14 | 14 | |
15 | 15 | trait Magic{ |
16 | 16 | |
17 | - public function __get(string $name) { |
|
17 | + public function __get(string $name){ |
|
18 | 18 | return $this->get($name); |
19 | 19 | } |
20 | 20 | |
21 | - public function __set(string $name, $value) { |
|
21 | + public function __set(string $name, $value){ |
|
22 | 22 | $this->set($name, $value); |
23 | 23 | } |
24 | 24 | |
25 | - private function get(string $name) { |
|
25 | + private function get(string $name){ |
|
26 | 26 | $method = 'magic_get_'.$name; |
27 | 27 | |
28 | 28 | return method_exists($this, $method) ? $this->$method() : null; |
29 | 29 | } |
30 | 30 | |
31 | - private function set(string $name, $value) { |
|
31 | + private function set(string $name, $value){ |
|
32 | 32 | $method = 'magic_set_'.$name; |
33 | 33 | |
34 | 34 | if(method_exists($this, $method)){ |
@@ -14,21 +14,21 @@ |
||
14 | 14 | |
15 | 15 | trait Magic{ |
16 | 16 | |
17 | - public function __get(string $name) { |
|
17 | + public function __get(string $name){ |
|
18 | 18 | return $this->get($name); |
19 | 19 | } |
20 | 20 | |
21 | - public function __set(string $name, $value) { |
|
21 | + public function __set(string $name, $value){ |
|
22 | 22 | $this->set($name, $value); |
23 | 23 | } |
24 | 24 | |
25 | - private function get(string $name) { |
|
25 | + private function get(string $name){ |
|
26 | 26 | $method = 'magic_get_'.$name; |
27 | 27 | |
28 | 28 | return method_exists($this, $method) ? $this->$method() : null; |
29 | 29 | } |
30 | 30 | |
31 | - private function set(string $name, $value) { |
|
31 | + private function set(string $name, $value){ |
|
32 | 32 | $method = 'magic_set_'.$name; |
33 | 33 | |
34 | 34 | if(method_exists($this, $method)){ |
@@ -12,9 +12,9 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\DatabaseTest\Drivers; |
14 | 14 | |
15 | +use chillerlan\DatabaseTest\TestAbstract; |
|
15 | 16 | use chillerlan\Database\DBResult; |
16 | 17 | use chillerlan\Database\Drivers\DBDriverInterface; |
17 | -use chillerlan\DatabaseTest\TestAbstract; |
|
18 | 18 | |
19 | 19 | abstract class DriverTestAbstract extends TestAbstract{ |
20 | 20 |
@@ -172,7 +172,7 @@ |
||
172 | 172 | * @expectedExceptionMessage sql error: |
173 | 173 | */ |
174 | 174 | public function testMultiCallbackSQLError(){ |
175 | - $this->DBDriver->multi_callback($this->SQL_RAW_ERROR, [[0]], function(){return [];}); |
|
175 | + $this->DBDriver->multi_callback($this->SQL_RAW_ERROR, [[0]], function(){return []; }); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | public function testMultiCallback(){ |