@@ -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) |
@@ -62,13 +62,13 @@ |
||
62 | 62 | $meta = self::readWithoutCache($className); |
63 | 63 | $cache->set($key, $meta, 0, $fileName?new ClassModifiedChecker($className):null); |
64 | 64 | return $meta; |
65 | - }catch (\Exception $e){ |
|
65 | + } catch (\Exception $e){ |
|
66 | 66 | $cache->set($key, $e->getMessage(), 0, $fileName?new ClassModifiedChecker($className):null); |
67 | 67 | throw $e; |
68 | 68 | } |
69 | - }elseif(is_string($res)){ |
|
69 | + } elseif(is_string($res)){ |
|
70 | 70 | \PhpBoot\abort($res); |
71 | - }else{ |
|
71 | + } else{ |
|
72 | 72 | return $res; |
73 | 73 | } |
74 | 74 | } |
@@ -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 | { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $default += [ |
88 | 88 | Cache::class => \DI\object(ApcCache::class) |
89 | 89 | ]; |
90 | - }else{ |
|
90 | + } else{ |
|
91 | 91 | $default += [ |
92 | 92 | Cache::class => \DI\object(FilesystemCache::class) |
93 | 93 | ->constructorParameter('directory', sys_get_temp_dir()) |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } |
271 | 271 | return $next($request); |
272 | 272 | |
273 | - }elseif ($res[0] == Dispatcher::NOT_FOUND) { |
|
273 | + } elseif ($res[0] == Dispatcher::NOT_FOUND) { |
|
274 | 274 | \PhpBoot\abort(new NotFoundHttpException(), [$request->getMethod(), $uri]); |
275 | 275 | } elseif ($res[0] == Dispatcher::METHOD_NOT_ALLOWED) { |
276 | 276 | \PhpBoot\abort(new MethodNotAllowedHttpException($res[1]), [$request->getMethod(), $uri]); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | return $response; |
296 | 296 | |
297 | - }catch (\Exception $e){ |
|
297 | + } catch (\Exception $e){ |
|
298 | 298 | $renderer->render($e); |
299 | 299 | } |
300 | 300 |
@@ -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){ |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | } |
46 | 46 | if($meta->container){ |
47 | 47 | $inputs[$meta->name] = $meta->container->make($source); |
48 | - }else{ |
|
48 | + } else{ |
|
49 | 49 | $inputs[$meta->name] = $source; |
50 | 50 | } |
51 | 51 | if($meta->validation){ |
52 | 52 | $vld->rule($meta->validation, $meta->name); |
53 | 53 | } |
54 | - }else{ |
|
54 | + } else{ |
|
55 | 55 | $meta->isOptional or \PhpBoot\abort(new BadRequestHttpException("param $source is required")); |
56 | 56 | $inputs[$meta->name] = $meta->default; |
57 | 57 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | foreach ($this->paramMetas as $meta){ |
70 | 70 | if($meta->isPassedByReference){ |
71 | 71 | $params[$pos] = &$reference[$meta->name]; |
72 | - }else{ |
|
72 | + } else{ |
|
73 | 73 | $params[$pos] = $inputs[$meta->name]; |
74 | 74 | } |
75 | 75 | $pos++; |
@@ -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; |
@@ -100,9 +100,9 @@ |
||
100 | 100 | $obj = new SelectRule(new Context($this->connection)); |
101 | 101 | if($column0 == null){ |
102 | 102 | $args = ['*']; |
103 | - }elseif(is_array($column0)){ |
|
103 | + } elseif(is_array($column0)){ |
|
104 | 104 | $args = $column0; |
105 | - }else{ |
|
105 | + } else{ |
|
106 | 106 | $args = func_get_args(); |
107 | 107 | } |
108 | 108 | foreach ($args as &$arg){ |
@@ -24,6 +24,9 @@ |
||
24 | 24 | |
25 | 25 | class UpdateSetRule extends WhereRule |
26 | 26 | { |
27 | + /** |
|
28 | + * @param \PhpBoot\DB\Context $context |
|
29 | + */ |
|
27 | 30 | public function __construct($context){ |
28 | 31 | parent::__construct($context); |
29 | 32 | $this->impl = new UpdateSetImpl(); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | - * @param $object |
|
91 | + * @param Swagger $object |
|
92 | 92 | * @return array |
93 | 93 | */ |
94 | 94 | static public function objectToArray($object) |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | /** |
114 | 114 | * @param Application $app |
115 | 115 | * @param ControllerContainer $controller |
116 | - * @param $action |
|
116 | + * @param integer $action |
|
117 | 117 | * @param Route $route |
118 | 118 | * @return array |
119 | 119 | */ |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | /** |
163 | 163 | * @param Application $app |
164 | 164 | * @param ControllerContainer $controller |
165 | - * @param $action |
|
165 | + * @param integer $action |
|
166 | 166 | * @param Route $route |
167 | 167 | * @return null|ResponseObject |
168 | 168 | */ |
@@ -299,6 +299,9 @@ discard block |
||
299 | 299 | return new RefSchemaObject("#/definitions/$name"); |
300 | 300 | } |
301 | 301 | |
302 | + /** |
|
303 | + * @param integer $action |
|
304 | + */ |
|
302 | 305 | public function getParamsSchema(Application $app, |
303 | 306 | ControllerContainer $controller, |
304 | 307 | $action, |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | { |
214 | 214 | if ($content instanceof ReturnMeta || $content instanceof ParamMeta) { |
215 | 215 | return $this->makeExample($content->container); |
216 | - }elseif ($content instanceof TypeContainerInterface){ |
|
216 | + } elseif ($content instanceof TypeContainerInterface){ |
|
217 | 217 | return $content->makeExample(); |
218 | - }elseif(is_array($content)) { |
|
218 | + } elseif(is_array($content)) { |
|
219 | 219 | $res = []; |
220 | 220 | foreach ($content as $k => $v) { |
221 | 221 | $res[$k] = $this->makeExample($v); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $paramSchema = new PrimitiveSchemaObject(); |
371 | 371 | if($isFile){ |
372 | 372 | $paramSchema->type = 'file'; |
373 | - }else{ |
|
373 | + } else{ |
|
374 | 374 | $paramSchema->type = self::mapType($param->type); |
375 | 375 | self::mapValidation($param->validation, $paramSchema); |
376 | 376 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } elseif($container == null){ |
429 | 429 | $schema = null ;//new PrimitiveSchemaObject(); |
430 | 430 | //$schema->type = null; |
431 | - }else { |
|
431 | + } else { |
|
432 | 432 | $schema = new PrimitiveSchemaObject(); |
433 | 433 | //$schema->type = 'mixed'; |
434 | 434 | } |
@@ -5,6 +5,9 @@ discard block |
||
5 | 5 | */ |
6 | 6 | class AnnotationParams implements \Countable, \ArrayAccess |
7 | 7 | { |
8 | + /** |
|
9 | + * @param integer $limit |
|
10 | + */ |
|
8 | 11 | public function __construct($text, $limit) |
9 | 12 | { |
10 | 13 | if($limit == 1){ |
@@ -142,6 +145,12 @@ discard block |
||
142 | 145 | } |
143 | 146 | } |
144 | 147 | |
148 | + /** |
|
149 | + * @param integer $pos |
|
150 | + * @param string $default |
|
151 | + * |
|
152 | + * @return string |
|
153 | + */ |
|
145 | 154 | public function getRawParam($pos, $default = null) |
146 | 155 | { |
147 | 156 | if(isset($this->rawParams[$pos])){ |
@@ -151,6 +160,9 @@ discard block |
||
151 | 160 | } |
152 | 161 | } |
153 | 162 | |
163 | + /** |
|
164 | + * @param boolean $ignoreError |
|
165 | + */ |
|
154 | 166 | private function stripSlashes($text, $ignoreError) |
155 | 167 | { |
156 | 168 | if(strlen($text)>=2 && substr($text,0,1) == '"'){ |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | list($chars, $offset) = $found[0]; |
117 | 117 | if($chars == '\\'){ |
118 | 118 | return $pos+$offset+2; |
119 | - }else{ |
|
119 | + } else{ |
|
120 | 120 | $next = 'stateNormal'; |
121 | 121 | return $pos+$offset+1; |
122 | 122 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $param = $this->stripSlashes($param, $ignoreError); |
138 | 138 | $this->cachedParams[$pos] = $param; |
139 | 139 | return $param; |
140 | - }else{ |
|
140 | + } else{ |
|
141 | 141 | return $default; |
142 | 142 | } |
143 | 143 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | { |
147 | 147 | if(isset($this->rawParams[$pos])){ |
148 | 148 | return $this->rawParams[$pos]; |
149 | - }else{ |
|
149 | + } else{ |
|
150 | 150 | return $default; |
151 | 151 | } |
152 | 152 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if(json_last_error()){ |
159 | 159 | if($ignoreError){ |
160 | 160 | return $text; |
161 | - }else{ |
|
161 | + } else{ |
|
162 | 162 | \PhpBoot\abort('json_decode failed with '.json_last_error_msg(), [$text]); |
163 | 163 | } |
164 | 164 | } |