Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Added) Addition of Psalm Static Analysis (#25)
* Add Psalm and its PHPUnit plugin with corresponding test scripts Added "vimeo/psalm" and "psalm/plugin-phpunit" as dependencies in composer.json. Corresponding test scripts "@test:psalm" and "test:psalm" have also been added to the scripts and scripts-description sections respectively. This update is part of an effort to improve code quality and error detection. * Replace Phan with Vimeo Psalm and Psalm plugin PHPUnit in localTest.sh The local testing script now uses Vimeo's Psalm for static analysis instead of Phan. Additionally, the Psalm PHPUnit plugin is also incorporated for more comprehensive testing and static analysis of the PHPUnit tests. * Enable Psalm static analysis in GitHub workflow Uncommented the section in the workflow file that runs static analysis with Psalm. This action is triggered once the Phan static analysis is successful. This modification allows for a more comprehensive code review process. * Add new psalm.xml configuration file The new psalm.xml file includes specific configurations for error level, schema location, unused baseline entry, unused code, and taint analysis. It also provides settings for project files, plugins, and handling of specific code issues. * Suppress psalm warnings in Trace.php We have added `@psalm-suppress PossiblyUnusedMethod` annotations in multiple function definitions within Trace.php. This is to disregard psalm warnings for methods which might seem unused but are actually necessary for the codebase. * Add ForbiddenCode handler in Psalm configuration The ForbiddenCode handler has been introduced to the Psalm configuration to enforce a project-wide prohibition of certain dangerous functions like eval(). This is aimed at enhancing the application's security and preventing accidental use of such potentially harmful functions. * Update Psalm configuration for PossiblyUnusedMethod The commit introduces a suppression rule in the Psalm configuration (psalm.xml) for the PossiblyUnusedMethod warning. This change eliminates the need for individual method-level suppression annotations in the code, leading to cleaner code and centralized management of suppression rules.
- Loading branch information