doulong6761 2019-05-03 15:23
浏览 81

在PHP数组中格式化=>运算符

Looking for a VSCode extension or setting to apply formatting rules to the => operator in an array to assist in readability.

In the examples below, I updated an existing array and the => alignment is disrupted.

Is it possible to highlight the changed section and apply a formatting rule to the PHP?

Original array with => operator lined up neatly

$this->settings           = [
    'title'           => [
        'type'  => 'text',
        'std'   => '',
        'label' => 'Title:',
    ],
    'description'     => [
        'type'  => 'text',
        'std'   => '',
        'label' => 'Description',
    ],
    'number_of_posts' => [
        'type'  => 'number',
        'std'   => '3',
        'label' => 'Number of posts to display',
        'min'   => '1',
        'max'   => '20',
        'step'  => 1,
    ],
]

Udpated array with => operator out of alignment

$this->settings           = [
    'title'           => [
        'type'  => 'text',
        'default_value'   => '',
        'label' => 'Title:',
    ],
    'description'     => [
        'type'  => 'text',
        'default_value'   => '',
        'label' => 'Description',
    ],
    'number_of_posts' => [
        'type'  => 'number',
        'default_value'   => '3',
        'label' => 'Number of posts to display',
        'min'   => '1',
        'max'   => '20',
        'step'  => 1,
    ],
];

Array - indiviudally moved => operators into alignment

$this->settings           = [
    'title'           => [
        'type'          => 'text',
        'default_value' => '',
        'label'         => 'Title:',
    ],
    'description'     => [
        'type'          => 'text',
        'default_value' => '',
        'label'         => 'Description',
    ],
    'number_of_posts' => [
        'type'          => 'number',
        'default_value' => '3',
        'label'         => 'Number of posts to display',
        'min'           => '1',
        'max'           => '20',
        'step'          => 1,
    ],
];
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题