Close search

Hoa has adopted PSR-1 and PSR-2

Written the .

Since its first line of code, Hoa has always respected and promoted standards from several consortiums such as: W3C, IETF, ISO, POSIX & co. Why is it important? Because softwares are beautiful when they work together. We are not able to do everything at best and a lot of people are doing things better than us. We cannot imprison our users inside our own code. To let every user free, it is really important to scrupulously respect every standards. Today, Hoa is compatible with more than 50 standards.

Of course, when standards are not correct or too much limited, it is our duty to ameliorate them by discussing, drafting, gathering suitable people around a (virtual) table and regarding forward together. In several ways, Hoa is implied inside consortiums (W3C or IETF to name a few).

The PHP-FIG is more a group than a consortium but the main idea is essential to PHP. This is an interoperability group between major PHP projects (including frameworks, libraries, softwares etc.). It means: Defining the way code is loaded and organized, designing interfaces for specific entities etc. PSR-0 and PSR-4 are 2 standards about “autoloading” (how code can be loaded automatically without dealing with paths and filenames). Hoa was compliant with PSR-0 and PSR-4 before they were written and even voted. PSR-1 and PSR-2 is about coding style.

Whilst we thought it was not useful for Hoa to adopt this standard, many troll battles debates happened on IRC and Twitter. Several users were arguing it will improve contributions. This was the main argument in favor of PSR-1 and PSR-2. And because we always listen to our users, we finally started to move our code base from previous coding style to PSR-1 and PSR-2.

Because PSR-1 and PSR-2 are not exhaustives, we added more rules. We also developed hoa devtools:cs, which puts everything together ready for php-cs-fixer (from Friends of PHP). Thanks to these tools, it took 20 days to update almost 120K LOC.

So, now, Hoa is PSR-1 and PSR-2 compatible. Happy hacking!