Refactor: Improve type hints and upgrade PHPStan to level 6#17
Refactor: Improve type hints and upgrade PHPStan to level 6#17
Conversation
Upgraded PHPStan configuration to level 6 and resolved reported errors by adding specific array type hints (e.g., `array<string, mixed>`, `array<int, string>`) to method signatures and property docs. Improvements include: - Enhanced type safety in `Rclone`, `ProcessManager`, `CommandBuilder`, `Providers`, `FilterBuilder`, and `Logger`. - Refactored `Logger::redactContext` to correctly preserve associative array keys during recursion, fixing a bug where `array_map` with multiple arrays reindexed keys. - Updated `phpstan.neon.dist` to enforce level 6 analysis.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Improved type hints across the codebase to comply with PHPStan level 6. This involved adding specific array shape annotations (e.g.,
array<string, mixed>,array<int, string>) to methods inRclone.php,ProcessManager.php,CommandBuilder.php, and various providers.Key changes:
phpstan.neon.dist: Level raised from 5 to 6.src/Logger.php: Fixed a bug inredactContextwhere keys were lost during redaction; replacedarray_mapimplementation with a loop that preserves keys. Added strict type hints.src/Rclone.php: Added comprehensive PHPDoc type hints for methods accepting flags and returning arrays.src/Providers/*.php: Added type hints for constructors and configuration methods.src/ProcessManager.php: Added type hints for command and environment variable arrays.src/FilterBuilder.php: Clarified array types for filter patterns.src/SecretsRedactor.php: Added strict array types.src/CommandBuilder.php: Added strict array types.src/RetryHandler.php: Added return type shape forgetConfig.src/ProgressParser.php: Added return type hints.src/Exception/RcloneException.php: Added type hints for context handling.Verification:
phpstan analysepasses with no errors at level 6.php -l.PR created automatically by Jules for task 6364721061526976839 started by @insign