Aptana PHP格式化程序 - 使用自定义格式化规则 [英] Aptana PHP Formatter - use custom formatting rules

查看:162
本文介绍了Aptana PHP格式化程序 - 使用自定义格式化规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP文档中使用了Apatana的格式化功能,除了数组转换之外,它运行良好:

  $ data = array(
'email'=> $ params ['email'],
'username'=> $ params ['username'],
);

变成这个:

  $ data = array('email'=> $ params ['email'],'username'=> $ params ['username']); 

有没有办法避免这种情况并设置自定义格式规则?
是的。

解决方案

有一种方法。

转到Studio的首选项并找到'Formatter'项目。如果您使用的是默认格式化器配置文件,请通过单击+图标来创建一个新的格式器配置文件。



单击以编辑PHP格式设置(双击PHP '项目,或单击它,然后单击'编辑'按钮)。

在新行选项卡下,选中插入新行创造元素。确定对话框。确保刚刚创建的配置文件是格式化程序首选项页面中选定的配置文件,并对代码进行格式化。

干杯


I'm using Apatana's formatting features in PHP documents, it works well except with arrays where it transform this:

$data = array(
    'email' => $params['email'],
    'username' => $params['username'],
);

into this:

$data = array('email' => $params['email'], 'username' => $params['username']);

is there a way to avoid this and set custom formatting rules?

解决方案

Yes. There is a way.

Go to the Studio's preferences and locate the 'Formatter' item. If you are using the default formatter profile, create a new one by clicking the '+' icon.

Click to edit the PHP formatting setting (double-click the 'PHP' item, or click it and than click the 'Edit' button).

Under the 'New Lines' tab, check the option to 'Insert new line between array-creation elements'. OK the dialogs. Make sure that the profile you just created is the selected one in the formatter preferences page, and format your code.

Cheers

这篇关于Aptana PHP格式化程序 - 使用自定义格式化规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆