Skip to content

Instantly share code, notes, and snippets.

@pgrimaud
Last active January 24, 2019 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pgrimaud/ff70732ab0344622a60c77236d737412 to your computer and use it in GitHub Desktop.
Save pgrimaud/ff70732ab0344622a60c77236d737412 to your computer and use it in GitHub Desktop.
Autoformat assignments and equals on PHP Storm

Autoformat code : Cmd + Alt + L

For equals :

Settings -> Editor -> Code Style -> PHP -> Wrapping and Braces -> Align consecutive assignments

This will replace

$toto = 'test';
$longtoto = 'test';

By :

$toto     = 'test';
$longtoto = 'test';

For assignments :

Settings -> Editor -> Code Style -> PHP -> Other -> Align key-value pairs

This will replace

$array = [
  'toto' => 'test',
  'longtoto' => 'test'
];

By :

$array = [
  'toto'     => 'test',
  'longtoto' => 'test'
];
@matyo91
Copy link

matyo91 commented Mar 6, 2017

@pederan
Copy link

pederan commented Dec 21, 2018

What about if I want the equal signs to align even though I have a .= like this:

$a  = 2;
$b .= 1;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment