Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request introduces PHPStan for static analysis, adding a configuration file, stubs, and comprehensive PHPDoc type hints throughout the project. It also migrates path-related utility calls to the "WP_CLI\Path" class and refactors type checks to use "instanceof". Key feedback points include the potential for compilation errors due to the removal of Blade component tag handling in "BladeGettextExtractor" and the breaking of inheritance and backward compatibility caused by renaming "multilineQuote" in "PotGenerator".
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial PHPStan setup for the i18n command package, along with a set of code/docblock adjustments and defensive runtime checks intended to make the codebase pass stricter static analysis.
Changes:
- Add a baseline
phpstan.neon.distconfiguration plus scan/stub files to model WP-CLI/Gettext types for analysis. - Wire PHPStan into the
composer testscript. - Update multiple command/extractor/generator classes with tighter PHPDoc types and additional runtime guards (e.g.,
is_array()/is_scalar()checks) to satisfy PHPStan at a higher level.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
phpstan.neon.dist |
Adds initial PHPStan configuration (level, scan paths/files, stub files). |
composer.json |
Adds @phpstan to the test script pipeline. |
tests/phpstan/scan-files.php |
Provides scan-time symbols/constants (e.g., WP_CLI_VERSION, Requests_Response) for PHPStan. |
stubs/Gettext.stub |
Adds Gettext stubs to help PHPStan understand third-party types. |
src/*.php (multiple) |
Adds PHPDoc generics/return types and defensive checks to reduce PHPStan noise and improve type safety. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.