2013-08-29 37 views
1

嗨我已經使用codeigniter創建了一個項目。現在我正在嘗試生成phpdoc。這是我第一次使用phpdoc,我已經閱讀了他們的文檔和其他教程。當我試圖生成我得到錯誤的名單大多是codeigniter中的Phpdoc頁面級錯誤

....沒有頁面級文檔塊,使用@package第一文檔塊創建一個

和什麼也沒有發生。但是當我在控制器或模型文件夾內運行phpdoc它的工作原理,但不從根文件夾或應用程序文件夾運行。我哪裏錯了?

這裏是文檔塊的開始

<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); 
/** 
* 
* Project 1 files 
* 
* @package  Project1 
* @subpackage projectControllers 
* @author  Abhishek Salian 
* @copyright Copyright (c) 2013, AS. 
* @link  http://localhost/project1/ 
* @since  Version 1.0 
*/ 
?> 

對於每一個方法的被檢

/** 
* index 
* 
* This loads the index page 
* 
* @access public 
*/ 

錯誤:

Abhis-MacBook-Pro:~ abhishek$ sudo phpdoc -d /Applications/mamp/htdocs/NewFrontend/ -t /Applications/mamp/htdocs/Docs/ 
PHP Version 5.4.10 
phpDocumentor version 1.4.4 

Parsing configuration file phpDocumentor.ini... 
    (found in /Applications/MAMP/bin/php/php5.4.10/lib/php/data/PhpDocumentor/)... 

done 
Maximum memory usage set at 256M after considering php.ini... 
using tokenizer Parser 
Hidden /Applications/mamp/htdocs/NewFrontend/.DS_Store Ignored 
Hidden /Applications/mamp/htdocs/NewFrontend/.git Ignored 
Hidden /Applications/mamp/htdocs/NewFrontend/.gitignore Ignored 
Hidden /Applications/mamp/htdocs/NewFrontend/.htaccess Ignored 
Hidden /Applications/mamp/htdocs/NewFrontend/.travis.yml Ignored 
Hidden /Applications/mamp/htdocs/NewFrontend/application/.DS_Store Ignored 
Hidden /Applications/mamp/htdocs/NewFrontend/application/config/.DS_Store Ignored 
Hidden /Applications/mamp/htdocs/NewFrontend/application/libraries/tcpdf/tools/.htaccess Ignored 
Hidden /Applications/mamp/htdocs/NewFrontend/images/.DS_Store Ignored 
Hidden /Applications/mamp/htdocs/NewFrontend/lp/.htaccess Ignored 
Hidden /Applications/mamp/htdocs/NewFrontend/lp/m/.htaccess Ignored 


Grabbing README/INSTALL/CHANGELOG 

done 


Tutorial/Extended Documentation Parsing Stage 

done 

一般分析階段

Reading file /Applications/mamp/htdocs/NewFrontend/application/cache/index.html -- File not parsed, not a php file 
Reading file /Applications/mamp/htdocs/NewFrontend/application/config/autoload.php -- Parsing file 
WARNING in autoload.php on line 115: File "/Applications/mamp/htdocs/NewFrontend/application/config/autoload.php" has no page-level DocBlock, use @package in the first DocBlock to create one 
Reading file /Applications/mamp/htdocs/NewFrontend/application/config/constants.php -- Parsing file 
WARNING in constants.php on line 40: File "/Applications/mamp/htdocs/NewFrontend/application/config/constants.php" has no page-level DocBlock, use @package in the first DocBlock to create one 
Reading file /Applications/mamp/htdocs/NewFrontend/application/config/database.php -- Parsing file 
WARNING in database.php on line 135: File "/Applications/mamp/htdocs/NewFrontend/application/config/database.php" has no page-level DocBlock, use @package in the first DocBlock to create one 
Reading file /Applications/mamp/htdocs/NewFrontend/application/config/development/config.php -- Parsing file 
WARNING in config.php on line 611: File "/Applications/mamp/htdocs/NewFrontend/application/config/development/config.php" has no page-level DocBlock, use @package in the first DocBlock to create one 
Reading file /Applications/mamp/htdocs/NewFrontend/application/config/doctypes.php -- Parsing file 

回答

0

phpDoc將查找文件級別的docblock以在任何代碼之前出現。由於第1行中的「if」在它之前沒有docblock,因此會出現該錯誤。在「if」行之後,您確實擁有的docblock將與隨後出現的任何代碼元素相關聯,無論是類,函數,甚至僅包含/ require行。

您可以「解決」該錯誤的唯一方法是在該頂部「if」行之前放置docblock。該docblock至少需要@package標記,否則,因爲這看起來不是名稱空間的代碼。

像這樣:

<?php 
/** 
* 
* Project 1 files 
* 
* @package  Project1 
* @subpackage projectControllers 
* @author  Abhishek Salian 
* @copyright Copyright (c) 2013, AS. 
* @link  http://localhost/project1/ 
* @since  Version 1.0 
*/ 

/** no direct access */ 
if (! defined('BASEPATH')) exit('No direct script access allowed'); 

// now more stuff... 

這可能需要有一個這樣的文檔塊「/ **無法直接訪問* /」,在IF行的前面,使分析器不扎「項目1文件」docblock到「IF」行本身。

+0

謝謝,我會試試看。 –

+0

沒有運氣。請檢查我添加的第一個錯誤的問題。 –

+0

您可以向我展示「application/config/autoload.php」文件頂部的所有內容,一直到實際代碼的第一行? – ashnazg