Exakat 1.9.3 reviews the maximum of your code to PHP 7.4. The Compatibility PHP 7.4 ruleset now has 20 rules covering the next PHP version. Exakat also checks situations that may generate over 60 different types of PHP messages : remove them and free your logs!
Live, laugh, and Exakat 1.9.3 Review.
PHP migration review to PHP 7.2
OK, you didn’t come here to hear about PHP 7.2. Yet, those versions are still widely used, as mentioned in Packagist’s stats : about 25% of all online applications are using PHP 7.1, and 7 % uses PHP 5.6.
Exakat has been doing migration reviews since PHP 5.4, and those are also available. Check the one you need in the List of Rulesets.
PHP migration review to PHP 7.4
The real focus of that week was on migration to PHP 7.4. The list of checks rose to 20, with a selection of new verification:
- opensslrandompseudo_byte() second argument
- Deprecated directives
- Deprecated constant
We also upgraded the Suggestion report with the new features from PHP 7.4, to help you modernize your codes.
Error_reporting E_ALL as default for PHP 8
Nikita Popov announced that PHP will use E_ALL as default value for error_reporting in PHP 8. This means that the default installation will then report every error that PHP detect while executing an application.
Exakat currently includes analysis that report possible error emission for 64 PHP messages. This means that you can review your code to add checks and verification even before running the code, and logging the error message. This is both a gain of speed and a significant boost in code quality.
The whole list of errors is available in the documentation annex : PHP Error messages with the related analysis.
Feel free to report missing error messages to us, so we can see how they can be detected and added.
The Weekly Audits: 2019, Week #36
Exakat includes a ‘weekly’ report: this report is built with a selection of five analyses. This means a short audit report, with few issues to review. This is not a lot to read them, and review them in your code. Everyone in the PHP community can focus on one of the classic coding problems and fix it. Talk about the weekly audit around you: you’ll find programmers facing the same challenges.
To obtain the ‘weekly’ audit, run an audit, and request the ‘Weekly’ report.
# Init the project (skip when it is already done)
php exakat.phar init -p <yourproject> -R https://github.com/Seldaek/monolog.git -git
# Run the project (skip when it is already done)
php exakat.phar project -p <yourproject>
# Export the weekly project (every Monday)
php exakat.phar report -p <yourproject> -format Weekly
# Open projects/<yourproject>/weekly/index.html in your browser
Every week, you can find here 5 new analysis to review in your code. In fact, when your code is clean, you can also take a quick look at the upcoming analysis.
Weekly recommendations for PHP code review : 2019, week 2019-36
- Modernize Empty With Expression : empty() accept expressions since PHP 5.
- Access Protected Structures : It is not allowed to access protected properties or methods from outside the class or its relatives.
- No Hardcoded Hash : Hash should never be hardcoded.
- Never Used Parameter : When a parameter is never used at calltime, it may be turned into a local variable.
- Should Chain Exception : Chain exception to provide more context.
Happy PHP Code Reviews
All the 374 analyzers are presented in the docs, including the narcissic Identical On Both Sides: Operands should be different when comparing or making a logical combination.
This is an unusual bug, with more than 19% of chance to appear.
You can check all of the Exakat reports at the gallery: exakat gallery.
Download Exakat on exakat.io, install it with Docker, upgrade it with ‘exakat.phar upgrade -u’ and like us on github.