Zend studio 7.1中有关开发规范的设置

1、设置字符编码与换行符
步骤:Window -> Preferences -> General -> Workspace,在“Text file encoding”和“New text file line delimiter”中设置。
项目单独设置,步骤:右击项目名 -> Properties -> Resource,在“Text file encoding”和“New text file line delimiter”中设置。


2、设置编辑器的Tab键
步骤:Window -> Preferences -> General -> Text Editors,勾选“Insert spaces for tabs”选项,并且在“Displayed tab width”后的输入框中输入空格数,这些空格将代表一个Tab键。

3、自动去除结尾空格
步骤:Window -> Preferences -> PHP -> Save Actions,勾选“Remove trailing whitespace”,另外,还可以再选择“All lines”或“Ignors empty lines”。
项目单独设置,步骤:右击项目名 -> Properties -> Save Actions,勾选“Remove trailing whitespace”。

4、代码格式整理
当使用快捷键(Ctrl+Shift+F)整理代码格式时,会自动将缩进的空格转换成Tab。
注:显示空白字符,步骤:Window -> Preferences -> General -> Text Editors,勾选Show Whitespace characters选项。


5、模板设置(文件注释、函数注释、代码块等)

步骤:Window -> PHP -> Editor -> Templates,这里可以设置(增、删、改、导入等)管理你的模板。

 

 

新建文件注释、函数注释、代码块等模板的实力

新建模板,分别输入Name、Description、Pattern

a)文件注释
Name: 3cfile
Description: df3c文件注释模板
Pattern:
/**
 * DF3C xx文件
 * ==============================================
 * 版权所有 2010-2011 http://www.df3c.com
 * ----------------------------------------------
 * 这不是一个自由软件,未经授权不许任何使用和传播。
 * ==============================================
 * @date: ${date}
 * @author: ${user}
 * @version:
*/

b)方法注释
Name: 3cmethod
Description: df3c方法注释模板
Pattern:
/**
 * 函数用途描述
 * @date: ${date}
 * @author: ${user}
 * @return:
*/

c)if格式
Name: 3cif
Description: df3c if格式模板
Pattern:
if (${condition}) {
    ${cursor};
}

进入PHP文件中,输入3cfile、3cmethod或3cif等,回车就可以调出模板内容,以便开发中编码的规范。

注: 有时你可能会觉得提示响应不够迅速,你可以设置下缩短自动提示的延迟时间。
步骤:在window -> Preferences -> PHP -> Editor -> Content Assist中,勾选“Enable auto activation”,并设置“Auto activation delay(in msecs)”的值。单位为毫秒,默认设置一般为500,建议设置为200。

 

 

你可能感兴趣的:(Zend)