@@ -73,7 +73,7 @@ |
||
73 | 73 | } |
74 | 74 | } |
75 | 75 | /** |
76 | - * @param $className |
|
76 | + * @param string $className |
|
77 | 77 | * @return self |
78 | 78 | */ |
79 | 79 | static function readWithoutCache($className) |
@@ -8,7 +8,6 @@ |
||
8 | 8 | /** |
9 | 9 | * AnnotationTag constructor. |
10 | 10 | * @param string $name |
11 | - * @param string $summary |
|
12 | 11 | * @param string $description |
13 | 12 | * @param array $children |
14 | 13 | * @param AnnotationBlock|AnnotationTag|null $parent |
@@ -375,7 +375,7 @@ |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
378 | - * @return \string[] |
|
378 | + * @return string[] |
|
379 | 379 | */ |
380 | 380 | public function getGlobalHooks() |
381 | 381 | { |
@@ -4,6 +4,9 @@ |
||
4 | 4 | |
5 | 5 | class ClassModifiedChecker extends FileModifiedChecker |
6 | 6 | { |
7 | + /** |
|
8 | + * @param string $className |
|
9 | + */ |
|
7 | 10 | function __construct($className){ |
8 | 11 | $class = new \ReflectionClass($className); |
9 | 12 | $files = []; |
@@ -91,7 +91,7 @@ |
||
91 | 91 | |
92 | 92 | /** |
93 | 93 | * 获取指定参数信息 |
94 | - * @param $name |
|
94 | + * @param string|null $name |
|
95 | 95 | * @return ParamMeta|null |
96 | 96 | */ |
97 | 97 | public function getParamMeta($name){ |
@@ -82,6 +82,9 @@ |
||
82 | 82 | return new DB($app, $connection); |
83 | 83 | } |
84 | 84 | |
85 | + /** |
|
86 | + * @param \PDO $connection |
|
87 | + */ |
|
85 | 88 | public function __construct(Application $app, $connection) |
86 | 89 | { |
87 | 90 | $this->app = $app; |
@@ -7,6 +7,11 @@ discard block |
||
7 | 7 | use PhpBoot\DB\Context; |
8 | 8 | |
9 | 9 | class ExecResult{ |
10 | + |
|
11 | + /** |
|
12 | + * @param \PDO $pdo |
|
13 | + * @param \PDOStatement $st |
|
14 | + */ |
|
10 | 15 | public function __construct($success, $pdo, $st){ |
11 | 16 | $this->pdo = $pdo; |
12 | 17 | $this->st = $st; |
@@ -40,6 +45,10 @@ discard block |
||
40 | 45 | |
41 | 46 | class SelectImpl |
42 | 47 | { |
48 | + /** |
|
49 | + * @param Context $context |
|
50 | + * @param string $columns |
|
51 | + */ |
|
43 | 52 | static public function select($context, $columns){ |
44 | 53 | $context->appendSql("SELECT $columns"); |
45 | 54 | } |
@@ -47,6 +56,10 @@ discard block |
||
47 | 56 | |
48 | 57 | class FromImpl |
49 | 58 | { |
59 | + /** |
|
60 | + * @param Context $context |
|
61 | + * @param string $tables |
|
62 | + */ |
|
50 | 63 | static public function from($context, $tables,$as=null){ |
51 | 64 | if($tables instanceof BasicRule){ |
52 | 65 | $context->appendSql("FROM (".$tables->context->sql.')'); |
@@ -62,6 +75,10 @@ discard block |
||
62 | 75 | |
63 | 76 | class DeleteImpl |
64 | 77 | { |
78 | + /** |
|
79 | + * @param Context $context |
|
80 | + * @param string $from |
|
81 | + */ |
|
65 | 82 | static public function deleteFrom($context, $from) |
66 | 83 | { |
67 | 84 | $context->appendSql("DELETE FROM `$from`"); |
@@ -70,6 +87,11 @@ discard block |
||
70 | 87 | |
71 | 88 | class JoinImpl |
72 | 89 | { |
90 | + /** |
|
91 | + * @param Context $context |
|
92 | + * @param null|string $type |
|
93 | + * @param string $table |
|
94 | + */ |
|
73 | 95 | static public function join($context, $type, $table) { |
74 | 96 | if($type){ |
75 | 97 | $context->appendSql("$type JOIN $table"); |
@@ -81,6 +103,10 @@ discard block |
||
81 | 103 | |
82 | 104 | class JoinOnImpl |
83 | 105 | { |
106 | + /** |
|
107 | + * @param Context $context |
|
108 | + * @param string $condition |
|
109 | + */ |
|
84 | 110 | static public function on($context, $condition) { |
85 | 111 | $context->appendSql("ON $condition"); |
86 | 112 | } |
@@ -88,6 +114,9 @@ discard block |
||
88 | 114 | |
89 | 115 | class ForUpdateImpl |
90 | 116 | { |
117 | + /** |
|
118 | + * @param Context $context |
|
119 | + */ |
|
91 | 120 | static public function forUpdate($context){ |
92 | 121 | $context->appendSql("FOR UPDATE"); |
93 | 122 | } |
@@ -95,6 +124,10 @@ discard block |
||
95 | 124 | |
96 | 125 | class ForUpdateOfImpl |
97 | 126 | { |
127 | + /** |
|
128 | + * @param Context $context |
|
129 | + * @param string $column |
|
130 | + */ |
|
98 | 131 | static public function of($context, $column){ |
99 | 132 | $context->appendSql("OF $column"); |
100 | 133 | } |
@@ -102,18 +135,29 @@ discard block |
||
102 | 135 | |
103 | 136 | class InsertImpl |
104 | 137 | { |
138 | + /** |
|
139 | + * @param Context $context |
|
140 | + * @param string $table |
|
141 | + */ |
|
105 | 142 | static public function insertInto($context, $table) { |
106 | 143 | $context->appendSql("INSERT INTO `$table`"); |
107 | 144 | } |
108 | 145 | } |
109 | 146 | class ReplaceImpl |
110 | 147 | { |
148 | + /** |
|
149 | + * @param Context $context |
|
150 | + * @param string $table |
|
151 | + */ |
|
111 | 152 | static public function replaceInto($context, $table) { |
112 | 153 | $context->appendSql("REPLACE INTO `$table`"); |
113 | 154 | } |
114 | 155 | } |
115 | 156 | class ValuesImpl |
116 | 157 | { |
158 | + /** |
|
159 | + * @param Context $context |
|
160 | + */ |
|
117 | 161 | static public function values($context, $values){ |
118 | 162 | $params = []; |
119 | 163 | $stubs = []; |
@@ -143,6 +187,10 @@ discard block |
||
143 | 187 | |
144 | 188 | class UpdateImpl |
145 | 189 | { |
190 | + /** |
|
191 | + * @param Context $context |
|
192 | + * @param string $table |
|
193 | + */ |
|
146 | 194 | static public function update($context, $table){ |
147 | 195 | $context->appendSql("UPDATE `$table`"); |
148 | 196 | } |
@@ -150,6 +198,10 @@ discard block |
||
150 | 198 | |
151 | 199 | class UpdateSetImpl |
152 | 200 | { |
201 | + /** |
|
202 | + * @param Context $context |
|
203 | + * @param string $column |
|
204 | + */ |
|
153 | 205 | public function set($context, $column, $value){ |
154 | 206 | $prefix = ''; |
155 | 207 | if($this->first){ |
@@ -166,6 +218,10 @@ discard block |
||
166 | 218 | } |
167 | 219 | } |
168 | 220 | |
221 | + /** |
|
222 | + * @param Context $context |
|
223 | + * @param string $expr |
|
224 | + */ |
|
169 | 225 | public function setExpr($context, $expr, $args){ |
170 | 226 | $prefix = ''; |
171 | 227 | if($this->first){ |
@@ -179,6 +235,10 @@ discard block |
||
179 | 235 | $context->appendParams($args); |
180 | 236 | |
181 | 237 | } |
238 | + |
|
239 | + /** |
|
240 | + * @param Context $context |
|
241 | + */ |
|
182 | 242 | public function setArgs($context, $values){ |
183 | 243 | $set = []; |
184 | 244 | $params = []; |
@@ -203,6 +263,9 @@ discard block |
||
203 | 263 | } |
204 | 264 | class OrderByImpl |
205 | 265 | { |
266 | + /** |
|
267 | + * @param Context $context |
|
268 | + */ |
|
206 | 269 | public function orderByArgs($context, $orders){ |
207 | 270 | if(empty($orders)){ |
208 | 271 | return $this; |
@@ -230,6 +293,12 @@ discard block |
||
230 | 293 | } |
231 | 294 | return $this; |
232 | 295 | } |
296 | + |
|
297 | + /** |
|
298 | + * @param Context $context |
|
299 | + * @param string $column |
|
300 | + * @param string $order |
|
301 | + */ |
|
233 | 302 | public function orderBy($context, $column, $order=null){ |
234 | 303 | if($this->first){ |
235 | 304 | $this->first = false; |
@@ -247,12 +316,22 @@ discard block |
||
247 | 316 | |
248 | 317 | class LimitImpl |
249 | 318 | { |
319 | + /** |
|
320 | + * @param Context $context |
|
321 | + * @param integer $size |
|
322 | + */ |
|
250 | 323 | static public function limit($context, $size){ |
251 | 324 | $intSize = intval($size); |
252 | 325 | strval($intSize) == $size or \PhpBoot\abort( |
253 | 326 | new \InvalidArgumentException("invalid params for limit($size)")); |
254 | 327 | $context->appendSql("LIMIT $size"); |
255 | 328 | } |
329 | + |
|
330 | + /** |
|
331 | + * @param Context $context |
|
332 | + * @param integer $start |
|
333 | + * @param integer $size |
|
334 | + */ |
|
256 | 335 | static public function limitWithOffset($context,$start, $size){ |
257 | 336 | $intStart = intval($start); |
258 | 337 | $intSize = intval($size); |
@@ -264,6 +343,9 @@ discard block |
||
264 | 343 | |
265 | 344 | class WhereImpl{ |
266 | 345 | |
346 | + /** |
|
347 | + * @param string $str |
|
348 | + */ |
|
267 | 349 | static private function findQ($str,$offset = 0,$no=0){ |
268 | 350 | $found = strpos($str, '?', $offset); |
269 | 351 | if($no == 0 || $found === false){ |
@@ -271,16 +353,33 @@ discard block |
||
271 | 353 | } |
272 | 354 | return self::findQ($str, $found+1, $no-1); |
273 | 355 | } |
356 | + |
|
357 | + /** |
|
358 | + * @param Context $context |
|
359 | + * @param string $expr |
|
360 | + */ |
|
274 | 361 | static public function having($context, $expr, $args){ |
275 | 362 | self::condition($context, 'HAVING', $expr, $args); |
276 | 363 | } |
364 | + |
|
365 | + /** |
|
366 | + * @param Context $context |
|
367 | + * @param string $expr |
|
368 | + */ |
|
277 | 369 | static public function where($context, $expr, $args){ |
278 | 370 | self::condition($context, 'WHERE', $expr, $args); |
279 | 371 | } |
280 | 372 | |
373 | + /** |
|
374 | + * @param Context $context |
|
375 | + */ |
|
281 | 376 | static public function havingArgs($context, $args){ |
282 | 377 | self::conditionArgs($context, 'HAVING', $args); |
283 | 378 | } |
379 | + |
|
380 | + /** |
|
381 | + * @param Context $context |
|
382 | + */ |
|
284 | 383 | static public function whereArgs($context, $args){ |
285 | 384 | self::conditionArgs($context, 'WHERE', $args); |
286 | 385 | } |
@@ -305,6 +404,7 @@ discard block |
||
305 | 404 | * NOT IN 'id'=>['NOT IN' => [1,2,3]] |
306 | 405 | * |
307 | 406 | * @param array $args |
407 | + * @param string $prefix |
|
308 | 408 | */ |
309 | 409 | static public function conditionArgs($context, $prefix, $args=[]){ |
310 | 410 | if($args ===null){ |
@@ -432,6 +532,11 @@ discard block |
||
432 | 532 | } |
433 | 533 | |
434 | 534 | class GroupByImpl{ |
535 | + |
|
536 | + /** |
|
537 | + * @param Context $context |
|
538 | + * @param string $column |
|
539 | + */ |
|
435 | 540 | static public function groupBy($context, $column){ |
436 | 541 | $context->appendSql("GROUP BY $column"); |
437 | 542 | } |
@@ -453,7 +558,6 @@ discard block |
||
453 | 558 | /** |
454 | 559 | * |
455 | 560 | * @param Context $context |
456 | - * @param string|false $asDict return as dict or array |
|
457 | 561 | * @return false|array |
458 | 562 | */ |
459 | 563 | static public function get($context, $dictAs=false){ |
@@ -512,6 +616,10 @@ discard block |
||
512 | 616 | } |
513 | 617 | class OnDuplicateKeyUpdateImpl |
514 | 618 | { |
619 | + /** |
|
620 | + * @param Context $context |
|
621 | + * @param string $column |
|
622 | + */ |
|
515 | 623 | public function set($context, $column, $value){ |
516 | 624 | $prefix = ''; |
517 | 625 | if($this->first){ |
@@ -528,6 +636,9 @@ discard block |
||
528 | 636 | } |
529 | 637 | } |
530 | 638 | |
639 | + /** |
|
640 | + * @param Context $context |
|
641 | + */ |
|
531 | 642 | public function setExpr($context, $expr, $args){ |
532 | 643 | $prefix = ''; |
533 | 644 | if($this->first){ |
@@ -541,6 +652,10 @@ discard block |
||
541 | 652 | $context->appendParams($args); |
542 | 653 | |
543 | 654 | } |
655 | + |
|
656 | + /** |
|
657 | + * @param Context $context |
|
658 | + */ |
|
544 | 659 | public function setArgs($context, $values){ |
545 | 660 | $set = []; |
546 | 661 | $params = []; |
@@ -40,6 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | class OnDuplicateKeyUpdateRule extends ExecRule |
42 | 42 | { |
43 | + /** |
|
44 | + * @param \PhpBoot\DB\Context $context |
|
45 | + */ |
|
43 | 46 | public function __construct($context) |
44 | 47 | { |
45 | 48 | parent::__construct($context); |
@@ -69,8 +72,7 @@ discard block |
||
69 | 72 | * ->onDuplicateKeyUpdateArgs(['a'=>Sql::raw('a+1')]) |
70 | 73 | * => "INSERT INTO table(a,b) VALUES(1,now()) ON DUPLICATE KEY UPDATE a=a+1" |
71 | 74 | * |
72 | - * @param string $column |
|
73 | - * @param mixed $value |
|
75 | + * @param mixed $values |
|
74 | 76 | * @return \PhpBoot\DB\rules\basic\ExecRule |
75 | 77 | */ |
76 | 78 | public function onDuplicateKeyUpdateArgs($values) { |
@@ -85,8 +87,6 @@ discard block |
||
85 | 87 | * ->onDuplicateKeyUpdateExpr('a=a+1') |
86 | 88 | * => "INSERT INTO table(a,b) VALUES(1,now()) ON DUPLICATE KEY UPDATE a=a+1" |
87 | 89 | * |
88 | - * @param string $column |
|
89 | - * @param mixed $value |
|
90 | 90 | * @return \PhpBoot\DB\rules\basic\ExecRule |
91 | 91 | */ |
92 | 92 | public function onDuplicateKeyUpdateExpr($expr, $_=null) { |
@@ -111,6 +111,9 @@ discard block |
||
111 | 111 | |
112 | 112 | class OrderByRule extends LimitRule |
113 | 113 | { |
114 | + /** |
|
115 | + * @param \PhpBoot\DB\Context $context |
|
116 | + */ |
|
114 | 117 | public function __construct($context){ |
115 | 118 | parent::__construct($context); |
116 | 119 | $this->order = new OrderByImpl(); |
@@ -208,7 +211,7 @@ discard block |
||
208 | 211 | * "WHERE a=1 AND b IN(1,2) AND c BETWEEN 1 AND 2 AND d<>1" |
209 | 212 | * @param string|array $conditions |
210 | 213 | * //TODO where(callable $query) |
211 | - * @param mixed $_ |
|
214 | + * @param string $_ |
|
212 | 215 | * @return \PhpBoot\DB\rules\select\GroupByRule |
213 | 216 | */ |
214 | 217 | public function where($conditions, $_=null) { |