3 * Error handling for phpDocumentor
\r
5 * phpDocumentor :: automatic documentation generator
\r
7 * PHP versions 4 and 5
\r
9 * Copyright (c) 2001-2007 Gregory Beaver
\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
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
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
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
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
41 * @todo CS cleanup - change package to PhpDocumentor
\r
44 * warning triggered when inheritance could be from more than one class
\r
46 define("PDERROR_MULTIPLE_PARENT", 1);
\r
48 * warning triggered when parent class doesn't exist
\r
50 define("PDERROR_PARENT_NOT_FOUND", 2);
\r
52 * warning triggered when an {@inline tag} is not terminated
\r
53 * (no } before the * / ending the comment)
\r
55 define("PDERROR_UNTERMINATED_INLINE_TAG", 3);
\r
57 * warning triggered when inheritance could be from more than one class
\r
59 define("PDERROR_CLASS_EXISTS", 4);
\r
61 * warning triggered when inheritance could be from more than one class
\r
63 define("PDERROR_INHERITANCE_CONFLICT", 5);
\r
65 * warning triggered when a converter is passed to
\r
66 * {@link phpDocumentor_IntermediateParser::addConverter()} that is not a class
\r
68 define("PDERROR_CONVERTER_NOT_FOUND", 6);
\r
70 * warning triggered when a converter is passed to
\r
71 * {@link phpDocumentor_IntermediateParser::addConverter()} that is not a class
\r
73 define("PDERROR_NO_CONVERTERS", 7);
\r
75 * warning triggered when the arguments to @access are neither public nor private
\r
77 define("PDERROR_ACCESS_WRONG_PARAM", 8);
\r
79 * warning triggered when there are multiple @access tags in a docblock
\r
81 define("PDERROR_MULTIPLE_ACCESS_TAGS", 9);
\r
83 * warning triggered when there are multiple @return tags in a docblock
\r
85 define("PDERROR_MULTIPLE_RETURN_TAGS", 10);
\r
87 * warning triggered when there are multiple @var tags in a docblock
\r
89 define("PDERROR_MULTIPLE_VAR_TAGS", 11);
\r
91 * warning triggered when there are multiple @package tags in a docblock
\r
93 define("PDERROR_MULTIPLE_PACKAGE_TAGS", 12);
\r
95 * warning triggered when there are multiple @subpackage tags in a docblock
\r
97 define("PDERROR_MULTIPLE_SUBPACKAGE_TAGS", 13);
\r
99 * warning triggered when the package or subpackage name is illegal
\r
101 define("PDERROR_ILLEGAL_PACKAGENAME", 14);
\r
103 * warning triggered when there a @package tag is used in a function,
\r
104 * define, method, var or include
\r
106 define("PDERROR_OVERRIDDEN_PACKAGE_TAGS", 15);
\r
108 * warning triggered when there a @subpackage tag is used in a function,
\r
109 * define, method, var or include
\r
111 define("PDERROR_OVERRIDDEN_SUBPACKAGE_TAGS", 16);
\r
113 * warning triggered when classes in the same package have the same name
\r
115 define("PDERROR_CLASS_CONFLICT", 17);
\r
117 * warning triggered when classes in the same package have the same name
\r
119 define("PDERROR_UNKNOWN_TAG", 18);
\r
121 * warning triggered when there are multiple @name tags in a docblock
\r
123 define("PDERROR_MULTIPLE_NAME_TAGS", 19);
\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
128 define("PDERROR_PACKAGEOUTPUT_DELETES_PARENT_FILE", 20);
\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
133 define("PDERROR_GLOBAL_NOT_FOUND", 21);
\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
138 define("PDERROR_MULTIPLE_GLOBAL_TAGS", 22);
\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
143 define("PDERROR_MALFORMED_GLOBAL_TAG", 23);
\r
145 * warning triggered when an @ignore tag is used in a DocBlock preceding
\r
146 * a method, variable, include, or global variable
\r
148 define("PDERROR_IGNORE_TAG_IGNORED", 24);
\r
150 * warning triggered when a duplicate element is encountered that will be
\r
151 * ignored by the documentor
\r
153 define("PDERROR_ELEMENT_IGNORED", 25);
\r
155 * warning triggered when an entire page is ignored because of @access private
\r
157 define("PDERROR_PARSEPRIVATE", 26);
\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
162 define("PDERROR_UNKNOWN_COMMANDLINE", 27);
\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
167 define("PDERROR_NEED_WHITESPACE", 28);
\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
172 define("PDERROR_CLASS_PARENT_NOT_FOUND", 29);
\r
174 * warning triggered when a getClassByPackage is called and can't find the class
\r
176 define("PDERROR_CLASS_NOT_IN_PACKAGE", 30);
\r
178 * warning triggered when a { @source } inline tag is used in a docblock not
\r
179 * preceding a function
\r
181 define("PDERROR_SOURCE_TAG_FUNCTION_NOT_FOUND", 31);
\r
183 * warning triggered when a docblock template is never turned off
\r
184 * with /**#@-* / (no space)
\r
186 define("PDERROR_DB_TEMPLATE_UNTERMINATED", 32);
\r
188 * warning triggered when a docblock has an unmatched <ol> or <ul>
\r
190 define("PDERROR_UNMATCHED_LIST_TAG", 33);
\r
192 * warning triggered when another tag is nested in <b>
\r
193 * (not allowed in phpDocumentor)
\r
195 define("PDERROR_CANT_NEST_IN_B", 34);
\r
197 * warning triggered when a docbook tag is not properly matched
\r
199 define("PDERROR_UNMATCHED_TUTORIAL_TAG", 35);
\r
201 * warning triggered when an inline tag is found inside an xml tag name
\r
202 * in a package page
\r
204 define("PDERROR_CANT_HAVE_INLINE_IN_TAGNAME", 36);
\r
206 * warning triggered when a tutorial is referenced
\r
207 * via @tutorial/{ @tutorial} and is not found
\r
209 define("PDERROR_TUTORIAL_NOT_FOUND", 37);
\r
211 * warning triggered when a tutorial lists itself as a child tutorial
\r
213 define("PDERROR_TUTORIAL_IS_OWN_CHILD", 38);
\r
215 * warning triggered when a tutorial's child lists the parent tutorial
\r
216 * as a child tutorial
\r
218 define("PDERROR_TUTORIAL_IS_OWN_GRANDPA", 39);
\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
223 define("PDERROR_CHILD_TUTORIAL_NOT_FOUND", 40);
\r
225 * warning triggered when a <pdffunction:funcname /> tag is used in the PDF
\r
226 * Converter and no funcname is present (<pdffunction: />)
\r
228 define("PDERROR_PDFFUNCTION_NO_FUNC", 41);
\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
233 define("PDERROR_PDF_METHOD_DOESNT_EXIST", 42);
\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
239 define("PDERROR_PDF_TEMPVAR_DOESNT_EXIST", 43);
\r
241 * warning triggered when a subsection's title is asked for, but the subsection
\r
244 define("PDERROR_TUTORIAL_SUBSECTION_NOT_FOUND", 44);
\r
246 * warning triggered when a subsection's title is asked for, but the subsection
\r
249 define("PDERROR_UNTERMINATED_ATTRIB", 45);
\r
251 * warning triggered when no @package tag is used in a page-level
\r
252 * or class-level DocBlock
\r
254 define("PDERROR_NO_PACKAGE_TAG", 46);
\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
260 define("PDERROR_PRIVATE_ASSUMED", 47);
\r
262 * warning triggered when an example's path from @example /path/to/example.php
\r
265 define("PDERROR_EXAMPLE_NOT_FOUND", 48);
\r
267 * warning triggered when an example's path from @example /path/to/example.php
\r
270 define("PDERROR_NO_CONVERTER_HANDLER", 49);
\r
272 * warning triggered when an example's path from @example /path/to/example.php
\r
275 define("PDERROR_INLINETAG_IN_SEE", 50);
\r
277 * warning triggered when an id attribute in a tutorial docbook tag is not
\r
278 * an {@}id} inline tag
\r
280 define("PDERROR_ID_MUST_BE_INLINE", 51);
\r
282 * warning triggered when an {@}internal}} tag is not closed
\r
284 define("PDERROR_INTERNAL_NOT_CLOSED", 52);
\r
286 * warning triggered when an {@}source} tag is found in a short description
\r
288 define("PDERROR_SOURCE_TAG_IGNORED", 53);
\r
290 * warning triggered when a child converter doesn't override
\r
291 * getFormattedClassTrees()
\r
293 define("PDERROR_CONVERTER_OVR_GFCT", 54);
\r
295 * warning triggered when a package is already associated with a category, and
\r
296 * a new association is found
\r
298 define("PDERROR_PACKAGECAT_SET", 55);
\r
300 * warning triggered when text in a docblock list is not contained in
\r
301 * an <<li>> opening tag
\r
303 define("PDERROR_TEXT_OUTSIDE_LI", 56);
\r
305 * warning triggered when a DocBlock html tag is unclosed
\r
307 define("PDERROR_UNCLOSED_TAG", 57);
\r
309 * warning triggered by @filesource, if PHP < 4.3.0
\r
311 define("PDERROR_TAG_NOT_HANDLED", 58);
\r
313 * warning triggered by sourcecode="on", if PHP < 4.3.0
\r
315 define("PDERROR_SOURCECODE_IGNORED", 59);
\r
317 * warning triggered by an empty tag
\r
319 define("PDERROR_MALFORMED_TAG", 60);
\r
321 * warning triggered by more than 1 @category tag
\r
323 define("PDERROR_MULTIPLE_CATEGORY_TAGS", 61);
\r
325 * warning triggered by {@}inheritdoc} in a non-inheritable situation
\r
327 define("PDERROR_INHERITDOC_DONT_WORK_HERE", 62);
\r
329 * warning triggered by @example path/to/example with no title
\r
331 define("PDERROR_EMPTY_EXAMPLE_TITLE", 63);
\r
333 * warning triggered by non-existent template directory
\r
335 define("PDERROR_TEMPLATEDIR_DOESNT_EXIST", 64);
\r
337 * warning triggered by an unterminated entity in a tutorial
\r
339 define("PDERROR_UNTERMINATED_ENTITY", 65);
\r
341 * warning triggered by an unterminated entity in a tutorial
\r
343 define("PDERROR_BEAUTIFYING_FAILED", 66);
\r
345 * warning triggered by a function with no name
\r
348 * function ($params)
\r
352 * triggers this error
\r
354 define("PDERROR_FUNCTION_HAS_NONAME", 67);
\r
356 * warning triggered by a page-level docblock preceding a source element
\r
361 * * Page-level DocBlock
\r
362 * * @package pagepackage
\r
364 * include 'file.php';
\r
367 define("PDERROR_DOCBLOCK_CONFLICT", 68);
\r
369 * warning triggered when a file does not contain a page-level docblock
\r
371 define("PDERROR_NO_PAGE_LEVELDOCBLOCK", 69);
\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
376 define("PDERROR_DOCBLOCK_GOES_CLASS", 70);
\r
378 * warning triggered in tutorial parsing if there is a missing {@id} inline tag
\r
380 define("PDERROR_NO_DOCBOOK_ID", 71);
\r
382 * warning triggered if someone brilliant tries "class X extends X {"
\r
384 define("PDERROR_CANNOT_EXTEND_SELF", 72);
\r
386 * warning triggered by improper "@uses {@link blah}"
\r
388 define("PDERROR_DUMB_USES", 73);
\r
390 * warning triggered if <<ul>> is nested inside <<ul>> and not <<li>>
\r
392 define("PDERROR_UL_IN_UL", 74);
\r
394 * warning triggered if a command line option does not have a valid value passed in
\r
396 define("PDERROR_INVALID_VALUES", 75);
\r
398 * warning triggered when {@}internal}} is nested inside another {@}internal}}
\r
400 define("PDERROR_NESTED_INTERNAL", 76);
\r
402 * warning triggered when @todo is used on an include element
\r
404 define("PDERROR_NOTODO_INCLUDE", 77);
\r
406 * warning triggered when a class or method hasn't got docblock
\r
408 define("PDERROR_UNDOCUMENTED_ELEMENT", 78);
\r
410 * warning triggered when any of {@}property}}, {@}property-read}},
\r
411 * {@}property-write}}, or {@}method}} tag does not have name
\r
413 define("PDERROR_MISSING_PROPERTY_TAG_NAME", 79);
\r
415 * warning triggered when the PHP version being used has dangerous bug/behavior
\r
417 define("PDERROR_DANGEROUS_PHP_BUG_EXISTS", 80);
\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
422 define("PDERROR_NAME_ALIAS_SAME_AS_TARGET", 81);
\r
424 * warning triggered when the a loop recursion tripwire has been tripped
\r
426 define("PDERROR_LOOP_RECURSION_LIMIT_REACHED", 82);
\r
429 * Error messages for phpDocumentor parser warnings
\r
430 * @global array $GLOBALS['phpDocumentor_warning_descrip']
\r
431 * @name $phpDocumentor_warning_descrip
\r
433 $GLOBALS['phpDocumentor_warning_descrip'] =
\r
435 PDERROR_MULTIPLE_PARENT =>
\r
436 'Class %s has multiple possible parents, package inheritance aborted'
\r
438 PDERROR_PARENT_NOT_FOUND =>
\r
439 'Class %s parent %s not found'
\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
446 PDERROR_UNKNOWN_TAG =>
\r
447 'Unknown tag "@%s" used'
\r
449 PDERROR_IGNORE_TAG_IGNORED =>
\r
450 '@ignore tag used for %s element "%s" will be ignored'
\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
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
461 PDERROR_CLASS_PARENT_NOT_FOUND =>
\r
462 "class %s in package %s parent not found in @see parent::%s"
\r
464 PDERROR_CLASS_NOT_IN_PACKAGE =>
\r
465 "class %s was not found in package %s"
\r
467 PDERROR_DB_TEMPLATE_UNTERMINATED =>
\r
468 'docblock template never terminated with /**#@-*/'
\r
470 PDERROR_PDF_METHOD_DOESNT_EXIST =>
\r
471 '<pdffunction:%s /> called, but pdf method "%s" doesn\'t exist'
\r
473 PDERROR_TUTORIAL_NOT_FOUND =>
\r
474 "tutorial \"%s\" not found, does it exist?"
\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
480 PDERROR_TUTORIAL_SUBSECTION_NOT_FOUND =>
\r
481 'tutorial %s subsection "%s" doesn\'t exist, ' .
\r
482 'but its title was asked for'
\r
484 PDERROR_NO_PACKAGE_TAG =>
\r
485 'no @package tag was used in a DocBlock for %s %s'
\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
491 PDERROR_EXAMPLE_NOT_FOUND =>
\r
492 'example file "%s" does not exist'
\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
498 PDERROR_PACKAGECAT_SET =>
\r
499 'package %s is already in category %s, ' .
\r
500 'will now replace with category %s'
\r
502 PDERROR_SOURCECODE_IGNORED =>
\r
503 'sourcecode command-line option is ignored ' .
\r
504 'when your PHP build has no tokenizer support'
\r
506 PDERROR_INHERITDOC_DONT_WORK_HERE =>
\r
507 '{@inheritdoc} can only be used in the docblock of a child class'
\r
509 PDERROR_EMPTY_EXAMPLE_TITLE =>
\r
510 'Example file found at "%s" has no title, using "%s"'
\r
512 PDERROR_DOCBLOCK_CONFLICT =>
\r
513 'Page-level DocBlock precedes "%s %s", ' .
\r
514 'use another DocBlock to document the source element'
\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
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
524 PDERROR_NO_DOCBOOK_ID =>
\r
525 'Tutorial section %s "%s" has no id="{@id subsection}" tag ' .
\r
526 '({@id} for refentry)'
\r
528 PDERROR_BEAUTIFYING_FAILED =>
\r
529 'Beautifying failed: %s'
\r
531 PDERROR_NOTODO_INCLUDE =>
\r
532 '@todo on an include element is ignored (line %s, file %s)'
\r
534 PDERROR_UNDOCUMENTED_ELEMENT =>
\r
535 '%s "%s" has no %s-level DocBlock.'
\r
537 PDERROR_MISSING_PROPERTY_TAG_NAME =>
\r
538 '@%s magic tag does not have name, illegal. Ignoring tag "@%s %s %s"'
\r
540 PDERROR_NAME_ALIAS_SAME_AS_TARGET =>
\r
541 '@name value is the same as the filename it is supposed to alias'
\r
546 //********************************************************
\r
551 * Error messages for phpDocumentor parser errors
\r
552 * @global array $GLOBALS['phpDocumentor_error_descrip']
\r
553 * @name $phpDocumentor_error_descrip
\r
555 $GLOBALS['phpDocumentor_error_descrip'] =
\r
557 PDERROR_UNTERMINATED_INLINE_TAG =>
\r
558 'Inline tag {@%s} in tag %s is unterminated, "%s"'
\r
560 PDERROR_CLASS_EXISTS =>
\r
561 'Class %s already exists in package "%s"'
\r
563 PDERROR_CONVERTER_NOT_FOUND =>
\r
564 'Converter %s specified by --output command-line option is not a class'
\r
566 PDERROR_NO_CONVERTERS =>
\r
567 'No Converters have been specified by --output command-line option'
\r
569 PDERROR_ACCESS_WRONG_PARAM =>
\r
570 '@access was passed neither "public" nor "private." Was passed: "%s"'
\r
572 PDERROR_MULTIPLE_ACCESS_TAGS =>
\r
573 'DocBlock has multiple @access tags, illegal. ' .
\r
574 'ignoring additional tag "@access %s"'
\r
576 PDERROR_MULTIPLE_RETURN_TAGS =>
\r
577 'DocBlock has multiple @return tags, illegal. ' .
\r
578 'ignoring additional tag "@return %s %s"'
\r
580 PDERROR_MULTIPLE_VAR_TAGS =>
\r
581 'DocBlock has multiple @var tags, illegal. ' .
\r
582 'ignoring additional tag "@var %s %s"'
\r
584 PDERROR_MULTIPLE_PACKAGE_TAGS =>
\r
585 'DocBlock has multiple @package tags, illegal. ' .
\r
586 'ignoring additional tag "@package %s"'
\r
588 PDERROR_MULTIPLE_SUBPACKAGE_TAGS =>
\r
589 'DocBlock has multiple @subpackage tags, illegal. ' .
\r
590 'ignoring additional tag "@subpackage %s"'
\r
592 PDERROR_ILLEGAL_PACKAGENAME =>
\r
593 '@%s tag has illegal %s name "%s"'
\r
595 PDERROR_OVERRIDDEN_PACKAGE_TAGS =>
\r
596 '%s %s\'s DocBlock has @package tag, illegal. ' .
\r
597 'ignoring tag "@package %s"'
\r
599 PDERROR_OVERRIDDEN_SUBPACKAGE_TAGS =>
\r
600 '"%s" %s\'s DocBlock has @subpackage tags, illegal. ' .
\r
601 'ignoring tag "@subpackage %s"'
\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
607 PDERROR_MULTIPLE_NAME_TAGS =>
\r
608 'DocBlock has multiple @name tags, illegal. ' .
\r
609 'ignoring additional tag "@name %s"'
\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
616 PDERROR_GLOBAL_NOT_FOUND =>
\r
617 'global variable %s specified in @global tag was never found'
\r
619 PDERROR_MULTIPLE_GLOBAL_TAGS =>
\r
620 '@global define tag already used for global variable "%s", ' .
\r
621 'ignoring @global %s'
\r
623 PDERROR_MALFORMED_GLOBAL_TAG =>
\r
624 'incorrect @global syntax. ' .
\r
625 'Should be @global vartype $varname or @global vartype description'
\r
627 PDERROR_UNKNOWN_COMMANDLINE =>
\r
628 'Unknown command-line option "%s" encountered, use phpdoc -h for help'
\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
634 PDERROR_SOURCE_TAG_FUNCTION_NOT_FOUND =>
\r
635 '{@source} tag used in a docblock that isn\'t preceding a function'
\r
637 PDERROR_UNMATCHED_LIST_TAG =>
\r
638 'unmatched ol or ul tag in DocBlock, parsing will be incorrect'
\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
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
648 PDERROR_CANT_HAVE_INLINE_IN_TAGNAME =>
\r
649 'Can\'t have an inline tag inside a package page XML tag!'
\r
651 PDERROR_TUTORIAL_IS_OWN_CHILD =>
\r
652 'Tutorial %s lists itself as its own child in %s, illegal'
\r
654 PDERROR_TUTORIAL_IS_OWN_GRANDPA =>
\r
655 'Tutorial %s\'s child %s lists %s as its child in %s, illegal'
\r
657 PDERROR_PDFFUNCTION_NO_FUNC =>
\r
658 'Invalid pdffunction syntax: "<pdffunction: />", ' .
\r
659 'should be "<pdffunction:functionname [arg="value"...]/>"'
\r
661 PDERROR_PDF_TEMPVAR_DOESNT_EXIST =>
\r
662 '<pdffunction:%s arg=%s /> called ' .
\r
663 'but temporary variable "%s" doesn\'t exist'
\r
665 PDERROR_UNTERMINATED_ATTRIB =>
\r
666 'Tutorial tag %s attribute %s is unterminated, current value "%s"'
\r
668 PDERROR_NO_CONVERTER_HANDLER =>
\r
669 'Handler for element of type "%s" called, but %s is not a method of %s'
\r
671 PDERROR_INLINETAG_IN_SEE =>
\r
672 'Inline tags are not allowed in a @see tag'
\r
674 PDERROR_ID_MUST_BE_INLINE =>
\r
675 '<%s id="%s"> must be <%s id="{@id %s}">'
\r
677 PDERROR_INTERNAL_NOT_CLOSED =>
\r
678 '{@internal was never terminated with }}'
\r
680 PDERROR_CONVERTER_OVR_GFCT =>
\r
681 'Converter "%s" must override getFormattedClassTrees() but doesn\'t'
\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
687 PDERROR_UNCLOSED_TAG =>
\r
688 'Unclosed %s tag in DocBlock, parsing will be incorrect'
\r
690 PDERROR_TAG_NOT_HANDLED =>
\r
691 '"%s" tag is not available in PHP built without tokenizer support, tag ignored'
\r
693 PDERROR_MALFORMED_TAG =>
\r
694 '"%s" tag was used without any parameters, illegal'
\r
696 PDERROR_MULTIPLE_CATEGORY_TAGS =>
\r
697 'package has multiple @category tags, ignoring "@category %s"'
\r
699 PDERROR_TEMPLATEDIR_DOESNT_EXIST =>
\r
700 'template directory "%s" does not exist'
\r
702 PDERROR_UNTERMINATED_ENTITY =>
\r
703 'entity &%s is unterminated'
\r
705 PDERROR_FUNCTION_HAS_NONAME =>
\r
706 'function has no name (PHP error - test your file before parsing!)'
\r
708 PDERROR_CANNOT_EXTEND_SELF =>
\r
709 'class %s cannot extend itself - TEST YOUR CODE BEFORE PARSING'
\r
711 PDERROR_DUMB_USES =>
\r
712 '@uses can only link to string data'
\r
714 PDERROR_UL_IN_UL =>
\r
715 'ul/ol tags cannot be directly nested inside ul/ol, nest inside li'
\r
717 PDERROR_INVALID_VALUES =>
\r
718 'command %s was passed "%s" but must be one of %s'
\r
720 PDERROR_NESTED_INTERNAL =>
\r
721 '{@internal}} cannot be nested inside {@internal}}'
\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
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
733 * encapsulates warning information
\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
746 class RecordWarning
\r
749 * name of global variable that descriptors for this warning/error is kept
\r
752 var $type = 'phpDocumentor_warning_descrip';
\r
754 * file this error occurred in
\r
759 * line number of the file this error occurred in
\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
782 * @todo CS Cleanup - do I need to add $data to the method signature?
\r
783 * to sprintf based on the error number
\r
785 function RecordWarning($file, $linenum, $num)
\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
798 sprintf($GLOBALS[$this->type][$this->num], $a[0], $a[1], $a[2], $a[3]);
\r
803 * prints the warning
\r
805 * @param string $string the warning to print
\r
809 function output($string = false)
\r
814 "WARNING in $this->file on line $this->linenum: $this->data\n";
\r
816 return "WARNING: $this->data\n";
\r
820 phpDocumentor_out("WARNING in $this->file " .
\r
821 "on line $this->linenum: $this->data\n");
\r
823 phpDocumentor_out("WARNING: $this->data\n");
\r
830 * encapsulates error information
\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
843 class RecordError extends RecordWarning
\r
846 * name of global variable that descriptors for this warning/error is kept
\r
849 var $type = 'phpDocumentor_error_descrip';
\r
854 * @param string $string the error to print
\r
858 function output($string = false)
\r
863 "\n\tERROR in $this->file on line $this->linenum: $this->data\n"
\r
866 return "\n\tERROR: $this->data\n";
\r
870 phpDocumentor_out("\n\tERROR in $this->file " .
\r
871 "on line $this->linenum: $this->data\n");
\r
873 phpDocumentor_out("\n\tERROR: $this->data\n");
\r
880 * contains all the errors/warnings
\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
897 * array of {@link RecordError}s
\r
900 var $errors = array();
\r
902 * array of {@link RecordWarning}s
\r
905 var $warnings = array();
\r
916 * index in {@link $errors} of last error triggered
\r
917 * @var integer|false
\r
919 var $lasterror = false;
\r
922 * index in {@link $warnings} of last warning triggered
\r
923 * @var integer|false
\r
925 var $lastwarning = false;
\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
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
940 function handleEvent($num,$data)
\r
943 case PHPDOCUMENTOR_EVENT_NEWLINENUM :
\r
944 $this->linenum = $data;
\r
947 case PHPDOCUMENTOR_EVENT_NEWFILE :
\r
948 $this->linenum = 0;
\r
949 $this->curfile = $data;
\r
952 case 1000000635 : // debugging
\r
953 phpDocumentor_out($this->curfile .
\r
954 ' has ' . $this->linenum . ' lines' . "\n");
\r
961 * add a new warning to the {@link $warnings} array
\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
968 * @todo CS Cleanup - do I need to add $data to the method signature?
\r
970 function addWarning($num)
\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
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
984 * add a new error to the {@link $errors} array
\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
991 * @todo CS Cleanup - do I need to add $data to the method signature?
\r
993 function addError($num)
\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
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
1007 * add a new error to the {@link $errors} array and returns the error string
\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
1014 * @todo CS Cleanup - do I need to add $data to the method signature?
\r
1016 function addErrorReturn($num)
\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
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
1030 * Get sorted array of all warnings in parsing/conversion
\r
1034 function &returnWarnings()
\r
1036 usort($this->warnings, array($this, "errorsort"));
\r
1037 return $this->warnings;
\r
1041 * Get sorted array of all non-fatal errors in parsing/conversion
\r
1045 function &returnErrors()
\r
1047 usort($this->errors, array($this, "errorsort"));
\r
1048 return $this->errors;
\r
1054 * @param RecordError|RecordWarning $a the first error/warning
\r
1055 * @param RecordError|RecordWarning $b the second error/warning
\r
1060 function errorsort($a, $b)
\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
1069 return strnatcasecmp($a->file, $b->file);
\r
1073 * Get the error message of the last error
\r
1077 function returnLastError()
\r
1079 return $this->errors[$this->lasterror]->output(true);
\r
1083 * Get the warning message of the last warning
\r
1087 function returnLastWarning()
\r
1089 return $this->warnings[$this->lastwarning]->output(true);
\r
1094 * @global ErrorTracker $GLOBALS['phpDocumentor_errors']
\r
1095 * @name $phpDocumentor_errors
\r
1097 $GLOBALS['phpDocumentor_errors'] = new ErrorTracker;
\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
1107 * @see ErrorTracker::addError()
\r
1108 * @todo CS Cleanup - do I need to add $data to the method signature?
\r
1110 function addError($num)
\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
1119 $phpDocumentor_errors->addError($num, $a[0], $a[1], $a[2], $a[3]);
\r
1123 * like {@link addError()} but exits parsing
\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
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
1134 function addErrorDie($num)
\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
1143 $phpDocumentor_errors->addErrorReturn($num, $a[0], $a[1], $a[2], $a[3]);
\r
1144 echo $phpDocumentor_errors->returnLastError();
\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
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
1160 function addWarning($num)
\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
1170 $phpDocumentor_errors->addWarning($num, $a[0], $a[1], $a[2], $a[3]);
\r