Version 0.10.9 is here : time for the weekly exakat review . This week, we reduced the memory footprint in the gremlin server with a better check on the relations between elements in the code graph. This gives us less data to import, and less branches to analyze. That’s a gain in speed. We took time to update the Zend Framework support, the PHP 7.1.4 and 7.0.18 support; we recommend avoiding using the global namespace, and federating regex whenever they are twice or more in the code. Read to learn more!

Support for PHP 7.0.18 and 7.1.4

The PHP group released 2 new PHP versions, on Thursday, April 13th 2017. As usual, it provides several bug fixes that may impact your code. Who has time to review his code for minor bug fixes like that ? Exakat has your back. Each of the fixed or reverted bugs are reviewed, and they are linked to specific issues in the code.


Bug reports are available in the ‘Ambassador’ report of exakat, in the ‘Audit log’ section. Any PHP update that is traced back in your code is reported here. If a feature is updated but not used, this is not reported there, for clarity.

New components and reports for Zend Framework 3

Exakat added 8 new components Zend Framework 3 analysis, totaling 42 supported components. The next are scheduled for the upcoming weeks.
There is now a new report that mentions any unused component that is requested in the composer.json. Sometimes, those components were useful, but are later removed from the code. Loading too many component is not useful, and now, there is a list that tells you exactly which is missing.

Avoid global classes

This analyzer reports when classes, traits, interfaces or functions are declared in the global namespace. The global namespace is the realm on PHP, and it is recommended to place any definition in a specific namespace. This makes publishing the code easier, as it may be pushed to packagist with less conflicts. It also means less conflict when importing packages from that same source.

Common regex should be made into constants

A small variation of the magic number syndrome : when identical regex are found across the code, they are reported so as to be made into a constant (or centralized in another way). Regex are usually little programs by themselves, and changing them in one place often leads to changing them in a lot of places. So, writing them in one location is a good step.

It is also a violation of the DRY principle: don’t repeat yourself. I usually consider repeating a regex a code smell, and search of a good place to move it. Either as a filter of data classes, or a parser function. On average, 45% of code bases could benefit from this analysis.

Happy PHP code reviews

Exakat 0.10.9 covers PHP just as it is evolving, fixing bugs every two weeks. We have already started working on the PHP 7.2 support.
All the 300+ analyzers are presented in the docs, including the classic ‘Unchecked resources‘. Download Exakat on, upgrade it with ‘exakat.phar upgrade -u’ and like us on github:

Tweet about this on TwitterShare on RedditShare on LinkedInEmail this to someone