colburton
colburton

Reputation: 4715

PhpStorm 7 align consecutive combined operators and assignments

Code style of php in PhpStorm v7 can align consecutive assignments. But is there a way to make it align the combined operators as well?

Example:

$a = 1;
$a *= 2;
$foo = 2;

Should become:

$a   = 1;
$a  *= 2;
$foo = 2;

Upvotes: 3

Views: 1009

Answers (2)

wIRELESS
wIRELESS

Reputation: 196

Almost all PHP-coding standards such as Zend and PSR (http://framework.zend.com/manual/1.10/en/coding-standard.html) disfavor such alignment, because when you working in team every other member have to do this useless beautifying, even if they don't have it preset with PHPStorm.

Upvotes: 0

user3191393
user3191393

Reputation: 11

There is a plugin you can install via the browse repositories button on the plugins part of the settings window called Front End Alignment.

Once it's installed you will have a command called Regex Align under the Code drop down. I don't know much about it except that you can highlight the code you want to align and execute this command. It will bring up a window and I just entered an equals sign and hit OK and it will align your code based on the farthest equals sign.

I'm new to PHPStorm and I just found this plugin so I'm sure it does more but that should at least get you started.

Hope it helps.

Upvotes: 1

Related Questions