New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSR12 standard #750

Open
juliangut opened this Issue Oct 26, 2015 · 17 comments

Comments

7 participants
@juliangut
Copy link

juliangut commented Oct 26, 2015

I know this might be a bit too early as the Extended Coding Style Guide is still on Draft phase but IMO having early access to what could be the standard in the end could be helpful

What anyone else think about this?

@gsherwood

This comment has been minimized.

Copy link
Member

gsherwood commented Oct 27, 2015

I've been following it, but I haven't got time to do anything about it.

@juliangut

This comment has been minimized.

Copy link

juliangut commented Oct 27, 2015

There are a few points that will hardly change in the future and can most certainly be added as sniffs

The PHP reserved words int, true, object, float, false, mixed, bool, null, numeric, string and resource MUST be in lower case

All files MUST declare strict types.

Anonymous Classes MUST follow the same guidelines and principles as closures in the above section.
The opening bracket MAY be on the same line as the class keyword so long as the list of implements interfaces does not wrap. If the list of interfaces wraps, the bracket MUST be placed on the line immediately following the last interface.

Do you think is a good idea to create a PSR12 standard before it is established (starting with this points) and then go updating it, or wait until it is fully finished?

@gsherwood

This comment has been minimized.

Copy link
Member

gsherwood commented Oct 27, 2015

Do you think is a good idea to create a PSR12 standard before it is established (starting with this points) and then go updating it, or wait until it is fully finished?

Most of the hard work is done, but some custom sniffs will need to be written. It should be possible for anyone to create a ruleset.xml file that checks almost all of PSR12 today. But I don't think I'd include it in PHPCS until it's done.

@gsherwood

This comment has been minimized.

Copy link
Member

gsherwood commented Dec 8, 2015

Closing this. I'll re-evaluate if the PSR-12 fighting ever stops and something gets released.

@gsherwood gsherwood closed this Dec 8, 2015

@shandyDev

This comment has been minimized.

Copy link

shandyDev commented Nov 23, 2017

@stefan-endouble

This comment has been minimized.

Copy link

stefan-endouble commented Feb 20, 2018

Now is in review https://www.php-fig.org/psr/#review . Anyone have some tips am how to enforce those recommendations until something official is released?

@jrfnl

This comment has been minimized.

Copy link
Contributor

jrfnl commented Feb 20, 2018

@gsherwood Maybe its time to re-open this issue as I suspect more questions will start coming about this ?

@heiglandreas

This comment has been minimized.

Copy link

heiglandreas commented Mar 16, 2018

As far as i'Ve seen the FIG is looking for a second example implementation. Wouldn't a sniff for codesniffer be a good way to prove the concept?

Or would an external sniff be more of interest?

@jrfnl

This comment has been minimized.

Copy link
Contributor

jrfnl commented Mar 16, 2018

@heiglandreas What does an "example implementation" constitute though ?
I don't expect the PHPCS library to change its native codestyle to match PSR-12, so a sniff would be able to enforce - an arbitrary part of - PSR-12, but would not implement it in the code of the sniff itself.

@heiglandreas

This comment has been minimized.

Copy link

heiglandreas commented Mar 16, 2018

The current Example-Implementation is https://github.com/KorvinSzanto/PHP-CS-Fixer/tree/feature/psr12 and from what I can read from it it's an implementation that enforces PRS-12 on a codebase. The same thing phpbcs does.

So AFAIK it's not about implementing PSR-12 inside the sniff but to create a sniff that finds violations of PSR-12.

@jrfnl

This comment has been minimized.

Copy link
Contributor

jrfnl commented Mar 16, 2018

@heiglandreas I've got a few sniffs which cover parts of PSR-12 ready already and I seem to recall @timoschinkel has a large part of PSR-12 covered already as well.

@gsherwood Would now be a good time maybe to start with a PSR-12 ruleset and allow people who have sniffs covering parts of PSR-12 which aren't already covered by sniffs in PHPCS, to start pulling them ?

Want me to have a go at making an initial ruleset with what can be covered by existing sniffs ?

@gsherwood

This comment has been minimized.

Copy link
Member

gsherwood commented Mar 18, 2018

Would now be a good time maybe to start with a PSR-12 ruleset and allow people who have sniffs covering parts of PSR-12 which aren't already covered by sniffs in PHPCS, to start pulling them ?

Yes, I think so.

@gsherwood

This comment has been minimized.

Copy link
Member

gsherwood commented Mar 18, 2018

Want me to have a go at making an initial ruleset with what can be covered by existing sniffs ?

Sorry, missed this. If you'd like to :) If you could comment it like I did for PSR2, it helps me maintain it going forward and makes sure we've covered everything: https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/PSR2/ruleset.xml

@jrfnl

This comment has been minimized.

Copy link
Contributor

jrfnl commented Mar 18, 2018

@gsherwood I'll try and get to it later this week. In the mean time, you may want to reopen this issue ?

@gsherwood gsherwood reopened this Mar 18, 2018

gsherwood added a commit that referenced this issue Apr 19, 2018

@gsherwood

This comment has been minimized.

Copy link
Member

gsherwood commented Apr 19, 2018

I've committed a ruleset for PSR-12, which pulls in a few current sniffs and includes a couple of new ones. Lots of work to go though.

gsherwood added a commit that referenced this issue Apr 19, 2018

gsherwood added a commit that referenced this issue Apr 19, 2018

gsherwood added a commit that referenced this issue Apr 23, 2018

@gsherwood gsherwood added this to In Progress in PHPCS v3 Development May 25, 2018

@TomasVotruba

This comment has been minimized.

Copy link
Contributor

TomasVotruba commented Jun 8, 2018

@gsherwood

This comment has been minimized.

Copy link
Member

gsherwood commented Aug 29, 2018

For my own reference:

The current working group for PSR-12 is as follows:

Editor:
Korvin Szanto

Sponsor:
Chris Tankersley

Members:
Alexander Makarov
Michael Cullum
Robert Deutz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment