PHPDocumentor 整理目光规范
- string
字符串类型 - integer or
int
整型 - boolean or
bool
布尔类型 true or false - float or
double
浮点类型 - object
对象 - mixed
混合类型
没有指定类型或不确定类型时使用 - array
数组 - resource
资源类型
(如数据库查询返回) - void
空值(控制器返回值常常使用) - null null类型
- callable
回调函数 - false or
true
仅仅返回true or fasle
时使用 - self
自身
你会写凝视么?从我写代码開始。这个问题就一直困扰着我。相信也相同困扰着其它同学。曾经的写凝视总是没有一套行之有效的标准,给维护和协同开发带了很多麻烦,直到近期读到了phpdocumentor的凝视标准。
以下对phpdocumentor的凝视标准进行总结:
Type(数据类型):
Tags(标签):
|
Tag |
Element |
Description |
|
api |
Methods |
声明接口 |
|
author |
Any |
作者信息 |
|
category |
File, Class |
将一系列的元素分类在一起 |
|
copyright |
Any |
版权信息 |
|
deprecated |
Any |
声明元素已被弃用,能够在将来的版本号中删除 |
|
example |
Any |
演示样例 |
|
filesource |
File |
文件资源 |
|
global |
Variable |
声明一个全集变量 |
|
ignore |
Any |
忽略当前元素 (phpdocumentor |
|
internal |
Any |
声明一个值为整形,或者设置一个应用的默认值为整型 |
|
license |
File, Class |
声明许可类型 |
|
link |
Any |
声明一个和当前元素有关的链接 |
|
method |
Class |
声明当前类那些魔术方法能够被调用 |
|
package |
File, Class |
声明当前元素所属的包 |
|
param |
Method, Function |
声明当前元素的一个參数 |
|
property |
Class |
声明当前类有那些魔术方法能够被调用属性 |
|
property-read |
Class |
声明当前类有那些魔术方法能够读取属性 |
|
property-write |
Class |
声明当前类有那些魔术方法能够设置属性 |
|
return |
Method, Function |
返回值 |
|
see |
Any |
说明当前元素參数引用于其它网站或元素 |
|
since |
Any |
声明当前元素始于于哪个版本号 |
|
source |
Any, except File |
展示当前元素的源代码 |
|
subpackage |
File, Class |
将当期元素分类 |
|
throws |
Method, Function |
说明当前元素抛出的异常 |
|
todo |
Any |
说明当前元素的开发活动 |
|
uses |
Any |
引用一个关联元素 |
|
var |
Properties |
声明属性 |
|
version |
Any |
版本号 |
Example(演示样例):
// =============================
@api
/**
* This method will not change until a major release.
*
* @api
*
* @return void
*/
function showVersion()
{
<...>
}
// =============================
@author
/**
* @author My Name
* @author My Name <my.name@example.com>
*/
// =============================
@category
/**
* Page-Level DocBlock
*
* @category MyCategory
* @package MyPackage
*/
// =============================
@copyright
/**
* @copyright 1997-2005 The PHP Group
*/
// =============================
@deprecated
/**
* @deprecated
* @deprecated 1.0.0
* @deprecated No longer used by internal code and not recommended.
* @deprecated 1.0.0 No longer used by internal code and not recommended.
*/
function count()
{
<...>
}
// =============================
@example
/**
* @example example1.php Counting in action.
* @example http://example.com/example2.phps Counting in action by a 3rd party.
* @example "My Own Example.php" My counting.
*/
function count()
{
<...>
}
// =============================
@filesource
/**
* @filesource
*/
// =============================
@global
phpdocumentor2.0不支持
// =============================
@ignore
if ($ostest) {
/**
* This define will either be 'Unix' or 'Windows'
*/
define("OS","Unix");
} else {
/**
* @ignore
*/
define("OS","Windows");
}
// =============================
@internal
/**
* @internal
*
* @return integer Indicates the number of items.
*/
function count()
{
<...>
}
/**
* Counts the number of Foo.
*
* {@internal Silently adds one extra Foo to compensate for lack of Foo }}
*
* @return integer Indicates the number of items.
*/
function count()
{
<...>
}
// =============================
@license
/**
* @license GPL
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
// =============================
@link
/**
* @link http://example.com/my/bar Documentation of Foo.
*
* @return integer Indicates the number of items.
*/
function count()
{
<...>
}
/**
* This method counts the occurrences of Foo.
*
* When no more Foo ({@link http://example.com/my/bar}) are given this
* function will add one as there must always be one Foo.
*
* @return integer Indicates the number of items.
*/
function count()
{
<...>
}
// =============================
@method
class Parent
{
public function __call()
{
<...>
}
} /**
* @method string getString()
* @method void setInteger(integer $integer)
* @method setString(integer $integer)
*/
class Child extends Parent
{
<...>
}
// =============================
@package
/**
* @package PSR\Documentation\API
*/
// =============================
@param
/**
* Counts the number of items in the provided array.
*
* @param mixed[] $items Array structure to count the elements of.
*
* @return int Returns the number of elements.
*/
function count(array $items)
{
<...>
}
// =============================
@property
class Parent
{
public function __get()
{
<...>
}
} /**
* @property string $myProperty
*/
class Child extends Parent
{
<...>
}
// =============================
@property-read
class Parent
{
public function __get()
{
<...>
}
} /**
* @property-read string $myProperty
*/
class Child extends Parent
{
<...>
}
// =============================
@property-write
class Parent
{
public function __set()
{
<...>
}
} /**
* @property-write string $myProperty
*/
class Child extends Parent
{
<...>
}
// =============================
@return
/**
* @return integer Indicates the number of items.
*/
function count()
{
<...>
}
/**
* @return string|null The label's text or null if none provided.
*/
function getLabel()
{
<...>
}
// =============================
@see
/**
* @see http://example.com/my/bar Documentation of Foo.
* @see MyClass::$items for the property whose items are counted
* @see MyClass::setItems() to set the items for this collection.
*
* @return integer Indicates the number of items.
*/
function count()
{
<...>
}
// =============================
@since
/**
* @since 1.0.1 First time this was introduced.
*
* @return integer Indicates the number of items.
*/
function count()
{
<...>
}
/**
* @since 1.0.2 Added the $b argument.
* @since 1.0.1 Added the $a argument.
* @since 1.0.0
*
* @return void
*/
function dump($a, $b)
{
<...>
}
// =============================
@source
/**
* @source 2 1 Check that ensures lazy counting.
*/
function count()
{
if (null === $this->count) {
<...>
}
}
// =============================
@subpackage
/**
* @package PSR
* @subpackage Documentation\API
*/
// =============================
@throws
/**
* Counts the number of items in the provided array.
*
* @param mixed[] $array Array structure to count the elements of.
*
* @throws InvalidArgumentException if the provided argument is not of type
* 'array'.
*
* @return int Returns the number of elements.
*/
function count($items)
{
<...>
}
// =============================
@todo
/**
* Counts the number of items in the provided array.
*
* @todo add an array parameter to count
*
* @return int Returns the number of elements.
*/
function count()
{
<...>
}
// =============================
@uses
/**
* @uses MyClass::$items to retrieve the count from.
*
* @return integer Indicates the number of items.
*/
function count()
{
<...>
}
// =============================
@var
class Counter
{
/**
* @var
*/
public $var;
}
// =============================
@version
/**
* @version 1.0.1
*/
class Counter
{
<...>
}
/**
* @version GIT: $Id$ In development. Very unstable.
*/
class NeoCounter
{
<...>
}
// =============================
phpdocumentor手冊:http://www.phpdoc.org/docs/latest/index.html
(我有限的英语水平,假设不当翻译,请建议,当然,及时修正)
PHPDocumentor 整理目光规范的更多相关文章
- 将Html文档整理为规范XML文档
有多种方式可以在.NET 平台进行HTML文件解析.数据提取,其中最简单.稳妥的办法是先使用工具将Html文档整理成XML文档,再通过XML Dom模型或XPath灵活地进行数据处理.SGML便是一个 ...
- 4、SQL基础整理(规范函数)
规范函数: 绝对值 select abs(-5) print abs(-5) 表中取绝对值的方法: select code,name,abs(chinese)as yuwen from xueshen ...
- PHPDocumentor代码注释规范说明
PHPDocumentor是一个的用PHP写的道具,对于有规则注释的php程序,它能够快速生成具有相互参照,索引等功能的API文档. 标记 用途 描述 @abstract 抽象类的变量和方法 ...
- MySQL命名、设计及使用规范--------来自标点符的《MySQL命名、设计及使用规范》
原文地址:http://www.biaodianfu.com/mysql-best-practices.html 最近在看MySQL相关的内容,整理如下规范,作为一名刚刚学习MySQL的菜鸟,整理的内 ...
- 摘要JSR168 PORLET标准手册汉化整理
本规范汉化资源搜集整理于网上并由我作了些修改和添加,主要为适应大陆的语辞.用语及其他未译之处. 由于本人于水平有限,如有错误,请各位高手指正:若有高见,希望不吝言辞,同为中国开源作项献. 特此严重感谢 ...
- C++路径的整理
写C++,路径的问题一直都让人很头疼,抽空整理一些方法:也许以后会用到: 1."./" 加不加都一样,就是指当前目录 2."../" 表示当前目录的上级目录,即 ...
- MySQL命名、设计及使用规范
本文转载自MySQL命名.设计及使用规范 导语 最近在看MySQL相关的内容,整理如下规范,作为一名刚刚学习MySQL的菜鸟,整理的内容非常的基础,中间可能涉及到有错误的地方,欢迎批评指正,看到有错误 ...
- windows路径操作API函数
备用,方便查找: PathRemoveArgs 去除路径的参数 PathRemoveBackslash 去除路径最后的反斜杠"\" PathAddBackslash 在 ...
- Windows phone 8 学习笔记(4) 应用的启动(转)
Windows phone 8 的应用除了可以直接从开始菜单以及应用列表中打开外,还可以通过其他的方式打开.照片中心.音乐+视频中心提供扩展支持应用从此启动.另外,我们还可以通过文件关联.URI关联的 ...
随机推荐
- 前端切图|点击按钮div变色
<!DOCTYPE html> <html> <head> <title>点击按钮div变色.html</title> <meta c ...
- 原生js大总结八
071.如何组织事件冒泡 利用事件对象属性:stopPropagation 和 cancelBubble stopPropagetion是一个方法:e.stopPropagetion(); ...
- 洛谷 P1170 兔八哥与猎人
P1170 兔八哥与猎人 题目描述 兔八哥躲藏在树林旁边的果园里.果园有M × N棵树,组成一个M行N列的矩阵,水平或垂直相邻的两棵树的距离为1.兔八哥在一棵果树下. 猎人背着猎枪走进了果园,他爬上一 ...
- js进阶 13 jquery动画函数有哪些
js进阶 13 jquery动画函数有哪些 一.总结 一句话总结: 二.jquery动画函数有哪些 原生JavaScript编写动画效果代码比较复杂,而且还需要考虑兼容性.通过jQuery,我们使用简 ...
- 页面事件(Init,Load,PreRender)执行顺序
简介 对由 Microsoft® Internet 信息服务 (IIS) 处理的 Microsoft® ASP.NET 页面的每个请求都会被移交到 ASP.NET HTTP 管道.HTTP 管道由一系 ...
- POJ 3723 Conscription MST
http://poj.org/problem?id=3723 题目大意: 需要征募女兵N人,男兵M人,没征募一个人需要花费10000美元,但是如果已经征募的人中有一些关系亲密的人,那么可以少花一些钱, ...
- POJ 2386 Lake Counting DFS水水
http://poj.org/problem?id=2386 题目大意: 有一个大小为N*M的园子,雨后积起了水.八连通的积水被认为是连接在一起的.请求出院子里共有多少水洼? 思路: 水题~直接DFS ...
- Spring MVC学习总结(1)——Spring MVC单元测试
关于spring MVC单元测试常规的方法则是启动WEB服务器,测试出错 ,停掉WEB 改代码,重启WEB,测试,大量的时间都浪费在WEB服务器的启动上,下面介绍个实用的方法,spring MVC单元 ...
- springboot集成shiro 实现权限控制(转)
shiro apache shiro 是一个轻量级的身份验证与授权框架,与spring security 相比较,简单易用,灵活性高,springboot本身是提供了对security的支持,毕竟是自 ...
- Spring view controller
https://www.zifangsky.cn/648.html https://www.zifangsky.cn/665.html https://www.zifangsky.cn/671.htm ...