加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 使用方法参数indention的Netbeans自动格式问题

发布时间:2020-12-13 17:33:59 所属栏目:PHP教程 来源:网络整理
导读:我想知道我是否错过(或误用)配置设置. 在这段代码上使用autoformat: ?phpclass foo { public function test() { $x = $this-foobar( 1,2 ); }} 生产: ?phpclass foo { public function test() { $x = $this-foobar( 1,2 ); }} 我希望netbeans停止这样做,因
我想知道我是否错过(或误用)配置设置.

在这段代码上使用autoformat:

<?php
class foo {

    public function test() {
        $x = $this->foobar(
            1,2
        );
    }

}

生产:

<?php

class foo {

    public function test() {
        $x = $this->foobar(
                1,2
        );
    }

}

我希望netbeans停止这样做,因为除此之外,自动格式化工作得很好.

只有在函数调用的行上有赋值时才会发生.

解决方法

您将获得2个连续缩进,一个用于赋值,另一个用于参数列表.
如果你在作业和$this-> foobar之间插入一个间隔,那就更明显了:

class foo {
    public function test() {
        $x =
            $this->foobar(
                1,2
        );
    }
}

所以,这就是它的“原因”.不幸的是,NB暴露了很少的格式化php的控件.似乎没有办法改变这种行为.

我建议opening a bug report并关注Netbeans PHP blog

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读