Skip to content

Fix Rector findings and run rector:check in CI #587

Closed

Description

@armanist

Summary

composer rector:check fails on master (22 files would change), and CI does not run it, so the findings were never caught. Fix them and add the check to the workflow so they stay fixed.

Current state (checked on master)

  • vendor/bin/rector process --dry-run reports 22 files:
    • IfToNullCoalescingAssignRector (17): if (!isset($x)) { $x = … } becomes $x ??= … in the factories (App, Archive, Auth, Cache, Captcha, Encryption, Logger, Mailer, RateLimit, Renderer, Session, FileSystem), Config, DebuggerStore, DiContainer, SleekDbal and Validator.
    • BinaryOpNullableToInstanceofRector (3): AssetManager, Config, FileAdapter.
    • Return types (2 files): env(): mixed, and CurlAdapter::getId(): int and CurlAdapter::getResponseCookies(): array.
  • .github/workflows/php.yml runs composer cs:check and composer phpstan, but not composer rector:check, although the script exists in composer.json.

Proposed change

  1. Apply the findings with composer rector:fix, then composer cs:fix.
  2. Review the return-type changes in CurlAdapter and env() by hand against their interfaces, subclasses and docblocks; keep or drop each one deliberately.
  3. Add a Run Rector step (composer rector:check) to php.yml, right after Run PHPStan.

Breaking changes

None expected. The refactors are behavior-preserving. The new return types are the only change visible to callers, hence the manual review in step 2.

Tests

  • composer test passes unchanged; the findings must not need test edits.
  • composer rector:check, composer cs:check and composer phpstan pass.

Acceptance criteria

  • composer rector:check exits 0 on the branch.
  • The workflow runs it after PHPStan, and CI is green on PHP 8.0, 8.1 and 8.2.

Out of scope

  • Adding or enabling new Rector sets.
  • The same step in quantum-php/project, which gets its own change.

Activity

  1. added this to the 3.1.0 milestone on Oct 19, 2026
  2. added 2 commits that reference this issue on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions