Qobrix v38.0.0 is by far the largest release we have ever produced – by the number of developers, time spent, lines of code changed, bugs fixed, or any other metric! In this version we have upgrade the whole codebase to support CakePHP 3.6, which now prepares us for an easy upgrade to the upcoming CakePHP 4. We have also taken this opportunity to significantly improve our support for PHP 7 features (especially type-hinting for parameters and return values), fix most of the issue identified by the PHPStan static code analyser running with the strictest of checks (level 7 + strict rules), refactor old code, significantly decrease the CRAP index (Change Risk Anti-Pattern), increase unit and integration test coverage, and more.
CakePHP 3.6 Support
Any software development framework has a difficult balance to manage – the need to push forward and improve, while maintaining stability for extended periods of time. Each framework solves this balance in a different way. Some choose to push for new features, ignoring the long-term stability and backward compatibility. Others prefer to stay on the safe side, ignoring or avoiding new development. CakePHP team found, what we think, a perfect compromise.
Instead of introducing harsh, backward compatibility breaking changes with every major release (like it was between CakePHP 1 and 2, and CakePHP 2 and 3), they have decided to make it more of a gradual process. CakePHP 4, being a major release, will break backward compatibility. But instead of forcing all users to upgrade their applications in one swooping change, they decided to gradually deprecate old code and replace it with the new code. All deprecated code has been marked so for a while now. But starting with CakePHP 3.6, the framework will throw errors when the deprecated code is accessed. These errors can be easily disabled in production environments, where the old code will still run. But enabling these errors in development and test environments allows developers to replace old code with the new at their own pace.
Fixing all deprecated errors in a CakePHP 3.6 application means that the upgrade to the major release of CakePHP 4 won’t break anything any more. And that’s exactly what we have done with Qobrix v38.0.0 – upgraded to CakePHP 3.6 and fixed (nearly) all deprecated errors. There are still a few small bits here and there that we’ll take care of in the upcoming minor releases, but overall, most of the changes are done. The remaining bits are mostly due to our dependency on some third-party plugins and libraries, for which we are waiting the releases of the new versions.
One of the benefits of upgrading to PHP 7 was the availability of better quality control tools. One of such tools is PHPStan – a static code analyse. This tool helps to find real and potential problems by examining every single line of the source code. We have integrated PHPStan to our tool chain, both for the main codebase of Qobrix and to each of the CakePHP plugins that we develop. We have configured PHPStan to run with the strictest set of rules and report everything that can even remotely introduce bugs or unexpected behavior. This caused PHPStan to identify several thousands of potential issues across the board, and we have fixed pretty much all of them. We have also configured PHPStan to run on TravisCI continuous integration service, which will ensure that we won’t introduce any new issues in the future.
As a result of these fixes, our codebase has become a lot better. The documentation has improved a lot – both in coverage and accuracy. Edge cases, error handling, and other non-obvious situations are consistently taken care of everywhere now. In some cases, real bugs were identified and fixed. And in some cases, additional refactoring and code simplification has been applied, making the code a lot more readable, predictable, and maintainable.
Qobrix v38.0.0, even though being such a huge release, does not bring any visual changes, noticeable by the end-users. There are however a few improvements that Qobrix administrators might notice. Some of these are:
- Improvements to the cleanup of logs, in particular logs of Scheduled Jobs.
- Improved audit log, with “Created By” and “Modified By” fields being always populated.
- More consistent rendering of menus, button groups, and other UI elements related to user actions.
- Improved performance, due to simplified code, better caching and more efficient SQL queries.
- Initial support for search in the application logs (we’ll make it even better soon).