Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Added) Add Phan Static Analysis Tool (#24)
* Add new extensions and phan tests to composer.json The changes made to the composer.json file include the addition of new extensions for development purposes. Furthermore, a new test command for Phan, a static analysis tool, is added for identifying code issues or bugs. This enhances our project's code quality control measures. * Update Dockerfiles to simplify dependencies The Dockerfiles for the PHP versions 8.1, 8.2 and 8.3 have been updated to simplify the system dependencies. In addition, the installation of 'pdo', 'pdo_mysql', 'git', and 'libzip-dev' has been removed, 'zip' is now the only library installed through apt-get, and the 'pcntl' PHP extension has been added. These changes should make the Docker build process faster and less prone to errors caused by unnecessary dependencies. * Update dev dependencies in localTest.sh The dev dependencies in localTest.sh have been updated from phpstan/phpstan and phpstan/phpstan-phpunit to phan/phan. This change ensures that the development environment uses the most recent and suitable package for code analysis. * Update PHP extensions and enable Phan analysis in workflow The GitHub Actions workflow for PHP has been updated to include pcntl and xdebug extensions, replacing ast, mbstring, pdo, pdo_mysql, xml, and zip. Furthermore, previously commented Phan static analysis step has been uncommented, enabling it in the testing workflow. This will improve the PHP testing environment and code quality checks. * Update PHP extensions in Qodana code quality workflow The PHP extensions used in the .github/workflows/qodana_code_quality.yml file have been modified. The new set of extensions includes ast, pcntl, xdebug, and xhprof replacing the previous extensions - ast, mbstring, pdo, pdo_mysql, xml, xhprof, zip. * Add Phan config file A `config.php` file for Phan, the PHP static analyzer, has been added. This configuration file includes settings such as target PHP version, plugins to run, and directories to include in the analysis. This will help improve and ensure the quality of the codebase. * Update target PHP version in Phan config Changed the target PHP version from '8.2' to '8.1' in the Phan configuration file. This adjustment ensures the tool runs under the appropriate PHP version, improving overall analysis. Remember to align this setting with the PHP versions your project supports, or consider running Phan for each supported version. * Enable dead_code_detection in Phan config This commit enables the `dead_code_detection` setting in Phan config. This change will help in identifying unused or redundant code bits, thereby improving the cleanliness and maintainability of the codebase. It's important to remember to scrutinize the potential false positives resulting from this setting. * Refactor Dockerfile RUN instructions The apt-get update and apt-get install commands have been combined into a single RUN instruction in all Dockerfiles. This modification helps to avoid potential caching issues. Further image size reduction could be achieved by also removing the apt cache within the same RUN instruction. * Disable dead code detection in Phan config Due to an assertion error encountered when running dead code detection on more than one core, the setting has been deactivated. This change resolves the issue by setting `'dead_code_detection'` to `false` in the Phan config file. This change will prevent similar errors from occurring when running Phan on multiple cores. * Refactor Dockerfiles for readability and maintainability This revision groups related pecl install and docker-php-ext-enable commands in all Dockerfiles. This restructuring improves the organization of the Dockerfiles, easing the task of future addition or removal of extensions.
- Loading branch information