Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Rector invalidation in case of changes sets or rules #4902

Merged
merged 1 commit into from
Sep 3, 2023

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Sep 3, 2023

Currently, when a new rule or sets is registered, the parameters hash is the same. The FileHashComputer uses \Rector\Core\Configuration\Parameter\SimpleParameterProvider::hash() and ignored new rules/sets.

This PR fixes it 👍

@TomasVotruba TomasVotruba force-pushed the tv-fix-cache-invalidation-on-rules-and-sets branch from 126b617 to eceee6e Compare September 3, 2023 17:29
@TomasVotruba TomasVotruba merged commit 56b0d65 into main Sep 3, 2023
@TomasVotruba TomasVotruba deleted the tv-fix-cache-invalidation-on-rules-and-sets branch September 3, 2023 17:31
@samsonasik
Copy link
Member

@TomasVotruba it seems doesn't work on $rectorConfig->rules() changed, see failing test case PR:

Comment on lines +218 to +220

// for cache invalidation in case of change
SimpleParameterProvider::addParameter(Option::REGISTERED_RECTOR_RULES, $rectorClass);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomasVotruba add parameter without merge seems cause double register:

   'registered_rector_rules' => array (2)
   |  0 => 'Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector'
   |  1 => 'Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

2 participants