Perfect solution to the @ package warning and Error errors in the phpdoc export document

Source: Internet
Author: User
The following small series will bring you a perfect solution for the @ package warning and Error errors in the phpdoc export document. I think it is quite good. now I will share it with you and give you a reference. Let's take a look at the small Editor. Today, we found a very depressing error when compiling the export document of PHPDoc. Although this warning is not an important error, it is always quite uncomfortable. So I went to the Internet to find a lot of relevant information, but I was depressed that I did not know that the PHPDoc version I used was too new (version 1.4), or that many people did not encounter this problem, there is no relevant information to find. I just found some precautions for using @ package from the official PHPDocumentor network, and then I can only check it one by one, after reading one version and another, I finally solved the problem.

In addition, this solution can solve related error prompts such as @ package:


1. no @ package tag was used in a DocBlock for XXXXXXXXXXX

2. XXXXXX has no page-level DocBlock, use @ package in the first DocBlock to create one

3. ERROR: XXXX can not have @ package tag .... (I forgot the specific prompt, which means that the @ package label cannot be used for the document here)

The main reason for the appeal problem is that the page-level document block annotation parsing is incorrect.

Page-level document notes:

It must be the first document block comment in the file and has the @ package label.

If a PHP code or class declaration is followed by a fast annotation in this document, it must be separated by a document block annotation (that is, the code segment cannot be followed after the page-level document block annotation)

For example:

Case 1: 

The code is as follows:

/*** This is a page-level document block comment * @ package haha **/class test {}

In the above case, the above 2 error message will appear. the solution to this case is to re-declare a document block comment for the class.

The code is as follows:

/*** This is a page-level document block comment * @ package haha *** // *** I am a test class */class test {}

**************************************** *******Case 2:

The code is as follows:

/*** This is a page-level document block annotation * // *** This is a page-level document block annotation * @ package haha **/class test {}

1/2 of the above problems may occur. The solution is the same as the solution in case 1 ****************************** *****************Case 3:

The code is as follows:

/*** This is a page-level document block comment * @ package haha **/define ('yyyy', 'hahha ');

As mentioned above, 3 Error occurs. The solution is as follows:

The code is as follows:

/*** This is a page-level document block comment * @ package haha * // *** I am a constant */define ('yyyy', 'hahha ');

If the document block is correct, no errors related to @ package will occur.


1. Note that no comments of the/***/type are parsed by PHPDoc. In addition, the comments that do not start with * in front of the comments in/***/will not be parsed.

2. if a tag is declared but no required tag options are provided, an Error message will be sent. for example, there is no variable after @ var and no return type after @ return, errors will occur. The solution is to complete the configuration or remove it if it does not exist.

In addition, you can run a command file in the command line mode to automatically execute the Doc file generation:

@ Rem: automatically export the PHPDoc file in command line format @ Rem: author: xiao @ echo off @ echo ********************************* **************************************** * ***** @ echo: @ echo: you need to install the php‑entor of the command line. the installation method is to install pear install php‑entor with pear. @ echo 1. option: set the format of the exported document. the command line format supports four formats: the default format is @ echo ### 1. HTML: frames: default @ echo ### 2. HTML: Smarty: default @ echo ### 3], CHM: default @ echo ### 4], PDF: defa Ult: default @ echo 2, dir: Directory of the file to be exported, @ echo 3, outputDir: Directory of the exported file @ echo 4, title: the title of the exported document @ echo ********************************* **************************************** * ***** @ set option = HTML: frames: default @ set dir = D: \ PHPAPP \ test @ set outputDir = D: \ PHPAPP \ doc @ set title = PHPWindDoc @ phpdoc-d % dir %-o % option %-ti % title %-t % outputDir % @ echo welcome! Exported successfully @ pause

Note:This command requires the phpjavasentor package under the command line to be installed using pear.


The above is a perfect solution to the Error of @ package warning and Error in the phpdoc export document. it is all the content that I have shared with you. I hope you can give me a reference and support me a lot.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.