IntelliJ

时间:2016-09-02 03:32:48

标签: intellij-idea phpstorm

我有这个:

    $accountNr = $csvData[2][1];
$firstname = $csvData[3][1];
$lastname = $csvData[4][1];
$telephone1 = $csvData[5][1];
$telephone2 = $csvData[6][1];
$telephone3 = $csvData[7][1];
$telephone4 = $csvData[8][1];
$email1 = $csvData[9][1];
$email2 = $csvData[10][1];
$email3 = $csvData[11][1];
$email4 = $csvData[12][1];
$address1 = $csvData[13][1];
$address2 = $csvData[14][1];
$zip = $csvData[15][1];
$state = $csvData[16][1];

我想要这个:

$accountNr  = $csvData[2][1];
$firstname  = $csvData[3][1];
$lastname   = $csvData[4][1];
$telephone1 = $csvData[5][1];
$telephone2 = $csvData[6][1];
$telephone3 = $csvData[7][1];
$telephone4 = $csvData[8][1];
$email1     = $csvData[9][1];
$email2     = $csvData[10][1];
$email3     = $csvData[11][1];
$email4     = $csvData[12][1];
$address1   = $csvData[13][1];
$address2   = $csvData[14][1];
$zip        = $csvData[15][1];
$state      = $csvData[16][1];

有一个名为" String Manipulation"的IntelliJ插件。就是这样。

但是:当我选择整个文件并使用PhpStorm的格式对其进行格式化时,一切都会再次改变。

有不同的清洁方法吗?

1 个答案:

答案 0 :(得分:3)

  1. Settings/Preferences
  2. Editor | Code Style | PHP
  3. Wrapping and Braces --> Assignment statement
  4. 激活Align consecutive assignments选项
  5. enter image description here