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