Skip to content

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

Merged
TomasVotruba merged 1 commit intomainfrom
tv-fix-cache-invalidation-on-rules-and-sets
Sep 3, 2023
Merged

Fix Rector invalidation in case of changes sets or rules#4902
TomasVotruba merged 1 commit intomainfrom
tv-fix-cache-invalidation-on-rules-and-sets

Conversation

@TomasVotruba
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

2 participants