[REQ][PHP] Follow PSR-12 Coding Style Guide
See original GitHub issueIs your feature request related to a problem? Please describe.
From PSR-2 Coding Style Guide:
Deprecated - As of 2019-08-10 PSR-2 has been marked as deprecated. PSR-12 is now recommended as an alternative.
Describe the solution you’d like
-
Change PHP style guide link at Guidelines For Contributing to PSR-12 Extended Style Guide - All PHP generators which follow
PSR-2
coding guide should follow new rules fromPSR-12
. ToolPHP_CodeSniffer
already supportsPSR-12
ruleset from3.5.0
version. If your generator containsPHP_CodeSniffer
package then migrate to^3.5
version and use ruleset likephpcs --standard=PSR12 /path/to/code
(or adjustphpcs.xml
in your template). - Adjust all other PHP linters and prettifiers to follow
PSR-12
.
Additional context
Question to PHP members of technical committee:
As soon as required PHP version is 7.1 or higher should we add type annotations to PHP templates? I mean int $bar = 0;
cc @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), @ackintosh (2017/09), @renepardon (2018/12)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
PSR-12: Extended Coding Style - PHP-FIG
This specification extends, expands and replaces PSR-2, the coding style guide and requires adherence to PSR-1, the basic coding standard.
Read more >PSR-12 Style Guide - xoops-modules-cookbook
This document references other standards, guidelines and style guides. The following document hierarchy outlines the order of precedence.
Read more >A Quick Guide to PSR Coding Style Recommendations
General PHP Rules. Code style must follow PSR-1, PSR-2 and PSR-12. Generally speaking, everything string-like that's not public-facing ...
Read more >PSR-2 and PSR-12: Why We Need Standards and How to ...
What is Code Style/Standard and Why PSR-2/PSR-12? ... In PHP language, for a long time, the most popular standard has been PSR-2.
Read more >Coding Style Guide - laminas-coding-standard - Laminas Docs
There MAY NOT be any content before the opening tag. Inline HTML in PHP code SHOULD be avoided. All code MUST be executable...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, I noticed it earlier. But we need to stick to some coding style in PHP anyway(originally it was PSR-2 in this repo, now it’s PSR-12). It’s easier to contribute when you can just follow some standard and it’s easier to review changes. Beside we can turn off controversial rules in PHP CS Fixer anytime.
As soon as you’re the major contributor and author of generators mentioned above then I don’t insist. Will add CS Fixer to rest of PHP generators still.
In my opinion - nope. This package is needed neither to run generated code nor to adjust generated code for existing project integration. So there is no need to bloat generated
composer.json
with it.And by the way PSR-2 and PSR-12 are rather controversial “standards” - otherwise things like PSR-2-R would not appear.