Source for file Errors.inc

Documentation is available at Errors.inc

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

Documentation generated on Mon, 05 Dec 2011 21:20:54 -0600 by phpDocumentor 1.4.4