dtzhfb4869 2013-08-29 13:13
浏览 52

codeigniter中的Phpdoc页面级错误

Hi I have created a project using codeigniter. Now I am trying to generate phpdoc. This is my first time using phpdoc and i have read their documentation and other tutorials. When I try to generate i get list of error mostly it is

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

and nothing has been generated. But when i run phpdoc inside controllers or models folder it works but doesnt run from root folder nor from application folder. Where Am I going wrong?

Here is the sample of docblock starting

<?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
 */
?>

For every method

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

Error:

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

General Parsing Stage

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
  • 写回答

1条回答 默认 最新

  • douyiyi5284 2013-08-30 15:57
    关注

    phpDoc looks for a file-level docblock to appear before any code. Because that "if" in line 1 has no docblock before it, you get that error. The docblock that you do have, after that "if" line, would be associated with whatever code element happens to appear after it, whether it's a class, a function, even just an include/require line.

    The only way you can "solve" that error is to put a docblock before that top "if" line. That docblock will need at least the @package tag in it, if nothing else, since this appears to not be namespaced code.

    Like this:

    <?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...
    

    It might be necessary to have a docblock like that "/** no direct access */" in front of the IF line to, so that the parser does not tie the "Project 1 files" docblock to the "IF" line itself.

    评论

报告相同问题?

悬赏问题

  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?