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关联的 ...
随机推荐
- ajax实现简单的点击左侧菜单,右侧加载不同网页
实现:ajax实现点击左侧菜单,右侧加载不同网页(在整个页面无刷新的情况下实现右侧局部刷新,用到ajax注意需要在服务器环境下运行,从HBuilder自带的服务器中打开浏览效果即可) 原理:ajax的 ...
- COGS——C 908. 校园网 || 洛谷——P 2746 [USACO5.3]校园网Network of Schools
http://www.cogs.pro/cogs/problem/problem.php?pid=908 || https://www.luogu.org/problem/show?pid=27 ...
- AIX上安装Oracle10G软件
安装准备 (1)确认系统版本号.内核版本号 # oslevel –r //查看操作系统版本号 //-08能够安装10g,-09能够安装11g watermark/2/text/aHR0cDovL2 ...
- WCF REST (二)
今天主要写下 POST等其他方式 发送请求 以及 流方式 文件的上传与下载 一.Post 提交数据 先来想下 POST和Get 的不同 Get 方式 我们直接通过 url 来传递参数 先来 ...
- 使用H5 formData对象上传图片和视频的文件时,必填的属性
async : false,cache : false,contentType : false,// 告诉jQuery不要去设置Content-Type请求头processData : false,/ ...
- 写PPT的先扬后抑的思路
近期给一个客户做IT战略规划. 基本结束了,客户要求写点有高度的东西.我想也是,尽管眼下的PPT也触及到战略和行业的问题,可是没有总结出来.于是就挖空心思,琢磨了三天.写了4页PPT.改动了几遍.还算 ...
- 首次使用vim
不管是linux还是cygwin,刚安装完系统之后使用vim时都需要对vim进行配置.未配置的情况下,象方向键.回车键.退格键都不会是正常的反应.因为vim默认使用了vi的操作模式. 不多说,上代码. ...
- CNTK 搞深度学习-1
CNTK 搞深度学习 Computational Network Toolkit (CNTK) 是微软出品的开源深度学习工具包.本文介绍CNTK的基本内容,如何写CNTK的网络定义语言,以及跑通一个简 ...
- 连接mongodb,kafka异步处理代码
1. mongodb异步处理 依赖: <dependencies> <dependency> <groupId>org.mongodb</groupId> ...
- Android java取得实时上周的时间
import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Te ...