@@ -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("the parameter \"{$meta->source}\" is missing")); |
56 | 56 | $inputs[$meta->name] = $meta->default; |
57 | 57 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | foreach ($this->paramMetas as $meta){ |
71 | 71 | if($meta->isPassedByReference){ |
72 | 72 | $params[$pos] = &$reference[$meta->name]; |
73 | - }else{ |
|
73 | + } else{ |
|
74 | 74 | $params[$pos] = $inputs[$meta->name]; |
75 | 75 | } |
76 | 76 | $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; |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | $obj = new SelectRule(new Context($this->connection)); |
102 | 102 | if($column0 == null){ |
103 | 103 | $args = ['*']; |
104 | - }elseif(is_array($column0)){ |
|
104 | + } elseif(is_array($column0)){ |
|
105 | 105 | $args = $column0; |
106 | - }else{ |
|
106 | + } else{ |
|
107 | 107 | $args = func_get_args(); |
108 | 108 | } |
109 | 109 | foreach ($args as &$arg){ |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $res = $callback($this); |
171 | 171 | $this->getConnection()->commit() or \PhpBoot\abort('commit failed'); |
172 | 172 | return $res; |
173 | - }catch (\Exception $e){ |
|
173 | + } catch (\Exception $e){ |
|
174 | 174 | $this->getConnection()->rollBack(); |
175 | 175 | Logger::warning('commit failed with '.get_class($e).' '.$e->getMessage()); |
176 | 176 | throw $e; |
@@ -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 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | /** |
51 | 51 | * 获取数组的类型 |
52 | - * @param $type |
|
52 | + * @param string|null $type |
|
53 | 53 | * @return string|null |
54 | 54 | */ |
55 | 55 | static function getArrayType($type){ |
@@ -56,7 +56,7 @@ |
||
56 | 56 | self::isArray($type) or \PhpBoot\abort(new \InvalidArgumentException("$type is not array")); |
57 | 57 | if($type == 'array') { |
58 | 58 | return 'mixed'; |
59 | - }else{ |
|
59 | + } else{ |
|
60 | 60 | return substr($type,0,-2); |
61 | 61 | } |
62 | 62 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | if(apc_add($key, 1, $ttl)){ |
10 | 10 | $this->locked = true; |
11 | 11 | return true; |
12 | - }else{ |
|
12 | + } else{ |
|
13 | 13 | return false; |
14 | 14 | } |
15 | 15 | } |