2
class FunctionCommentThrowTagUnitTest
10
public function missingThrowTag()
12
throw new PHP_Exception('Error');
14
}//end missingThrowTag()
18
* Tag and token number mismatch.
20
* @throws PHP_Exception1
22
public function oneMoreThrowsTagNeeded()
24
throw new PHP_Exception1('Error');
25
throw new PHP_Exception2('Error');
27
}//end oneMoreThrowsTagNeeded()
31
* Tag and token number mismatch.
33
* @throws PHP_Exception1
34
* @throws PHP_Exception2
36
public function oneLessThrowsTagNeeded()
38
throw new PHP_Exception1('Error');
40
}//end oneLessThrowsTagNeeded()
44
* Wrong exception type name.
46
* @throws PHP_Wrong_Exception
48
public function wrongExceptionName()
50
throw new PHP_Correct_Exception('Error');
52
}//end wrongExceptionName()
56
* Wrong exception type name.
58
* @throws PHP_Correct_Exception1
59
* @throws PHP_Wrong_Exception2
60
* @throws PHP_Wrong_Exception3
62
public function moreWrongExceptionName()
64
throw new PHP_Correct_Exception1('Error');
65
throw new PHP_Correct_Exception2('Error');
66
throw new PHP_Correct_Exception3('Error');
68
}//end moreWrongExceptionName()
72
* Wrong exception type name.
74
* @throws PHP_Correct_Exception
76
public function sameExceptionName()
78
throw new PHP_Correct_Exception('Error');
79
throw new PHP_Correct_Exception('Error');
81
}//end sameExceptionName()
85
* This is a valid chunk.
87
* @throws PHP_Exception1
88
* @throws PHP_Exception2
90
public function thisShouldWorkOK()
92
throw new PHP_Exception2('Error');
93
throw new PHP_Exception1('Error');
94
throw new PHP_Exception2('Error');
95
throw new PHP_Exception1('Error');
96
throw new PHP_Exception2('Error');
98
}//end thisShouldWorkOK()
102
* This is not OK, missing 2 @throws tag.
104
* @throws PHP_Exception1
105
* @throws PHP_Exception2
107
public function notOK()
109
throw new PHP_Missing_Exception1('Error');
110
throw new PHP_Exception2('Error');
111
throw new PHP_Missing_Exception2('Error');
112
throw new PHP_Missing_Exception2('Error');
113
throw new PHP_Exception1('Error');
114
throw new PHP_Exception2('Error');
115
throw new PHP_Missing_Exception1('Error');
121
* Needs at least 1 throws tag, even though we
122
* don't know what it is.
124
public function notOKVariable()
128
} catch (PHP_Exception2 $e) {
133
}//end notOKVariable()
137
* Needs at least 1 throws tag, even though we
138
* don't know what it is.
140
* @throws PHP_Exception1
142
public function okVariable()
144
throw new PHP_Exception1('Error');
148
} catch (PHP_Exception1 $e) {
157
* Needs 1 @throws tag.
159
* @throws Exception Unknown exception type.
161
function okVariable()