Codeigniter4: CodeIgniter 4 should use PSR-2

Created on 22 Mar 2018  路  4Comments  路  Source: codeigniter4/CodeIgniter4

Hello, I believe that CodeIgniter 4 should adopt accepted coding style of PSR-2. I can help out with code fixes if needed or better yet, PHP CS Fixer tool can do that fairly easily. Having so many coding styles around the PHP ecosystem, is ok of course, but in reality also very painful... And many people follow these coding styles in their own coding later on.

Thank you for considering thinking about this one day in the future maybe.

All 4 comments

This has been discussed and argued extensively on the forum, which is the proper place for this suggestion.
The bottom line is no, we do not agree with all of PSR-2, although there are commonalities ... https://bcit-ci.github.io/CodeIgniter4/contributing/guidelines.html#php-style

And, to be fair - the coding styles only apply to the framework code itself, anyone can use whatever they want in their own project. While it's true that can cause a small amount of complexity for anyone helping out with multiple open source projects, most decent IDE's can support a different set of styles per project, I believe.

Additionaly - we do have a set of PHP CS fixer rules created, we just haven't started using them exhaustively, or put them in place to automatically run and clean code anywhere just yet.

Ok, I understand... Then it would be good to set some configuration file example that people can add to their PHPStorm or other IDEs configuration or use PHP CS Fixer with it when setting up the projects.

Framework's coding style somehow also defines further project's coding style if you look at it.

Framework's coding style somehow also defines further project's coding style if you look at it.

Agreed. It does. And if you'll compare ours with PSR2, then you'll find they share a LOT of commonalities. I've shared my PHPStorm config on the forums previously, I believe. And the PHP CS is over here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TatwiraT picture TatwiraT  路  6Comments

zenabus picture zenabus  路  4Comments

crustamet picture crustamet  路  4Comments

lonnieezell picture lonnieezell  路  7Comments

Iamscalla picture Iamscalla  路  4Comments