Skip to content

Refactor: Improve type hints and upgrade PHPStan to level 6#17

Closed
insign wants to merge 1 commit intomainfrom
refactor/type-hints-phpstan-level-6-6364721061526976839
Closed

Refactor: Improve type hints and upgrade PHPStan to level 6#17
insign wants to merge 1 commit intomainfrom
refactor/type-hints-phpstan-level-6-6364721061526976839

Conversation

@insign
Copy link
Contributor

@insign insign commented Feb 14, 2026

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 in Rclone.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 in redactContext where keys were lost during redaction; replaced array_map implementation 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 for getConfig.
  • src/ProgressParser.php: Added return type hints.
  • src/Exception/RcloneException.php: Added type hints for context handling.

Verification:

  • phpstan analyse passes with no errors at level 6.
  • Syntax checked with php -l.

PR created automatically by Jules for task 6364721061526976839 started by @insign

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.
@google-labs-jules
Copy link

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@insign insign closed this Feb 15, 2026
@insign insign deleted the refactor/type-hints-phpstan-level-6-6364721061526976839 branch February 15, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant