PhpDocumentor手冊-安裝和標籤使用

來源:互聯網
上載者:User

PhpDocumentor手冊-安裝和標籤使用

1.安裝

必須包含:php 5.3.3版本以上, intl for php 擴充 ,Graphviz

安裝方式 使用 pear 命令

pear channel-discover pear.phpdoc.org

pear install phpdoc/phpDocumentor

2.DocBlock基本文法

DocBlock(文檔塊)

/**

* phpdocumentor 測試.

*

*/

DocBlock使用範圍在以下結構元素中

l namespace

l require(_once)

l include(_once)

l class

l interface

l trait

l function (including methods)

l property

l constant

l variables, both local and global scope.

DocBlock例子

/**

* 摘要:實現得到使用者年齡的方法。

*@param string $name 使用者名稱稱,需使用中文

*@return

*/

Function getage($name){

......

}

DocBlock包括三個部分

1.摘要

對整個功能的概要說明

2.說明

對功能或者標記延伸說明

演算法說明

樣本說明

著作權許可說明...

對標記 的說明

3.標記

@api

@author

@category

@copyright

@deprecated

@example

@filesource

@global

@ignore

@internal

@license

@link

@method

@package

@param

@property

@property-read

@property-write

@return

@see

@since

@source

@subpackage

@throws

@todo

@uses & @used-by

@var

@version

3.標籤的使用

Type:string , int, bool, floot , array, void 等等

詳見 http://phpdoc.org/docs/latest/references/phpdoc/types.html

@api 標記該結構元素適合第三方的組件


@author 文檔作者標記

使用文法

@author [name] []

@package 封裝包的名稱 一組相關類、函數封裝的包名稱

使用文法

@package [level 1]\[level 2]\[etc.]

@copyright 著作權資訊

使用文法

@copyright [description]

@deprecated 棄用說明

使用文法

@deprecated [] []

@example 範例程式碼的位置

使用文法

@example [location] [ [] ][]

@example /www/web/default/test.php 1 3 代碼在test.php檔案中從第一行到第三行

@ignore 告訴phpdocumentor忽略處理的

使用文法

@ignore []

@ignore phpdoc會忽略OS 常量的定義,不在文檔中顯示

define("OS","Windows");

@license 許可說明

使用文法

@license [] [name]

@link 連結外部更詳細的資訊

使用文法

@link [URI] []


@method 簡單理解 表示 __call 魔法函數是 需要調用的方法

使用文法

@method [return type] [name]([[type] [parameter]<, ...>])[]

@method void setInteger(integer $integer) 設定整數

@param 一個函數或者方法的參數

使用文法

@param [Type] [name] []

@param string $myArgument 我的一個字串參數

@property 表示使用 __get()和__set()魔術方法 調用的屬性

使用文法

@property [Type] [name] []

@return 方法或函數的傳回值

使用文法

@return [Type] []

@see 查看相關聯的結構元素或者網站

使用文法

@see [URI | FQSEN] []

@see \Phpdocumentor::$items 查看phpdocumentor類下的items屬性

FQSEN解釋:結構元素名稱\My\Space\MyClass::myMethod()

@since 從哪個版本是開始使用

@since [version] []

@source 顯示原始碼

@source [ [] ][]

@throws 拋出錯誤說明

@throws [Type] []

@todo 後續有待開發的描述

@uses & @used-by 查看參考相關結構元素

@uses [FQSEN] []

@var 變數或者屬性

@var [“Type”] [$element_name][]

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.