################################################################################
				phpDocumentor Frequently Asked Questions

################################################################################
Introduction
################################################################################

Before we start with questions and their answers, make sure to read the
documentation *thoroughly* found in the spec/ subdirectory.  The complexity of
phpDocumentor is a bit impenetrable until you understand the logic behind it.

If you have read the documentation thoroughly, and have read this FAQ and you
are still lost, please go directly to the bug database at
http://sourceforge.net/tracker/?group_id=11194&atid=111194 and read through the
open bugs.  If you don't find the solution to your problem (or proof that it
at least is not your fault), then go to the help forum and post a help message
at http://sourceforge.net/forum/forum.php?forum_id=35065.

################################################################################
All Questions (Table of Contents)
################################################################################
Installation
 Q: [UNIX ONLY] When I run phpdoc from outside its directory, it doesn't work!
 Q: [PEAR ONLY] I ran pear install PhpDocumentor, but running 'phpdoc' doesn't
    work!
Documentation Errors
 Q: I keep getting an illegal package tag error for the first DocBlock in a file,
    isn't this a page-level DocBlock?
 Q: I keep getting a warning that there is no @package tag in file xxx.php, but
    there is a @package tag in the class definition, doesn't this apply to the
    file?
Feature Requests
 Q: Can you implement the @example tag inline so that I can put PHP source code
    examples directly in DocBlocks?
Crash/Segfaults
 Q: phpDocumentor crashes if I use __FUNCTION__!!!
 
################################################################################
Installation
################################################################################

Q: [UNIX ONLY] When I run phpdoc from outside its directory, it doesn't work!

A: This is a two-fold problem.  First, you must make sure the first line of
   phpdoc points to the path to PHP.  It defaults to:
   
   #!/usr/local/bin/php -q

   Change this to the correct path.  If this does not fix your problem, then you
   must make sure that php's include_path ini setting refers either to the
   directory that phpDocumentor is in, or to the PEAR directory if and ONLY if
   you installed phpDocumentor from PEAR.  If this doesn't fix your problem
   post a message at the sourceforge help forum.
   
Q: [PEAR ONLY] I ran pear install PhpDocumentor, but running 'phpdoc' doesn't
   work!
   
A: pear will install phpDocumentor into a subdirectory of the bin directory.
   To use phpdoc from the commandline, you must add the PhpDocumentor
   subdirectory to the path.  Usually this will be /usr/local/bin/PhpDocumentor.
   To find out your bin_dir, run pear config-show and look for this line:
   
   | PEAR executables directory     | bin_dir         | /usr/local/bin |

################################################################################
Documentation Errors
################################################################################

Q: I keep getting an illegal package tag error for the first DocBlock in a file,
   isn't this a page-level DocBlock?

A: Please read the documentation very carefully.  A page-level DocBlock does
   occur at the start of a file, but the first DocBlock is not always a
   page-level DocBlock!  Why is this?  Very often, you will want to document
   the entire page, or describe it (this page contains functions for blah), and
   also document the first item in a page separately.  An example:
   
   <?php
   /**
   * This file contains all foobar functions and defines
   * @package mypackage
   */
   /**
   * controls parsing of bar information
   */
   define('parse_bar',true);
   ?>
   
   The page has its own information, and the define has its own information.
   An example of what not to do:
   
   <?php
   /**
   * This file contains all foobar functions and defines
   * @package mypackage
   */
   define('parse_bar',true);
   ?>
   
   Here, the DocBlock belongs to the define and not to the page!  phpDocumentor
   can successfully parse this DocBlock, but it will apply the comment to the
   documentation of define('parse_bar',true); and not to the page.  Therefore,
   it warns you that your @package tag will be ignored because defines may not
   contain a @package tag.

Q: I keep getting a warning that there is no @package tag in file xxx.php, but
   there is a @package tag in the class definition, doesn't this apply to the
   file?

A: No.  this example does not have a page-level DocBlock:

   <?php
   /**
   * This class is in package mypackage
   * @package mypackage
   */
   class in_mypackage {...}
   ?>
   
   phpDocumentor therefore assumes the page-level package is the same as the
   class package, mypackage.  This is fine in most cases, but if multiple
   classes are in the same file with different packages, as in:

   <?php
   /**
   * This class is in package mypackage
   * @package mypackage
   */
   class in_mypackage {...}
   /**
   * This class is in package anotherpackage
   * @package anotherpackage
   */
   class in_anotherpackage {...}
   ?>
   
   There is no way to determine which package the page should belong to, and
   phpDocumentor will automatically put it in the default package.  This can
   cause incredible headaches debugging, and so we have added a warning in the
   1.2.0 series that informs you if the package is inferred by phpDocumentor.
   To fix this warning, simply place a page-level DocBlock with a @package tag
   like:

   <?php
   /**
   * This file contains two packages
   * @package filepackage
   */
   /**
   * This class is in package mypackage
   * @package mypackage
   */
   class in_mypackage {...}
   /**
   * This class is in package anotherpackage
   * @package anotherpackage
   */
   class in_anotherpackage {...}
   ?>
################################################################################
Feature Requests
################################################################################
Q: Can you implement the @example tag inline so that I can put PHP source code
   examples directly in DocBlocks?

A: This is implemented using the HTML <code></code> tags as in:

   /**
    * Short description
    *
    * Start of long description, here is a code example:
    * <code>
    *  $my_phpcode = "easy to explain";
    * </code>
    * More text
    * <code>
    *  define('morecode',true);
    * </code>
    */
################################################################################
Crash/Segfaults
################################################################################
Q: phpDocumentor crashes if I use __FUNCTION__!!!

A: This is caused by a known bug in all PHP versions prior to 4.3.2.  It was
   fixed in PHP 4.3.2RC1, you must upgrade to PHP 4.3.2 if you use __FUNCTION__
   in code that you wish to document (sorry!) or apply the bugfix patch to the
   tokenizer extension and recompile php (see the php.internals archive at
   php.net for help)
