Skip to content

Rector --only seems to interact weirdly with the cache #9538

Closed

Description

@theofidry

Bug Report

Subject Details
Rector version 2.2.11

Minimal PHP Code Causing Issue

While working on alice, I executed:

vendor-bin/rector/bin/rector --dry-run
vendor-bin/rector/bin/rector --only=GetDebugTypeRector --dry-run # did not show any change
vendor-bin/rector/bin/rector --only=GetDebugTypeRector --dry-run --clear-cache # showed up changes!

Expected Behaviour

I'm ensure how the cache works there, but I expect using --only=Rule to apply the rule on any relevant file, with our without a clean cache.

Activity

  1. samsonasik commented on Dec 6, 2025

    @samsonasik
    Member

    Yeah, that's expected, when using --only, the --clear-cache should always be used. See the whole discussion on #9485

  2. theofidry commented on Dec 6, 2025

    @theofidry
    Author

    Ha I see.

    I did think there is a lot that could be done and is tricky on the rector cache...

    I assume pushing another cache entry is not that simple? Would disabling the cache for --only be an option then?

  3. samsonasik commented on Dec 6, 2025

    @samsonasik
    Member

    Yeah, that complicated per original kick of PR:

    user will do: run --only, then run normal rector, then run --only again, that the "last" flag need to be saved to another cache

  4. theofidry commented on Dec 6, 2025

    @theofidry
    Author

    Indeed that would require more primitives with the cache, e.g. defining whether to use it at all or add additional parameters for the cache keys... Which obviously is a lot more work.

    Feel free to close it if it's not an issue that is planned to be fixed in a foreseeable future.

  5. samsonasik commented on Dec 6, 2025

    @samsonasik
    Member

    Yes, thank you for understanding ;)

  6. github-actions commented on May 10, 2026

    @github-actions
    Contributor

    This issue has been automatically locked because it has been closed for 150 days. Please open a new issue if you have a similar problem.

  7. locked as resolved and limited conversation to collaborators on May 10, 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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions