Revisit PSR-2 decision

I would like to raise the discussion started by Michael Gerdemann on Slack here:
https://neos-project.slack.com/archives/C04HF7TT9/p1562493548012000

The starting tweet came from Fabien Potencier asking that the discussion about space-vs-tabs indentation be raised again in the PHP community https://twitter.com/fabpot/status/1147776616325627904 which in turn referenced a tweet that was linking a discussion on reddit https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/

The major point of argument is:
People with visual impairments need to adjust indentation levels in order to be able to properly read and work with the code.
With spaces, this is cumbersome, because they need to convert the indentation, do their work, and convert back. With tabs this is not an issue, because the tab can be configured to whatever preference or need in the IDE, without touching the code.

Now, there’s of course also a drawback to using tabs (otherwise the discussion wouldn’t exist since ages):

  • inconsistent display across different systems (e.g. console output, web view)
  • TAB is virtually impossible to input on a web browser or mobile device
  • some files depend on space indentation (YAML)

Those issues are more annoyances and can be worked around - configure the console to output tabs to your liking and TAB input can be solved with browser extensions.

The major point for TAB character I think is, that it is a special character that denotes the intention for “indent” and hence allows automatic adjustment in the tooling to different needs. Try that with converting 4 spaces to different widths without changing parts that are not supposed to be indented, but spaced (! those are different things).

So there are following options now for the Neos project on how to work with this new discussion:

  • change our own code guidelines to be “PSR-2 but with tabs”, so effectively “not PSR-2”
  • push the FIG for a new PSR that is basically “PSR-2 but with tabs” and change to that
  • both from above
  • stick with the current PSR-2 and spaces as indentation

My current thought is that it would be best if there were a new PSR that was all the same as the old, but just with TABs. Then every project can just state if they follow PSR-2 or PSR-x. IMO it’s not a solution to just sit and wait for that new PSR and then adopt that, because that can take years, if it happens at all.

I’m in for Tabs :slight_smile:

Well, yeah, I never liked the switch to spaces (see original thread), but modern IDEs allowed me to simply continue pressing tab.

I’m not sure though if making the switch back to tabs is worth the effort. But if someone is really into it and pulls it through, I’m certainly supportive.

Yep, same here…

Yep, I would also be in favour of tabs. But then I am the defender of the PSRs :smiley:

I will see if I feel like it at some point and do a switchover, although that will be a merge nightmare because new lines will always end up with spaces in higher branches then… And all the proxy code stuff. Oh well…

1 Like

While i like tabs aswell, i would do what other (bigger) projects do in this regard as this means significant manpower and hassle with upmerges etc.

So for now “push the FIG for a new PSR that is basically “PSR-2 but with tabs” and change to that” would be my favorite option.

1 Like

Hey,

Is this a serious discussion going on? :slight_smile: I do not see any reason to change this at any point now.

All the best,
Sebastian

Not really, I think we’re all on the same page. I just stumbled upon this video and wanted to share it :slight_smile:

1 Like

In case some of you missed it: PSR-2 is deprecated, and followed up by https://www.php-fig.org/psr/psr-12/

It does NOT change the PSR stance on indenting though :frowning: