Does anyone else find it annoying that Sage uses 2 spaces instead of 4? PSR standards clearly define the indentation to be 4 spaces (not tabbed which thankfully Sage follows), so why use 2? As a follower of PSR I find I have to convert all files from 2 to 4 spaces, which is inconvenient. This isn’t just a personal preference here, it’s community standards that Sage should be following. What do you guys think?
We’ve already made this change in Sage 9 and will be using 4 spaces moving forward with all of our projects.
HTML, CSS, and JS files will continue to use 2 spaces.
Sage is like 500 lines of PHP total. 300 of which you probably aren’t going to even open during the course of a project. It’s not really a huge undertaking to make it conform to whatever indention you want.
I don’t want to go through 500 lines and tab each one. You’re crazy
Use a script laddo
20
This update is also about to land in Bedrock:
Was about to post this same thing, and saw it was mentioned that it’d be switching to 4 spaces in Sage 9. Why did this not happen?
Using sage for the first time, currently going through and fixing t he default files to be 4 spaces lol.
Sage 9 does use 4 spaces for PHP (see app/
, config/
, resources/functions.php
), however, for Blade Templates it still uses 2 spaces which makes sense given what Ben said:
Blade templates would count as HTML. All of this is reflected in Sage’s .editorconfig
.
Ah okay, thanks for the answer. We’ll just use a script to convert all the 2 space files to 4 when starting new projects then.