changed git call from https to git readonly
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / Errors.inc
1 <?php\r
2 /**\r
3  * Error handling for phpDocumentor\r
4  *\r
5  * phpDocumentor :: automatic documentation generator\r
6  * \r
7  * PHP versions 4 and 5\r
8  *\r
9  * Copyright (c) 2001-2007 Gregory Beaver\r
10  * \r
11  * LICENSE:\r
12  * \r
13  * This library is free software; you can redistribute it\r
14  * and/or modify it under the terms of the GNU Lesser General\r
15  * Public License as published by the Free Software Foundation;\r
16  * either version 2.1 of the License, or (at your option) any\r
17  * later version.\r
18  * \r
19  * This library is distributed in the hope that it will be useful,\r
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
22  * Lesser General Public License for more details.\r
23  * \r
24  * You should have received a copy of the GNU Lesser General Public\r
25  * License along with this library; if not, write to the Free Software\r
26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
27  *\r
28  * @category   ToolsAndUtilities\r
29  * @package    phpDocumentor\r
30  * @subpackage Errors\r
31  * @author     Greg Beaver <cellog@php.net>\r
32  * @copyright  2001-2007 Gregory Beaver\r
33  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL\r
34  * @version    CVS: $Id: Errors.inc,v 1.17 2007/12/13 02:58:25 ashnazg Exp $\r
35  * @filesource\r
36  * @link       http://www.phpdoc.org\r
37  * @link       http://pear.php.net/PhpDocumentor\r
38  * @see        parserDocBlock, parserInclude, parserPage, parserClass\r
39  * @see        parserDefine, parserFunction, parserMethod, parserVar\r
40  * @since      0.4\r
41  * @todo       CS cleanup - change package to PhpDocumentor\r
42  */\r
43 /**\r
44  * warning triggered when inheritance could be from more than one class\r
45  */\r
46 define("PDERROR_MULTIPLE_PARENT", 1);\r
47 /**\r
48  * warning triggered when parent class doesn't exist\r
49  */\r
50 define("PDERROR_PARENT_NOT_FOUND", 2);\r
51 /**\r
52  * warning triggered when an {@inline tag} is not terminated\r
53  * (no } before the * / ending the comment)\r
54  */\r
55 define("PDERROR_UNTERMINATED_INLINE_TAG", 3);\r
56 /**\r
57  * warning triggered when inheritance could be from more than one class\r
58  */\r
59 define("PDERROR_CLASS_EXISTS", 4);\r
60 /**\r
61  * warning triggered when inheritance could be from more than one class\r
62  */\r
63 define("PDERROR_INHERITANCE_CONFLICT", 5);\r
64 /**\r
65  * warning triggered when a converter is passed to \r
66  * {@link phpDocumentor_IntermediateParser::addConverter()} that is not a class\r
67  */\r
68 define("PDERROR_CONVERTER_NOT_FOUND", 6);\r
69 /**\r
70  * warning triggered when a converter is passed to \r
71  * {@link phpDocumentor_IntermediateParser::addConverter()} that is not a class\r
72  */\r
73 define("PDERROR_NO_CONVERTERS", 7);\r
74 /**\r
75  * warning triggered when the arguments to @access are neither public nor private\r
76  */\r
77 define("PDERROR_ACCESS_WRONG_PARAM", 8);\r
78 /**\r
79  * warning triggered when there are multiple @access tags in a docblock\r
80  */\r
81 define("PDERROR_MULTIPLE_ACCESS_TAGS", 9);\r
82 /**\r
83  * warning triggered when there are multiple @return tags in a docblock\r
84  */\r
85 define("PDERROR_MULTIPLE_RETURN_TAGS", 10);\r
86 /**\r
87  * warning triggered when there are multiple @var tags in a docblock\r
88  */\r
89 define("PDERROR_MULTIPLE_VAR_TAGS", 11);\r
90 /**\r
91  * warning triggered when there are multiple @package tags in a docblock\r
92  */\r
93 define("PDERROR_MULTIPLE_PACKAGE_TAGS", 12);\r
94 /**\r
95  * warning triggered when there are multiple @subpackage tags in a docblock\r
96  */\r
97 define("PDERROR_MULTIPLE_SUBPACKAGE_TAGS", 13);\r
98 /**\r
99  * warning triggered when the package or subpackage name is illegal\r
100  */\r
101 define("PDERROR_ILLEGAL_PACKAGENAME", 14);\r
102 /**\r
103  * warning triggered when there a @package tag is used in a function,\r
104  * define, method, var or include\r
105  */\r
106 define("PDERROR_OVERRIDDEN_PACKAGE_TAGS", 15);\r
107 /**\r
108  * warning triggered when there a @subpackage tag is used in a function,\r
109  * define, method, var or include\r
110  */\r
111 define("PDERROR_OVERRIDDEN_SUBPACKAGE_TAGS", 16);\r
112 /**\r
113  * warning triggered when classes in the same package have the same name\r
114  */\r
115 define("PDERROR_CLASS_CONFLICT", 17);\r
116 /**\r
117  * warning triggered when classes in the same package have the same name\r
118  */\r
119 define("PDERROR_UNKNOWN_TAG", 18);\r
120 /**\r
121  * warning triggered when there are multiple @name tags in a docblock\r
122  */\r
123 define("PDERROR_MULTIPLE_NAME_TAGS", 19);\r
124 /**\r
125  * warning triggered when there are multiple @name tags in a docblock\r
126  * @todo I think this description is a copy/paste that was never updated\r
127  */\r
128 define("PDERROR_PACKAGEOUTPUT_DELETES_PARENT_FILE", 20);\r
129 /**\r
130  * warning triggered when there are multiple @name tags in a docblock\r
131  * @todo I think this description is a copy/paste that was never updated\r
132  */\r
133 define("PDERROR_GLOBAL_NOT_FOUND", 21);\r
134 /**\r
135  * warning triggered when there are multiple @name tags in a docblock\r
136  * @todo I think this description is a copy/paste that was never updated\r
137  */\r
138 define("PDERROR_MULTIPLE_GLOBAL_TAGS", 22);\r
139 /**\r
140  * warning triggered when there are multiple @name tags in a docblock\r
141  * @todo I think this description is a copy/paste that was never updated\r
142  */\r
143 define("PDERROR_MALFORMED_GLOBAL_TAG", 23);\r
144 /**\r
145  * warning triggered when an @ignore tag is used in a DocBlock preceding\r
146  * a method, variable, include, or global variable\r
147  */\r
148 define("PDERROR_IGNORE_TAG_IGNORED", 24);\r
149 /**\r
150  * warning triggered when a duplicate element is encountered that will be\r
151  * ignored by the documentor\r
152  */\r
153 define("PDERROR_ELEMENT_IGNORED", 25);\r
154 /**\r
155  * warning triggered when an entire page is ignored because of @access private\r
156  */\r
157 define("PDERROR_PARSEPRIVATE", 26);\r
158 /**\r
159  * warning triggered when an entire page is ignored because of @access private\r
160  * @todo I think this description is a copy/paste that was never updated\r
161  */\r
162 define("PDERROR_UNKNOWN_COMMANDLINE", 27);\r
163 /**\r
164  * warning triggered when an entire page is ignored because of @access private\r
165  * @todo I think this description is a copy/paste that was never updated\r
166  */\r
167 define("PDERROR_NEED_WHITESPACE", 28);\r
168 /**\r
169  * warning triggered when an entire page is ignored because of @access private\r
170  * @todo I think this description is a copy/paste that was never updated\r
171  */\r
172 define("PDERROR_CLASS_PARENT_NOT_FOUND", 29);\r
173 /**\r
174  * warning triggered when a getClassByPackage is called and can't find the class\r
175  */\r
176 define("PDERROR_CLASS_NOT_IN_PACKAGE", 30);\r
177 /**\r
178  * warning triggered when a { @source } inline tag is used in a docblock not\r
179  * preceding a function\r
180  */\r
181 define("PDERROR_SOURCE_TAG_FUNCTION_NOT_FOUND", 31);\r
182 /**\r
183  * warning triggered when a docblock template is never turned off\r
184  * with /**#@-* / (no space)\r
185  */\r
186 define("PDERROR_DB_TEMPLATE_UNTERMINATED", 32);\r
187 /**\r
188  * warning triggered when a docblock has an unmatched &lt;ol&gt; or &lt;ul&gt;\r
189  */\r
190 define("PDERROR_UNMATCHED_LIST_TAG", 33);\r
191 /**\r
192  * warning triggered when another tag is nested in &lt;b&gt; \r
193  * (not allowed in phpDocumentor)\r
194  */\r
195 define("PDERROR_CANT_NEST_IN_B", 34);\r
196 /**\r
197  * warning triggered when a docbook tag is not properly matched\r
198  */\r
199 define("PDERROR_UNMATCHED_TUTORIAL_TAG", 35);\r
200 /**\r
201  * warning triggered when an inline tag is found inside an xml tag name\r
202  * in a package page\r
203  */\r
204 define("PDERROR_CANT_HAVE_INLINE_IN_TAGNAME", 36);\r
205 /**\r
206  * warning triggered when a tutorial is referenced\r
207  * via @tutorial/{ @tutorial} and is not found\r
208  */\r
209 define("PDERROR_TUTORIAL_NOT_FOUND", 37);\r
210 /**\r
211  * warning triggered when a tutorial lists itself as a child tutorial\r
212  */\r
213 define("PDERROR_TUTORIAL_IS_OWN_CHILD", 38);\r
214 /**\r
215  * warning triggered when a tutorial's child lists the parent tutorial\r
216  * as a child tutorial\r
217  */\r
218 define("PDERROR_TUTORIAL_IS_OWN_GRANDPA", 39);\r
219 /**\r
220  * warning triggered when a tutorial's child in the .ini file doesn't exist in the\r
221  * package and subpackage of the parent\r
222  */\r
223 define("PDERROR_CHILD_TUTORIAL_NOT_FOUND", 40);\r
224 /**\r
225  * warning triggered when a <pdffunction:funcname /> tag is used in the PDF\r
226  * Converter and no funcname is present (<pdffunction: />)\r
227  */\r
228 define("PDERROR_PDFFUNCTION_NO_FUNC", 41);\r
229 /**\r
230  * warning triggered when a <pdffunction:funcname /> tag is used in the PDF\r
231  * Converter and funcname is not a {@link Cezpdf} method\r
232  */\r
233 define("PDERROR_PDF_METHOD_DOESNT_EXIST", 42);\r
234 /**\r
235  * warning triggered when a <pdffunction:funcname arg=$tempvar/> tag \r
236  * is used in the PDF\r
237  * Converter and "tempvar" is not set from the return of a previous pdffunction tag\r
238  */\r
239 define("PDERROR_PDF_TEMPVAR_DOESNT_EXIST", 43);\r
240 /**\r
241  * warning triggered when a subsection's title is asked for, but the subsection\r
242  * is not found\r
243  */\r
244 define("PDERROR_TUTORIAL_SUBSECTION_NOT_FOUND", 44);\r
245 /**\r
246  * warning triggered when a subsection's title is asked for, but the subsection\r
247  * is not found\r
248  */\r
249 define("PDERROR_UNTERMINATED_ATTRIB", 45);\r
250 /**\r
251  * warning triggered when no @package tag is used in a page-level\r
252  * or class-level DocBlock\r
253  */\r
254 define("PDERROR_NO_PACKAGE_TAG", 46);\r
255 /**\r
256  * warning triggered when no @access private tag is used in a\r
257  * global variable/method/var with _ as first char in name\r
258  * and --pear was specified\r
259  */\r
260 define("PDERROR_PRIVATE_ASSUMED", 47);\r
261 /**\r
262  * warning triggered when an example's path from @example /path/to/example.php\r
263  * is not found\r
264  */\r
265 define("PDERROR_EXAMPLE_NOT_FOUND", 48);\r
266 /**\r
267  * warning triggered when an example's path from @example /path/to/example.php\r
268  * is not found\r
269  */\r
270 define("PDERROR_NO_CONVERTER_HANDLER", 49);\r
271 /**\r
272  * warning triggered when an example's path from @example /path/to/example.php\r
273  * is not found\r
274  */\r
275 define("PDERROR_INLINETAG_IN_SEE", 50);\r
276 /**\r
277  * warning triggered when an id attribute in a tutorial docbook tag is not\r
278  * an {@}id} inline tag\r
279  */\r
280 define("PDERROR_ID_MUST_BE_INLINE", 51);\r
281 /**\r
282  * warning triggered when an {@}internal}} tag is not closed\r
283  */\r
284 define("PDERROR_INTERNAL_NOT_CLOSED", 52);\r
285 /**\r
286  * warning triggered when an {@}source} tag is found in a short description\r
287  */\r
288 define("PDERROR_SOURCE_TAG_IGNORED", 53);\r
289 /**\r
290  * warning triggered when a child converter doesn't override \r
291  * getFormattedClassTrees()\r
292  */\r
293 define("PDERROR_CONVERTER_OVR_GFCT", 54);\r
294 /**\r
295  * warning triggered when a package is already associated with a category, and\r
296  * a new association is found\r
297  */\r
298 define("PDERROR_PACKAGECAT_SET", 55);\r
299 /**\r
300  * warning triggered when text in a docblock list is not contained in\r
301  * an <<li>> opening tag\r
302  */\r
303 define("PDERROR_TEXT_OUTSIDE_LI", 56);\r
304 /**\r
305  * warning triggered when a DocBlock html tag is unclosed\r
306  */\r
307 define("PDERROR_UNCLOSED_TAG", 57);\r
308 /**\r
309  * warning triggered by @filesource, if PHP < 4.3.0\r
310  */\r
311 define("PDERROR_TAG_NOT_HANDLED", 58);\r
312 /**\r
313  * warning triggered by sourcecode="on", if PHP < 4.3.0\r
314  */\r
315 define("PDERROR_SOURCECODE_IGNORED", 59);\r
316 /**\r
317  * warning triggered by an empty tag\r
318  */\r
319 define("PDERROR_MALFORMED_TAG", 60);\r
320 /**\r
321  * warning triggered by more than 1 @category tag\r
322  */\r
323 define("PDERROR_MULTIPLE_CATEGORY_TAGS", 61);\r
324 /**\r
325  * warning triggered by {@}inheritdoc} in a non-inheritable situation\r
326  */\r
327 define("PDERROR_INHERITDOC_DONT_WORK_HERE", 62);\r
328 /**\r
329  * warning triggered by @example path/to/example with no title\r
330  */\r
331 define("PDERROR_EMPTY_EXAMPLE_TITLE", 63);\r
332 /**\r
333  * warning triggered by non-existent template directory\r
334  */\r
335 define("PDERROR_TEMPLATEDIR_DOESNT_EXIST", 64);\r
336 /**\r
337  * warning triggered by an unterminated entity in a tutorial\r
338  */\r
339 define("PDERROR_UNTERMINATED_ENTITY", 65);\r
340 /**\r
341  * warning triggered by an unterminated entity in a tutorial\r
342  */\r
343 define("PDERROR_BEAUTIFYING_FAILED", 66);\r
344 /**\r
345  * warning triggered by a function with no name\r
346  *\r
347  * <pre>\r
348  * function ($params)\r
349  * {\r
350  * }\r
351  * </pre>\r
352  * triggers this error\r
353  */\r
354 define("PDERROR_FUNCTION_HAS_NONAME", 67);\r
355 /**\r
356  * warning triggered by a page-level docblock preceding a source element\r
357  *\r
358  * <code>\r
359  * <?php\r
360  * /**\r
361  *  * Page-level DocBlock\r
362  *  * @package pagepackage\r
363  *  *{@*}\r
364  * include 'file.php';\r
365  * </code>\r
366  */\r
367 define("PDERROR_DOCBLOCK_CONFLICT", 68);\r
368 /**\r
369  * warning triggered when a file does not contain a page-level docblock\r
370  */\r
371 define("PDERROR_NO_PAGE_LEVELDOCBLOCK", 69);\r
372 /**\r
373  * warning triggered when the first docblock in a file with a @package tag\r
374  * precedes a class.  In this case, the class gets the docblock.\r
375  */\r
376 define("PDERROR_DOCBLOCK_GOES_CLASS", 70);\r
377 /**\r
378  * warning triggered in tutorial parsing if there is a missing {@id} inline tag\r
379  */\r
380 define("PDERROR_NO_DOCBOOK_ID", 71);\r
381 /**\r
382  * warning triggered if someone brilliant tries "class X extends X {"\r
383  */\r
384 define("PDERROR_CANNOT_EXTEND_SELF", 72);\r
385 /**\r
386  * warning triggered by improper "@uses {@link blah}"\r
387  */\r
388 define("PDERROR_DUMB_USES", 73);\r
389 /**\r
390  * warning triggered if <<ul>> is nested inside <<ul>> and not <<li>>\r
391  */\r
392 define("PDERROR_UL_IN_UL", 74);\r
393 /**\r
394  * warning triggered if a command line option does not have a valid value passed in\r
395  */\r
396 define("PDERROR_INVALID_VALUES", 75);\r
397 /**\r
398  * warning triggered when {@}internal}} is nested inside another {@}internal}}\r
399  */\r
400 define("PDERROR_NESTED_INTERNAL", 76);\r
401 /**\r
402  * warning triggered when @todo is used on an include element\r
403  */\r
404 define("PDERROR_NOTODO_INCLUDE", 77);\r
405 /**\r
406  *      warning triggered when a class or method hasn't got docblock\r
407  */\r
408 define("PDERROR_UNDOCUMENTED_ELEMENT", 78);\r
409 /**\r
410  * warning triggered when any of {@}property}}, {@}property-read}},\r
411  * {@}property-write}}, or {@}method}} tag does not have name\r
412  */\r
413 define("PDERROR_MISSING_PROPERTY_TAG_NAME", 79);\r
414 /**\r
415  * warning triggered when the PHP version being used has dangerous bug/behavior\r
416  */\r
417 define("PDERROR_DANGEROUS_PHP_BUG_EXISTS", 80);\r
418 /**\r
419  * warning triggered when the alias value in an page-level docblock's @name tag\r
420  * is the same value as the target filename is it supposed to alias\r
421  */\r
422 define("PDERROR_NAME_ALIAS_SAME_AS_TARGET", 81);\r
423 /**\r
424  * warning triggered when the a loop recursion tripwire has been tripped\r
425  */\r
426 define("PDERROR_LOOP_RECURSION_LIMIT_REACHED", 82);\r
427 \r
428 /**\r
429  * Error messages for phpDocumentor parser warnings\r
430  * @global array $GLOBALS['phpDocumentor_warning_descrip']\r
431  * @name $phpDocumentor_warning_descrip\r
432  */\r
433 $GLOBALS['phpDocumentor_warning_descrip'] =\r
434     array(\r
435         PDERROR_MULTIPLE_PARENT => \r
436             'Class %s has multiple possible parents, package inheritance aborted'\r
437         ,\r
438         PDERROR_PARENT_NOT_FOUND => \r
439             'Class %s parent %s not found'\r
440         ,\r
441         PDERROR_INHERITANCE_CONFLICT => \r
442             'Class %s in file %s has multiple possible parents named %s.  ' .\r
443             'Cannot resolve name conflict,' . "\n" . \r
444             ' try ignoring a file that contains the conflicting parent class'\r
445         ,\r
446         PDERROR_UNKNOWN_TAG => \r
447             'Unknown tag "@%s" used'\r
448         ,\r
449         PDERROR_IGNORE_TAG_IGNORED => \r
450             '@ignore tag used for %s element "%s" will be ignored'\r
451         ,\r
452         PDERROR_ELEMENT_IGNORED => \r
453             "\n" . 'duplicate %s element "%s" in file %s will be ignored.' . "\n" .\r
454             'Use an @ignore tag on the original ' .\r
455             'if you want this case to be documented.'\r
456         ,\r
457         PDERROR_PARSEPRIVATE => \r
458             "entire page %s ignored because of @access private." . "\n" . \r
459             "Choose -pp to enable parsing of private elements"\r
460         ,\r
461         PDERROR_CLASS_PARENT_NOT_FOUND => \r
462             "class %s in package %s parent not found in @see parent::%s"\r
463         ,\r
464         PDERROR_CLASS_NOT_IN_PACKAGE => \r
465             "class %s was not found in package %s"\r
466         ,\r
467         PDERROR_DB_TEMPLATE_UNTERMINATED => \r
468             'docblock template never terminated with /**#@-*/'\r
469         ,\r
470         PDERROR_PDF_METHOD_DOESNT_EXIST => \r
471             '<pdffunction:%s /> called, but pdf method "%s" doesn\'t exist'\r
472         ,\r
473         PDERROR_TUTORIAL_NOT_FOUND => \r
474             "tutorial \"%s\" not found, does it exist?"\r
475         ,\r
476         PDERROR_CHILD_TUTORIAL_NOT_FOUND => \r
477             'child tutorial "%s" listed in %s not found ' . \r
478             'in parent package "%s" subpackage "%s"'\r
479         ,\r
480         PDERROR_TUTORIAL_SUBSECTION_NOT_FOUND => \r
481             'tutorial %s subsection "%s" doesn\'t exist, ' .\r
482             'but its title was asked for'\r
483         ,\r
484         PDERROR_NO_PACKAGE_TAG => \r
485             'no @package tag was used in a DocBlock for %s %s'\r
486         ,\r
487         PDERROR_PRIVATE_ASSUMED => \r
488             '%s "%s" is assumed to be @access private because its name ' .\r
489             'starts with _, but has no @access tag'\r
490         ,\r
491         PDERROR_EXAMPLE_NOT_FOUND => \r
492             'example file "%s" does not exist'\r
493         ,\r
494         PDERROR_SOURCE_TAG_IGNORED => \r
495             '{@source} can only be used in the long description, ' .\r
496             'not in the short description: "%s"'\r
497         ,\r
498         PDERROR_PACKAGECAT_SET => \r
499             'package %s is already in category %s, ' .\r
500             'will now replace with category %s'\r
501         ,\r
502         PDERROR_SOURCECODE_IGNORED => \r
503             'sourcecode command-line option is ignored ' . \r
504             'when your PHP build has no tokenizer support'\r
505         ,\r
506         PDERROR_INHERITDOC_DONT_WORK_HERE => \r
507             '{@inheritdoc} can only be used in the docblock of a child class'\r
508         ,\r
509         PDERROR_EMPTY_EXAMPLE_TITLE => \r
510             'Example file found at "%s" has no title, using "%s"'\r
511         ,\r
512         PDERROR_DOCBLOCK_CONFLICT => \r
513             'Page-level DocBlock precedes "%s %s", ' .\r
514             'use another DocBlock to document the source element'\r
515         ,\r
516         PDERROR_NO_PAGE_LEVELDOCBLOCK => \r
517             'File "%s" has no page-level DocBlock, ' .\r
518             'use @package in the first DocBlock to create one'\r
519         ,\r
520         PDERROR_DOCBLOCK_GOES_CLASS => \r
521             'DocBlock would be page-level, but precedes class "%s", ' .\r
522             'use another DocBlock to document the file'\r
523         ,\r
524         PDERROR_NO_DOCBOOK_ID => \r
525             'Tutorial section %s "%s" has no id="{@id subsection}" tag ' .\r
526             '({@id} for refentry)'\r
527         ,\r
528         PDERROR_BEAUTIFYING_FAILED => \r
529             'Beautifying failed: %s'\r
530         ,\r
531         PDERROR_NOTODO_INCLUDE => \r
532             '@todo on an include element is ignored (line %s, file %s)'\r
533         ,\r
534         PDERROR_UNDOCUMENTED_ELEMENT => \r
535             '%s "%s" has no %s-level DocBlock.'\r
536         ,\r
537         PDERROR_MISSING_PROPERTY_TAG_NAME => \r
538             '@%s magic tag does not have name, illegal. Ignoring tag "@%s %s %s"'\r
539         ,\r
540         PDERROR_NAME_ALIAS_SAME_AS_TARGET => \r
541             '@name value is the same as the filename it is supposed to alias'\r
542         );\r
543 \r
544 \r
545 \r
546 //********************************************************\r
547 \r
548 \r
549 \r
550 /**\r
551  * Error messages for phpDocumentor parser errors\r
552  * @global array $GLOBALS['phpDocumentor_error_descrip']\r
553  * @name $phpDocumentor_error_descrip\r
554  */\r
555 $GLOBALS['phpDocumentor_error_descrip'] = \r
556     array(\r
557         PDERROR_UNTERMINATED_INLINE_TAG => \r
558             'Inline tag {@%s} in tag %s is unterminated, "%s"'\r
559         ,\r
560         PDERROR_CLASS_EXISTS => \r
561             'Class %s already exists in package "%s"'\r
562         ,\r
563         PDERROR_CONVERTER_NOT_FOUND => \r
564             'Converter %s specified by --output command-line option is not a class'\r
565         ,\r
566         PDERROR_NO_CONVERTERS => \r
567             'No Converters have been specified by --output command-line option'\r
568         ,\r
569         PDERROR_ACCESS_WRONG_PARAM => \r
570             '@access was passed neither "public" nor "private."  Was passed: "%s"'\r
571         ,\r
572         PDERROR_MULTIPLE_ACCESS_TAGS => \r
573             'DocBlock has multiple @access tags, illegal. ' .\r
574             'ignoring additional tag "@access %s"'\r
575         ,\r
576         PDERROR_MULTIPLE_RETURN_TAGS => \r
577             'DocBlock has multiple @return tags, illegal. ' .\r
578             'ignoring additional tag "@return %s %s"'\r
579         ,\r
580         PDERROR_MULTIPLE_VAR_TAGS => \r
581             'DocBlock has multiple @var tags, illegal. ' .\r
582             'ignoring additional tag "@var %s %s"'\r
583         ,\r
584         PDERROR_MULTIPLE_PACKAGE_TAGS => \r
585             'DocBlock has multiple @package tags, illegal. ' .\r
586             'ignoring additional tag "@package %s"'\r
587         ,\r
588         PDERROR_MULTIPLE_SUBPACKAGE_TAGS => \r
589             'DocBlock has multiple @subpackage tags, illegal. ' .\r
590             'ignoring additional tag "@subpackage %s"'\r
591         ,\r
592         PDERROR_ILLEGAL_PACKAGENAME => \r
593             '@%s tag has illegal %s name "%s"'\r
594         ,\r
595         PDERROR_OVERRIDDEN_PACKAGE_TAGS => \r
596             '%s %s\'s DocBlock has @package tag, illegal. ' .\r
597             'ignoring tag "@package %s"'\r
598         ,\r
599         PDERROR_OVERRIDDEN_SUBPACKAGE_TAGS => \r
600             '"%s" %s\'s DocBlock has @subpackage tags, illegal. ' .\r
601             'ignoring tag "@subpackage %s"'\r
602         ,\r
603         PDERROR_CLASS_CONFLICT => \r
604             'class "%s" has multiple declarations in package %s, ' .\r
605             'in file %s and file %s, documentation will have output errors!'\r
606         ,\r
607         PDERROR_MULTIPLE_NAME_TAGS => \r
608             'DocBlock has multiple @name tags, illegal. ' .\r
609             'ignoring additional tag "@name %s"'\r
610         ,\r
611         PDERROR_PACKAGEOUTPUT_DELETES_PARENT_FILE => \r
612             '-po (packageoutput) option deletes parent file "%s" containing class' .\r
613             ' "%s."' . "\n" . '  Try using --defaultpackagename (-dn) %s to ' .\r
614             'include the parent file in the same package as the class'\r
615         ,\r
616         PDERROR_GLOBAL_NOT_FOUND => \r
617             'global variable %s specified in @global tag was never found'\r
618         ,\r
619         PDERROR_MULTIPLE_GLOBAL_TAGS => \r
620             '@global define tag already used for global variable "%s", ' .\r
621             'ignoring @global %s'\r
622         ,\r
623         PDERROR_MALFORMED_GLOBAL_TAG => \r
624             'incorrect @global syntax.  ' .\r
625             'Should be @global vartype $varname or @global vartype description'\r
626         ,\r
627         PDERROR_UNKNOWN_COMMANDLINE => \r
628             'Unknown command-line option "%s" encountered, use phpdoc -h for help'\r
629         ,\r
630         PDERROR_NEED_WHITESPACE => \r
631             'phpDocumentor programmer error - wordparser whitespace set to false ' .\r
632             'in handleDocBlock, notify developers.  You should never see this error'\r
633         ,\r
634         PDERROR_SOURCE_TAG_FUNCTION_NOT_FOUND => \r
635             '{@source} tag used in a docblock that isn\'t preceding a function'\r
636         ,\r
637         PDERROR_UNMATCHED_LIST_TAG => \r
638             'unmatched ol or ul tag in DocBlock, parsing will be incorrect'\r
639         ,\r
640         PDERROR_CANT_NEST_IN_B => \r
641             'Can\'t nest a code, pre, ul, or ol tag in a b tag in ' .\r
642             'phpDocumentor DocBlock (%s tag nested)'\r
643         ,\r
644         PDERROR_UNMATCHED_TUTORIAL_TAG => \r
645             'While parsing extended documentation, "%s" tag was matched ' .\r
646             'with "%s" endtag, missing endtag'."\ntag contents:\"%s\""\r
647         ,\r
648         PDERROR_CANT_HAVE_INLINE_IN_TAGNAME => \r
649             'Can\'t have an inline tag inside a package page XML tag!'\r
650         ,\r
651         PDERROR_TUTORIAL_IS_OWN_CHILD => \r
652             'Tutorial %s lists itself as its own child in %s, illegal'\r
653         ,\r
654         PDERROR_TUTORIAL_IS_OWN_GRANDPA => \r
655             'Tutorial %s\'s child %s lists %s as its child in %s, illegal'\r
656         ,\r
657         PDERROR_PDFFUNCTION_NO_FUNC => \r
658             'Invalid pdffunction syntax: "<pdffunction: />", ' .\r
659             'should be "<pdffunction:functionname [arg="value"...]/>"'\r
660         ,\r
661         PDERROR_PDF_TEMPVAR_DOESNT_EXIST => \r
662             '<pdffunction:%s arg=%s /> called ' .\r
663             'but temporary variable "%s" doesn\'t exist'\r
664         ,\r
665         PDERROR_UNTERMINATED_ATTRIB => \r
666             'Tutorial tag %s attribute %s is unterminated, current value "%s"'\r
667         ,\r
668         PDERROR_NO_CONVERTER_HANDLER => \r
669             'Handler for element of type "%s" called, but %s is not a method of %s'\r
670         ,\r
671         PDERROR_INLINETAG_IN_SEE => \r
672             'Inline tags are not allowed in a @see tag'\r
673         ,\r
674         PDERROR_ID_MUST_BE_INLINE => \r
675             '<%s id="%s"> must be <%s id="{@id %s}">'\r
676         ,\r
677         PDERROR_INTERNAL_NOT_CLOSED => \r
678             '{@internal was never terminated with }}'\r
679         ,\r
680         PDERROR_CONVERTER_OVR_GFCT => \r
681             'Converter "%s" must override getFormattedClassTrees() but doesn\'t'\r
682         ,\r
683         PDERROR_TEXT_OUTSIDE_LI => \r
684             'Text cannot be outside of li tag in a DocBlock list, ' .\r
685             'parsing will be incorrect'\r
686         ,\r
687         PDERROR_UNCLOSED_TAG => \r
688             'Unclosed %s tag in DocBlock, parsing will be incorrect'\r
689         ,\r
690         PDERROR_TAG_NOT_HANDLED => \r
691             '"%s" tag is not available in PHP built without tokenizer support, tag ignored'\r
692         ,\r
693         PDERROR_MALFORMED_TAG => \r
694             '"%s" tag was used without any parameters, illegal'\r
695         ,\r
696         PDERROR_MULTIPLE_CATEGORY_TAGS => \r
697             'package has multiple @category tags, ignoring "@category %s"'\r
698         ,\r
699         PDERROR_TEMPLATEDIR_DOESNT_EXIST => \r
700             'template directory "%s" does not exist'\r
701         ,\r
702         PDERROR_UNTERMINATED_ENTITY => \r
703             'entity &%s is unterminated'\r
704         ,\r
705         PDERROR_FUNCTION_HAS_NONAME => \r
706             'function has no name (PHP error - test your file before parsing!)'\r
707         ,\r
708         PDERROR_CANNOT_EXTEND_SELF => \r
709             'class %s cannot extend itself - TEST YOUR CODE BEFORE PARSING'\r
710         ,\r
711         PDERROR_DUMB_USES => \r
712             '@uses can only link to string data'\r
713         ,\r
714         PDERROR_UL_IN_UL => \r
715             'ul/ol tags cannot be directly nested inside ul/ol, nest inside li'\r
716         ,\r
717         PDERROR_INVALID_VALUES => \r
718             'command %s was passed "%s" but must be one of %s'\r
719         ,\r
720         PDERROR_NESTED_INTERNAL => \r
721             '{@internal}} cannot be nested inside {@internal}}'\r
722         ,\r
723         PDERROR_DANGEROUS_PHP_BUG_EXISTS => \r
724             'Dangerous PHP Bug exists in PHP version %s that can be triggered ' .\r
725             'by this parse (see PHP Bug #%s and PEAR Bug #%s)'\r
726         ,\r
727         PDERROR_LOOP_RECURSION_LIMIT_REACHED => \r
728             'An internal loop in PhpDocumentor has reached its preset ' .\r
729             'recursion limit, preventing a possible infinite loop condition.'\r
730         );\r
731 \r
732 /**\r
733  * encapsulates warning information\r
734  *\r
735  * @category   ToolsAndUtilities\r
736  * @package    phpDocumentor\r
737  * @subpackage Errors\r
738  * @author     Greg Beaver <cellog@php.net>\r
739  * @copyright  2001-2007 Gregory Beaver\r
740  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL\r
741  * @version    Release: 1.4.1\r
742  * @link       http://www.phpdoc.org\r
743  * @link       http://pear.php.net/PhpDocumentor\r
744  * @todo       CS cleanup - change package to PhpDocumentor\r
745  */\r
746 class RecordWarning\r
747 {\r
748     /**\r
749      * name of global variable that descriptors for this warning/error is kept\r
750      * @var string\r
751      */\r
752     var $type = 'phpDocumentor_warning_descrip';\r
753     /**\r
754      * file this error occurred in\r
755      * @var string\r
756      */\r
757     var $file = false;\r
758     /**\r
759      * line number of the file this error occurred in\r
760      * @var integer\r
761      */\r
762     var $linenum;\r
763     /**\r
764      * error string\r
765      * @var string\r
766      */\r
767     var $data;\r
768     /**\r
769      * error number\r
770      * @see Errors.inc\r
771      * @var string\r
772      */\r
773     var $num;\r
774     /**\r
775      * Constructor\r
776      *\r
777      * @param string  $file    filename this error occurred in ({@link $file})\r
778      * @param integer $linenum line number this error occurred on ({@link $linenum})\r
779      * @param integer $num     Error number defined in {@link Errors.inc}\r
780      * @param string  $data... variable number of strings, up to 4, \r
781      *\r
782      * @todo CS Cleanup - do I need to add $data to the method signature?\r
783      *                         to sprintf based on the error number\r
784      */\r
785     function RecordWarning($file, $linenum, $num)\r
786     {\r
787         $this->file    = $file;\r
788         $this->linenum = $linenum;\r
789         $a             = array('', '', '', '');\r
790         if (func_num_args()>3) {\r
791             for ($i=3;$i<func_num_args();$i++) {\r
792                 $a[$i - 3] = func_get_arg($i);\r
793             }\r
794         }\r
795 \r
796         $this->num  = $num;\r
797         $this->data = \r
798             sprintf($GLOBALS[$this->type][$this->num], $a[0], $a[1], $a[2], $a[3]);\r
799         $this->output();\r
800     }\r
801     \r
802     /**\r
803      * prints the warning\r
804      *\r
805      * @param string $string the warning to print\r
806      *\r
807      * @return void\r
808      */\r
809     function output($string = false)\r
810     {\r
811         if ($string) {\r
812             if ($this->file) {\r
813                 return \r
814                     "WARNING in $this->file on line $this->linenum: $this->data\n";\r
815             } else {\r
816                 return "WARNING: $this->data\n";\r
817             }\r
818         }\r
819         if ($this->file) {\r
820             phpDocumentor_out("WARNING in $this->file " .\r
821                 "on line $this->linenum: $this->data\n");\r
822         } else {\r
823             phpDocumentor_out("WARNING: $this->data\n");\r
824         }\r
825         flush();\r
826     }\r
827 }\r
828 \r
829 /**\r
830  * encapsulates error information\r
831  *\r
832  * @category   ToolsAndUtilities\r
833  * @package    phpDocumentor\r
834  * @subpackage Errors\r
835  * @author     Greg Beaver <cellog@php.net>\r
836  * @copyright  2001-2007 Gregory Beaver\r
837  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL\r
838  * @version    Release: 1.4.1\r
839  * @link       http://www.phpdoc.org\r
840  * @link       http://pear.php.net/PhpDocumentor\r
841  * @todo       CS cleanup - change package to PhpDocumentor\r
842  */\r
843 class RecordError extends RecordWarning\r
844 {\r
845     /**\r
846      * name of global variable that descriptors for this warning/error is kept\r
847      * @var string\r
848      */\r
849     var $type = 'phpDocumentor_error_descrip';\r
850 \r
851     /**\r
852      * prints the error\r
853      *\r
854      * @param string $string the error to print\r
855      *\r
856      * @return string\r
857      */\r
858     function output($string = false)\r
859     {\r
860         if ($string) {\r
861             if ($this->file) {\r
862                 return \r
863                     "\n\tERROR in $this->file on line $this->linenum: $this->data\n"\r
864                 ;\r
865             } else {\r
866                 return "\n\tERROR: $this->data\n";\r
867             }\r
868         }\r
869         if ($this->file) {\r
870             phpDocumentor_out("\n\tERROR in $this->file " .\r
871                 "on line $this->linenum: $this->data\n");\r
872         } else {\r
873             phpDocumentor_out("\n\tERROR: $this->data\n");\r
874         }\r
875         flush();\r
876     }\r
877 }\r
878 \r
879 /**\r
880  * contains all the errors/warnings\r
881  *\r
882  * @category   ToolsAndUtilities\r
883  * @package    phpDocumentor\r
884  * @subpackage Errors\r
885  * @author     Greg Beaver <cellog@php.net>\r
886  * @copyright  2001-2007 Gregory Beaver\r
887  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL\r
888  * @version    Release: 1.4.1\r
889  * @link       http://www.phpdoc.org\r
890  * @link       http://pear.php.net/PhpDocumentor\r
891  * @todo       CS cleanup - change package to PhpDocumentor\r
892  * @see        $errors, $warnings\r
893  */\r
894 class ErrorTracker\r
895 {\r
896     /**\r
897      * array of {@link RecordError}s\r
898      * @var array\r
899      */\r
900     var $errors = array();\r
901     /**\r
902      * array of {@link RecordWarning}s\r
903      * @var array\r
904      */\r
905     var $warnings = array();\r
906     /**\r
907      * @var string\r
908      */\r
909     var $curfile = '';\r
910     /**\r
911      * @var integer\r
912      */\r
913     var $linenum = 0;\r
914     \r
915     /**\r
916      * index in {@link $errors} of last error triggered\r
917      * @var integer|false\r
918      */\r
919     var $lasterror = false;\r
920     \r
921     /**\r
922      * index in {@link $warnings} of last warning triggered\r
923      * @var integer|false\r
924      */\r
925     var $lastwarning = false;\r
926     \r
927     /**\r
928      * This function subscribes to two events in the Parser \r
929      * in order to keep track of line number information and file name.\r
930      *\r
931      * @param integer $num  parser-passed event \r
932      *                      (see {@link PHPDOCUMENTOR_EVENT_NEWLINENUM, \r
933      *                      PHPDOCUMENTOR_EVENT_NEWFILE})\r
934      * @param mixed   $data either a line number if $num is \r
935      *                      PHPDOCUMENTOR_EVENT_NEWLINENUM or a file name \r
936      *                      if $num is PHPDOCUMENTOR_EVENT_NEWFILE\r
937      *\r
938      * @return void\r
939      */\r
940     function handleEvent($num,$data)\r
941     {\r
942         switch($num) {\r
943         case PHPDOCUMENTOR_EVENT_NEWLINENUM :\r
944             $this->linenum = $data;\r
945             break;\r
946 \r
947         case PHPDOCUMENTOR_EVENT_NEWFILE :\r
948             $this->linenum = 0;\r
949             $this->curfile = $data;\r
950             break;\r
951 \r
952         case 1000000635 : // debugging\r
953             phpDocumentor_out($this->curfile . \r
954                 ' has ' . $this->linenum . ' lines' . "\n");\r
955             flush();\r
956             break;\r
957         }\r
958     }\r
959 \r
960     /**\r
961      * add a new warning to the {@link $warnings} array\r
962      *\r
963      * @param integer $num     error number from {@link Errors.inc}\r
964      * @param string  $data... up to 4 string parameters to sprintf()\r
965      *                         into the error string for error number $num\r
966      *\r
967      * @return void\r
968      * @todo CS Cleanup - do I need to add $data to the method signature?\r
969      */\r
970     function addWarning($num)\r
971     {\r
972         $a = array('', '', '', '');\r
973         if (func_num_args()>1) {\r
974             for ($i=1;$i<func_num_args();$i++) {\r
975                 $a[$i - 1] = func_get_arg($i);\r
976             }\r
977         }\r
978         $this->warnings[]  = new RecordWarning($this->curfile, \r
979             $this->linenum, $num, $a[0], $a[1], $a[2], $a[3]);\r
980         $this->lastwarning = count($this->warnings) - 1;\r
981     }\r
982 \r
983     /**\r
984      * add a new error to the {@link $errors} array\r
985      *\r
986      * @param integer $num     error number from {@link Errors.inc}\r
987      * @param string  $data... up to 4 string parameters to sprintf()\r
988      *                         into the error string for error number $num\r
989      *\r
990      * @return void\r
991      * @todo CS Cleanup - do I need to add $data to the method signature?\r
992      */\r
993     function addError($num)\r
994     {\r
995         $a = array('', '', '', '');\r
996         if (func_num_args()>1) {\r
997             for ($i=1;$i<func_num_args();$i++) {\r
998                 $a[$i - 1] = func_get_arg($i);\r
999             }\r
1000         }\r
1001         $this->errors[]  = new RecordError($this->curfile,\r
1002             $this->linenum, $num, $a[0], $a[1], $a[2], $a[3]);\r
1003         $this->lasterror = count($this->errors) - 1;\r
1004     }\r
1005     \r
1006     /**\r
1007      * add a new error to the {@link $errors} array and returns the error string\r
1008      *\r
1009      * @param integer $num     error number from {@link Errors.inc}\r
1010      * @param string  $data... up to 4 string parameters to sprintf()\r
1011      *                         into the error string for error number $num\r
1012      *\r
1013      * @return void\r
1014      * @todo CS Cleanup - do I need to add $data to the method signature?\r
1015      */\r
1016     function addErrorReturn($num)\r
1017     {\r
1018         $a = array('', '', '', '');\r
1019         if (func_num_args()>1) {\r
1020             for ($i=1;$i<func_num_args();$i++) {\r
1021                 $a[$i - 1] = func_get_arg($i);\r
1022             }\r
1023         }\r
1024         $this->errors[]  = new RecordError($this->curfile,\r
1025             $this->linenum, $num, $a[0], $a[1], $a[2], $a[3], false);\r
1026         $this->lasterror = count($this->errors) - 1;\r
1027     }\r
1028     \r
1029     /**\r
1030      * Get sorted array of all warnings in parsing/conversion\r
1031      *\r
1032      * @return array\r
1033      */\r
1034     function &returnWarnings()\r
1035     {\r
1036         usort($this->warnings, array($this, "errorsort"));\r
1037         return $this->warnings;\r
1038     }\r
1039     \r
1040     /**\r
1041      * Get sorted array of all non-fatal errors in parsing/conversion\r
1042      *\r
1043      * @return array\r
1044      */\r
1045     function &returnErrors()\r
1046     {\r
1047         usort($this->errors, array($this, "errorsort"));\r
1048         return $this->errors;\r
1049     }\r
1050     \r
1051     /**\r
1052      * sort two errors\r
1053      *\r
1054      * @param RecordError|RecordWarning $a the first error/warning\r
1055      * @param RecordError|RecordWarning $b the second error/warning\r
1056      *\r
1057      * @return int\r
1058      * @access private\r
1059      */\r
1060     function errorsort($a, $b)\r
1061     {\r
1062         if (!$a->file) return -1;\r
1063         if (!$b->file) return 1;\r
1064         if ($a->file == $b->file) {\r
1065             if ($a->linenum == $b->linenum) return 0;\r
1066             if ($a->linenum < $b->linenum) return -1;\r
1067             return 1;\r
1068         }\r
1069         return strnatcasecmp($a->file, $b->file);\r
1070     }\r
1071     \r
1072     /**\r
1073      * Get the error message of the last error\r
1074      *\r
1075      * @return string\r
1076      */\r
1077     function returnLastError()\r
1078     {\r
1079         return $this->errors[$this->lasterror]->output(true);\r
1080     }\r
1081 \r
1082     /**\r
1083      * Get the warning message of the last warning\r
1084      *\r
1085      * @return string\r
1086      */\r
1087     function returnLastWarning()\r
1088     {\r
1089         return $this->warnings[$this->lastwarning]->output(true);\r
1090     }\r
1091 }\r
1092 \r
1093 /**\r
1094  * @global ErrorTracker $GLOBALS['phpDocumentor_errors']\r
1095  * @name $phpDocumentor_errors\r
1096  */\r
1097 $GLOBALS['phpDocumentor_errors'] = new ErrorTracker;\r
1098 \r
1099 /**\r
1100  * add an Error\r
1101  *\r
1102  * @param integer $num     error number from {@link Errors.inc}\r
1103  * @param string  $data... up to 4 string parameters to sprintf() \r
1104  *                         into the error string for error number $num\r
1105  *\r
1106  * @return void\r
1107  * @see ErrorTracker::addError()\r
1108  * @todo CS Cleanup - do I need to add $data to the method signature?\r
1109  */\r
1110 function addError($num)\r
1111 {\r
1112     global $phpDocumentor_errors;\r
1113     $a = array('', '', '', '');\r
1114     if (func_num_args()>1) {\r
1115         for ($i=1;$i<func_num_args();$i++) {\r
1116             $a[$i - 1] = func_get_arg($i);\r
1117         }\r
1118     }\r
1119     $phpDocumentor_errors->addError($num, $a[0], $a[1], $a[2], $a[3]);\r
1120 }\r
1121 \r
1122 /**\r
1123  * like {@link addError()} but exits parsing\r
1124  *\r
1125  * @param integer $num     error number from {@link Errors.inc}\r
1126  * @param string  $data... up to 4 string parameters to sprintf() \r
1127  *                         into the error string for error number $num\r
1128  *\r
1129  * @return void\r
1130  * @global ErrorTracker repository for all errors generated by phpDocumentor\r
1131  * @see ErrorTracker::addError()\r
1132  * @todo CS Cleanup - do I need to add $data to the method signature?\r
1133  */\r
1134 function addErrorDie($num)\r
1135 {\r
1136     global $phpDocumentor_errors;\r
1137     $a = array('', '', '', '');\r
1138     if (func_num_args()>1) {\r
1139         for ($i=1;$i<func_num_args();$i++) {\r
1140             $a[$i - 1] = func_get_arg($i);\r
1141         }\r
1142     }\r
1143     $phpDocumentor_errors->addErrorReturn($num, $a[0], $a[1], $a[2], $a[3]);\r
1144     echo $phpDocumentor_errors->returnLastError();\r
1145     die(1);\r
1146 }\r
1147 \r
1148 /**\r
1149  * add a Warning\r
1150  *\r
1151  * @param integer $num     warning number from {@link Errors.inc}\r
1152  * @param string  $data... up to 4 string parameters to sprintf() \r
1153  *                         into the error string for error number $num\r
1154  *\r
1155  * @return void\r
1156  * @global ErrorTracker repository for all errors generated by phpDocumentor\r
1157  * @see ErrorTracker::addWarning()\r
1158  * @todo CS Cleanup - do I need to add $data to the method signature?\r
1159  */\r
1160 function addWarning($num)\r
1161 {\r
1162     global $phpDocumentor_errors;\r
1163     $a = array('', '', '', '');\r
1164     if (func_num_args()>1) {\r
1165         for ($i=1;$i<func_num_args();$i++) {\r
1166             $a[$i - 1] = func_get_arg($i);\r
1167         }\r
1168     }\r
1169 \r
1170     $phpDocumentor_errors->addWarning($num, $a[0], $a[1], $a[2], $a[3]);\r
1171 }\r
1172 ?>\r