background image

PHP Coding Standard

2

o

Interface and Implementation Documentation 

 

 

o

 

目录文档

 

 

复杂性管理规则 

o

      

o

Open/Closed Principle 

 

 

o

sever configuration 

 

 

 

类规则 

o

Different Accessor Styles 

 

 

o

 

别在对象架构期做实际的工作

 

 

o

Thin vs. Fat Class Interfaces 

 

 

o

 

短方法

 

 

进程规则 

o

Use a Design Notation and Process 

 

 

o

Code Reviews 

 

 

o

Create a Source Code Control System Early and Not Often

 

  

o

Create a Bug Tracking System Early and Not Often

 

 

 

o

Honor Responsibilities 

 

 

格式化 

o

 

大括号

 

 {} 

   

 

规则

 

 

o

缩进

 

 /  制表符

 

 /  

 

 

空格 规则

 

 

o

 

小括号、关键词和函数 规则

 

 

 

o

If Then Else

 

    格式

 

 

 

o

switch

 

    

 

格式

 

 

o

continue,break

 

      

   ? 

   

 

的使用

 

 

o

每行一个语句

 

 

 

o

声明块的定位

 

 

 

杂项 

o

不要不可思议的数字

 

 

 

o

错误返回检测规则

 

 

 

o

不要采用缺省值测试非零值

 

 

 

o

布尔逻辑类型

 

 

 

o

通常避免嵌入式的赋值

 

 

 

o

重用您和其他人的艰苦工作

 

 

 

o

使用

 

     if (0)

 

 来注释外部代码块

 

 

 

o

其他杂项

 

 

 

PEAR 编码标准

o

Pear-Indenting_

 

 

o

Pear-Control Structures_

 

 

o

Pear-Function Calls

 

 

 

o

Pear-Function Definitions

 

 

o

Pear-Comments_

 

 

o

Pear-Including Codes

 

    

 

o

Pear-PHP Code Tags_

 

 

o

Pear-Header Comment Blocks_

 

 

© Copyright 1995-2001. Todd Hoff and Fredrik Kristiansen. All rights reserved.