Open terax6669 opened 2 years ago
+1. With each passing day, it gets harder to find non-PSR-12 code. Netbeans is wonderful, but you cannot use it out of the box if you work in a team where people use multiple IDE's and PSR-12 is a must.
Hi guys! Is there any plan on implementing this? I dare to say that one cannot code modern PHP app with Netbeans without having PSR-12 support nowadays.
@erickcomp I think if we treat this ticket as an epic task and break it down into smaller chunks, the devs would be able to implement it step by step. I already listed some related issues.
If you notice any incompatibilities please make a separate issue on it and I'll add it to the issue description.
Issue #4611 is related to blank lines in class.
Just to reference up-to-date recommendation, PSR-12 was replaced by PER coding style. https://www.php-fig.org/per/coding-style/
Just adding my 2 cents to the discussion, implementing and maintaining native full compliance to PSR or its successors seems like quite a big task and that's not even the single coding standard in use. Various reasons, including those outside of our control, may lead to other standards being implemented by different projects.
Perhaps this task could be delegated to PHPCS. It is very fast and there is already a basic integration of it. NB could ship (or be able to download) rule sets for popular standards to use with projects that don't come with their own sets. It should be even possible to display CS errors inline, much like the PHP parser's. Going this way might prove a simpler alternative, while giving a freedom to choose specific standards to the users at the same time.
+1 To adding After Use Trait
It seems we have (most of) the options to adhere to the per coding-style. Noob question: Is it hard to make these configs the default when you install the IDE?
I'd say the settings are very obtuse, but some trial and error will allow you to set it up properly.
I see. But can we get very close to PER coding style, right? If so, could we get this settings out of the box on NB? I mean, when we install it for the first time, we got formatting options as close as possible to the PER coding style.
If you do, could you post a list of all the changes you have to make from the default config? Would make it easier to implement that.
As for whether that would be the default... I think it should, but I'm not making decisions. IDK how that works, maybe Junichi can weigh in.
I'm planning to take some time to create this config in the next few weeks. I'll let you guys know!
Description
Some things that I noticed, but I'm sure there are more:
Formatting rules in the Blank Lines category seem to be impossible to adhere to PSR. Example with traits - according to PSR traits should be the first thin inside a class. We haveImpemented in #6467.Before Use Trait
but notAfter
. Therefore I must setBefore Function
to 1 to separate traits and functions. Now even if I setAfter Class Header
to 0 I will get a blank line when I have a method inside a class but no trait (which would be the most common scenario).class Foo { use Bar;
}
// vs
class Foo { // this blank line shouldn't be here! public function foobar() { } }