PhpStorm and PSR-12, how can I add it as default coding style?
You cannot add custom entry there as a user unless you write a plugin that will do that.
WI-48160 / WI-45330 -- watch these tickets (star/vote/comment) to get notified on any progress.
The implementation of these tickets will bring a new entry in that list.
UPDATE 2019-10-08: PSR-12 Code Style preset has been added for 2019.3 version (currently in EAP stage).
Related videos on Youtube
Andrei
placeholder="BY DAY: Alt-Rock Ninja Cowgirl at Veridian Dynamics.BY NIGHT: I write code and code rights for penalcoders.example.org, an awesome non-profit that will totally take your money at that link. My kids are cuter than yours.FOR FUN: C+ Jokes, Segway Roller Derby, NYT Sat. Crosswords (in Sharpie!), Ostrich Grooming."If you see scary things, look for the helpers-you'll always see people helping."-Fred Rogers" Guys, how do I remove the placeholder?!
Updated on September 15, 2022Comments
-
Andrei over 1 year
PSR-12 is an extension of PSR-2, and therefore also an extension of PSR-1. The basis of PSR-12 is PSR-2 and therefore a list of differences is provided below to assist with migration but it should be considered as an independent specification.
From the php-fig site. Long story short, while not mandatory, it covers more code cases than PSR-2.
I'd like to use it in PhpStorm. Unfortunately, by default, storm doesn't offer this option. At predefined styles you have a fairly comprehensive list, but not comprehensive enough.
Of course, I can always define the style myself doing it by hand, but that doesn't strike me as a good idea. Mostly because I WILL miss something and if there are any updates to the PSR I can't easily update it. Not to mention I can't share it properly with my team. Except maybe exporting my .idea folder.
I googled around for a plugin or something of that sort but came up empty handed.
-
Andrei over 4 yearsI did actually vote on it. Looking forward for it to get implemented. But as phpstorm updates go, it can take a while. In the meantime I want a workaround of sorts. Given that there is one.
-
LazyOne over 4 yearsManually set the available formatting options then. But considering that some options are simply not yet implemented in current IDE version (see linked tickets in aforementioned WI-45330 ticket), you would not be able to set up it all.
-
LazyOne over 4 years@Andrei Updated answer with correct ticket number (which is about actually creating such predefined Code Style). As you can see in WI-45330 there are quite a few related tickets that needs implementing that would make it possible to format the code to adhere PSR-12
-
Aiphee over 4 yearsIt is present now in PHPStorm 2019.3 blog.jetbrains.com/phpstorm/2019/08/php-annotated-august-2019