Skip to content

Indentation Style (Code style) Magento 2

Hey, I wanna check if there is some documentation about the code style for magento, specially regarding the best practices Indentation style for magento.

I will give 2 examples, and I wanna also know the opion of the community about it.

  1. Using PSR1/PS2 from phpstorm code style. (I believe it it’s similar to the Magento 2)
$variable1 = "test";
$variableVariable2 = "test";
$variableVariable3 = "test";
$variableVariableVariable4 = "test";
  1. Some custom code style that I found. (I don’t think it’s common see it on Magento 2 projects)
$variable1                 = "test";
$variableVariable2         = "test";
$variableVariable3         = "test";
$variableVariableVariable4 = "test";

I looked the documentation and I didn’t find anything related to it. But based on what I saw in the project, it was buit using the Option 1. I just wanna make sure that is the option 1 the correct one, or if there is some sense about it, some documentation or article, anything is welcome.

Thanks.