[dx] log rules registered in both withRules() and sets, keep them once to avoid duplications or invalid use#6761
Conversation
7c13d2e to
d6d0351
Compare
|
By this, this config will no longer working: <?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
return RectorConfig::configure()
// A. whole set
->withPreparedSets(typeDeclarations: true)
// B. or few rules
->withRules([
TypedPropertyFromAssignsRector::class
]);for default demo page config https://getrector.com/demo However, when <?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
return RectorConfig::configure()
// A. whole set
->withPreparedSets(typeDeclarations: true)
// B. OVERRIDE RULE
->withConfiguredRule(TypedPropertyFromAssignsRector::class, [
'inline_public' => true,
]);ref https://getrector.com/demo/c74dab61-ff51-47fe-9391-f14bc34fc84a this also needs test for configurable rule registered multiple times to keep working, eg: multiple config included with configurable rules. |
|
The first example is mutually exclusive. Either use A, or B. Not together. For second use case, I think the configured rules are now skipped, as |
|
No..., withRules() accept configurable rule with default config, so when collect rules, |
…e to avoid duplications or invalid use
d6d0351 to
03088fa
Compare
f68c17d to
ff6ad47
Compare
|
I've just tagged a new Rector release https://github.com/rectorphp/rector-src/releases/tag/2.0.10, Let's ship it :) |
|
@TomasVotruba I'm getting this warning, although I'm only using sets: [WARNING] These rules are registered in both sets and "withRules()". Remove them from "withRules()" to avoid ->withPhp74Sets()
->withSets([
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::TYPE_DECLARATION,
SetList::CODE_QUALITY,
TwigSetList::TWIG_112,
TwigSetList::TWIG_127,
TwigSetList::TWIG_134,
TwigSetList::TWIG_140,
]) |
|
I can reproduce: It seems due to that's should not happen as it should uniquely set, it probably due to it re-merged on -return RectorConfig::configure()->withRules([SimpleFunctionAndFilterRector::class]);
+return static function (RectorConfig $rectorConfig): void {
+ $rectorConfig->rule(SimpleFunctionAndFilterRector::class);
+};config, but that's seems will cause keep issue on rector extension, as more and more of them may use new syntax of |
|
This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work. |
No description provided.