Convert codebase to PSR-2 coding standard

Some of the conventions were already introduced to the codebase.

I thought I would suggest a complete rewrite to PSR-2. by just implementing it.

---

I've used `phpcs --standard=psr2 src/ tests/` command to verify the results.
The remaining warnings are about some long lines of HEREDOC, but I couldn't fix them unless I substantially change the code.

---

I've grouped my changes into commits corresponding to the various rules.