File tree 7 files changed +41
-66
lines changed
7 files changed +41
-66
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ class TagDeprecated
12
12
*
13
13
* @deprecated
14
14
*/
15
- static public function willBeDeprecated ()
15
+ public static function willBeDeprecated ()
16
16
{
17
17
}
18
18
@@ -21,7 +21,7 @@ static public function willBeDeprecated()
21
21
*
22
22
* @deprecated 1.0.0
23
23
*/
24
- static public function willBeDeprecatedNextVersion ()
24
+ public static function willBeDeprecatedNextVersion ()
25
25
{
26
26
}
27
27
@@ -31,14 +31,14 @@ static public function willBeDeprecatedNextVersion()
31
31
* @see TagDeprecated::apiV2()
32
32
* @deprecated 3.0.0 此方法以被废弃,请使用最新方法v2
33
33
*/
34
- static public function apiV1 ()
34
+ public static function apiV1 ()
35
35
{
36
36
}
37
37
38
38
/**
39
39
* V1已经过时了,我就是最靓的V2方法
40
40
*/
41
- static public function apiV2 ()
41
+ public static function apiV2 ()
42
42
{
43
43
}
44
44
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class TagParam
13
13
* @param string $piece 碎片
14
14
* @return string[]
15
15
*/
16
- static public function join ($ collection , $ piece )
16
+ public static function join ($ collection , $ piece )
17
17
{
18
18
$ collection [] = $ piece ;
19
19
Original file line number Diff line number Diff line change
1
+ @throws
2
+ =======
3
+
4
+ ` @throws ` : 抛出一个异常,告诉调用方需要做好处理异常相关工作.
5
+
6
+ ** 此标签推荐使用PhpStorm进行阅读,可以能直观体现标签的作用**
7
+
8
+ 语法
9
+ =======
10
+
11
+ > ` @throws [Type] [<description>] `
12
+
13
+
14
+ 标签效果
15
+ =======
16
+
17
+ ![ demo.jpg] ( ./docs/demo.png )
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- class BeiException extends Exception {}
4
- class HuException extends Exception {}
5
-
6
- class ClassForThrows
3
+ /**
4
+ * <p>"@throws" : 抛出一个异常,告诉调用方需要做好处理异常相关工作</p>
5
+ *
6
+ * <b>此标签建议在PHPStorm中打开此演示文档,可以看到具体的标签效果</b>
7
+ */
8
+ class TagThrows
7
9
{
8
10
/**
9
- * @throws BeiException
11
+ * 整数相除
12
+ *
13
+ * @param integer $a
14
+ * @param integer $b
15
+ * @return float|int
16
+ * @throws \Exception 被除数不能为0
10
17
*/
11
- public static function throwBeiException ( )
18
+ public static function div ( $ a , $ b )
12
19
{
13
- throw new BeiException ();
14
- }
15
-
16
- /**
17
- * @param boolean $type
18
- * @throws BeiException|HuException
19
- */
20
- public static function throwMixedException ($ type )
21
- {
22
- if ($ type ) {
23
- throw new BeiException ();
20
+ if (empty ($ b )) {
21
+ throw new Exception ('Division by zero ' );
24
22
}
25
23
26
- throw new HuException () ;
24
+ return $ a / $ b ;
27
25
}
28
26
}
29
27
30
- ClassForThrows::throwBeiException ();
31
-
32
- ClassForThrows::throwMixedException (true );
28
+ echo TagThrows::div (1 , 2 );
Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ class TagVar
11
11
/**
12
12
* <1>.第一种使用方法,只定义类型,通常用于类成员变量中
13
13
*
14
- * @var array 标签数组
14
+ * @var array|null 标签数组
15
15
*/
16
- public $ tags ;
16
+ public $ tags = null ;
17
17
}
18
18
19
19
$ tag = new TagVar ();
You can’t perform that action at this time.
0 commit comments