In order to improve the quality of the php-client we introduce in the past:
PHP Coding Standards Fixer: A tool to automatically fix PHP Coding Standards issues. Thanks to this tool, all the Pull request, and changes in the code base are aligned with the PSR12 standard;
PestPHP: for automating tests before to merge the Pull Requests.
PHPStan: for performing the Static code analysis
Today I want to introduce another powerful tool that helps in the refactoring process and helps the developer that wants to create a Pull Request to have a first-level Automated Code Review (checking dead code, using the functionalities provided by the supported PHP versions, early return, type declaration and many more).
The PHP package is rector/rector and as the first release the configuration is quite basic:
LevelSetList::UP_TO_PHP_73,
SetList::DEAD_CODE,
Once we introduced and merged this, we can progressivaly add new rules (with specific and dedicated Pull Requests for achieving for example this configuration:
This is also very useful for when we will decide to drop the support for PHP 7.3.
The tool is useful not just for being sure that the code works after dropping an old release, but it helps us to upgrade the code to use all the new features of the new versions supported (refactoring old code just beacuse we needed them because of the PHP 7.3 supports).
In order to improve the quality of the php-client we introduce in the past:
Today I want to introduce another powerful tool that helps in the refactoring process and helps the developer that wants to create a Pull Request to have a first-level Automated Code Review (checking dead code, using the functionalities provided by the supported PHP versions, early return, type declaration and many more).
The PHP package is
rector/rector
and as the first release the configuration is quite basic:Once we introduced and merged this, we can progressivaly add new rules (with specific and dedicated Pull Requests for achieving for example this configuration:
This is also very useful for when we will decide to drop the support for PHP 7.3. The tool is useful not just for being sure that the code works after dropping an old release, but it helps us to upgrade the code to use all the new features of the new versions supported (refactoring old code just beacuse we needed them because of the PHP 7.3 supports).
For checking:
For applying refactor: