1 ################################################################################
\r
2 phpDocumentor Frequently Asked Questions
\r
4 ################################################################################
\r
6 ################################################################################
\r
8 Before we start with questions and their answers, make sure to read the
\r
9 documentation *thoroughly* found at http://www.phpdoc.org/manual.php. The
\r
10 complexity of phpDocumentor can be a bit impenetrable until you understand the
\r
13 If you have read the documentation thoroughly, and have read this FAQ and you
\r
14 are still lost, please go directly to the bug database at
\r
15 http://sourceforge.net/tracker/?group_id=11194&atid=111194 and read through the
\r
16 open bugs. If you don't find the solution to your problem (or proof that it
\r
17 at least is not your fault), then go to the help forum and post a help message
\r
18 at http://sourceforge.net/forum/forum.php?forum_id=35065.
\r
20 ################################################################################
\r
21 All Questions (Table of Contents)
\r
22 ################################################################################
\r
24 Q: There is no package.xml in the release, where is it?
\r
25 Documentation Errors
\r
26 Q: I keep getting an illegal package tag error for the first DocBlock in a file,
\r
27 isn't this a page-level DocBlock?
\r
28 Q: I keep getting a warning that there is no @package tag in file xxx.php, but
\r
29 there is a @package tag in the class definition, doesn't this apply to the
\r
32 Q: Can you implement the @example tag inline so that I can put PHP source code
\r
33 examples directly in DocBlocks?
\r
35 Q: phpDocumentor crashes if I use __FUNCTION__!!!
\r
37 ################################################################################
\r
39 ################################################################################
\r
41 Q: There is no package.xml in the release, where is it?
\r
43 A: this problem occurs when one does the faulty steps of:
\r
45 $ tar xvf PhpDocumentor-1.3.1.tgz
\r
46 $ pear install package.xml
\r
48 instead, the user should simply run:
\r
50 $ pear install PhpDocumentor-1.3.1.tgz
\r
52 or, if the zlib extension is not enabled:
\r
54 $ gunzip PhpDocumentor-1.3.1.tgz
\r
55 $ pear install PhpDocumentor-1.3.1.tar
\r
57 ################################################################################
\r
58 Documentation Errors
\r
59 ################################################################################
\r
61 Q: I keep getting an illegal package tag error for the first DocBlock in a file,
\r
62 isn't this a page-level DocBlock?
\r
66 ---VERSION 1.2.2 has a different page-level docblock recognition algorithm
\r
67 ---Now, the first docblock in a file is a page-level docblock if it contains
\r
70 A: Please read the documentation very carefully. A page-level DocBlock does
\r
71 occur at the start of a file, but the first DocBlock is not always a
\r
72 page-level DocBlock! Why is this? Very often, you will want to document
\r
73 the entire page, or describe it (this page contains functions for blah), and
\r
74 also document the first item in a page separately. An example:
\r
78 * This file contains all foobar functions and defines
\r
79 * @package mypackage
\r
82 * controls parsing of bar information
\r
84 define('parse_bar',true);
\r
87 The page has its own information, and the define has its own information.
\r
88 An example of what not to do:
\r
92 * This file contains all foobar functions and defines
\r
93 * @package mypackage
\r
95 define('parse_bar',true);
\r
98 Here, the DocBlock belongs to the define and not to the page! phpDocumentor
\r
99 can successfully parse this DocBlock, but it will apply the comment to the
\r
100 documentation of define('parse_bar',true); and not to the page. Therefore,
\r
101 it warns you that your @package tag will be ignored because defines may not
\r
102 contain a @package tag.
\r
104 Q: I keep getting a warning that there is no @package tag in file xxx.php, but
\r
105 there is a @package tag in the class definition, doesn't this apply to the
\r
108 A: No. This example does not have a page-level DocBlock:
\r
112 * This class is in package mypackage
\r
113 * @package mypackage
\r
115 class in_mypackage {...}
\r
118 phpDocumentor therefore assumes the page-level package is the same as the
\r
119 class package, mypackage. This is fine in most cases, but if multiple
\r
120 classes are in the same file with different packages, as in:
\r
124 * This class is in package mypackage
\r
125 * @package mypackage
\r
127 class in_mypackage {...}
\r
129 * This class is in package anotherpackage
\r
130 * @package anotherpackage
\r
132 class in_anotherpackage {...}
\r
135 There is no way to determine which package the page should belong to, and
\r
136 phpDocumentor will automatically put it in the default package. This can
\r
137 cause incredible headaches debugging, and so we have added a warning in the
\r
138 1.2.0 series that informs you if the package is inferred by phpDocumentor.
\r
139 To fix this warning, simply place a page-level DocBlock with a @package tag
\r
144 * This file contains two packages
\r
145 * @package filepackage
\r
148 * This class is in package mypackage
\r
149 * @package mypackage
\r
151 class in_mypackage {...}
\r
153 * This class is in package anotherpackage
\r
154 * @package anotherpackage
\r
156 class in_anotherpackage {...}
\r
158 ################################################################################
\r
160 ################################################################################
\r
161 Q: Can you implement the @example tag inline so that I can put PHP source code
\r
162 examples directly in DocBlocks?
\r
164 A: This is implemented using the HTML <code></code> tags as in:
\r
167 * Short description
\r
169 * Start of long description, here is a code example:
\r
171 * $my_phpcode = "easy to explain";
\r
175 * define('morecode',true);
\r
178 ################################################################################
\r
180 ################################################################################
\r
181 Q: phpDocumentor crashes if I use __FUNCTION__!!!
\r
183 A: This is caused by a known bug in all PHP versions prior to 4.3.2. It was
\r
184 fixed in PHP 4.3.2RC1, you must upgrade to PHP 4.3.2 if you use __FUNCTION__
\r
185 in code that you wish to document (sorry!) or apply the bugfix patch to the
\r
186 tokenizer extension and recompile php (see the php.internals archive at
\r