Perfect solution to the error _php warning and error of @package in Phpdoc export document

Source: Internet
Author: User
Tags pear

Today, when writing Phpdoc export document, I found a very depressing error, although this warning is not an important mistake, but it is always very unpleasant to look at. So I went to the internet to find a lot of relevant information, but depressed is not know that I used the Phpdoc version Tainu (1.4 version), or that many people did not encounter this problem, anyway is not related to this information to find, just found some from the Phpdocumentor official network poured out about @ Package the use of attention, and then only one check, see a version of another version, finally was I solved.

and found that the solution can solve @package and other related error prompts:

The problems that arise:

1, no @package tag is used in a docblock for xxxxxxxxxxx

2. XXXXXX has no page-level docblock, use @package in the ' the ' the ' I docblock to create one

3, error:xxxx can not have @package tag .... (The specific hint I forgot, the big question means that the document here cannot use the @package tag)

The main reason for the appeal problem is: page-level document block annotation parsing error

Page-level document comments:

Must be the first document block comment in the file and have a @package label

After the document is quickly commented, if it is followed by a section of PHP code or class declaration, it must be separated by a document block comment (that is, the page-level document block annotation cannot be followed by the code fragment)

such as the situation:

Case One: 

  
  
Copy Code code as follows:
/** * This is a page-level document block comment * @package haha * */class Test {}
The above 2 error message will appear. The solution to this case is to re-declare a document block annotation to class
Copy Code code as follows:
/** * This is a page-level document block comment * @package haha *//** * I am Test class/class Test {}
***********************************************Case Two:
Copy Code code as follows:
/** * This is a page-level document block comment//** * This is a page-level document block annotation * @package haha * * */class Test {}
There will be 1/2 of the above problems. The solution is the same as case one solution ***********************************************Case Three:
Copy Code code as follows:
/** * This is a page-level document block annotation * @package haha */define (' yyyy ', ' hahha ');
It will appear as described in the case of 3Error. The solution is also as follows:
Copy Code code as follows:
/** * This is a page-level document block comment * @package haha//** * I am a constant * * define (' yyyy ', ' hahha ');

If the written document block is correct, there is no @package-related error.

Note:

1, note in the note, any is not/** * * Type of comments will not be phpdoc resolution. Also, the comment lines that are not preceded by a * are not parsed in the/** * *.

2, if the declaration of the label does not give the relevant label will be issued an error message, such as @var after the variable, @return after no return type, will appear error errors. The solution is to add integrity or remove it if it is not.

In addition, provides a command-line command file execution that automates the production of DOC documents:

@Rem: command-line format for automatic export of Phpdoc documents 
@Rem: Author: Shosho x_824@sina.com 
@echo off 
@echo ******************************** 
@echo automatically export document usage instructions: 
@echo need to install the phpdocumentor of the command line. Installation is done with pear install phpdocumentor 
@echo 1, option: Set the format of the exported document, the command-line format supports four formats: The default is the first format 
@echo # # #1 ", HTML: Frames:default 
@echo # # #2 ", HTML:Smarty:default 
@echo # # #3, CHM:default:default 
@echo # # #4, PDF: Default:default 
@echo 2, dir: directories that need to perform export documents, 
@echo 3, OutputDir: Exported documents for directory 
@echo 4, Title: 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! Export successful 
@pause 

Note: This command needs to install the Phpdocumentor package under the command line, installed in pear.

This is my pleasure!

Above this perfect solution Phpdoc export document @package Warning and error is small series to share all the content, hope to give you a reference, also hope that we support cloud habitat community.

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: info-contact@alibabacloud.com 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.