Skip to content

Patch scoped Recursive rule set lookup on PhpCsFixer RuleSet::resolveSubset()#305

Closed
samsonasik wants to merge 3 commits into
mainfrom
patch-recursive-rule-set
Closed

Patch scoped Recursive rule set lookup on PhpCsFixer RuleSet::resolveSubset()#305
samsonasik wants to merge 3 commits into
mainfrom
patch-recursive-rule-set

Conversation

@samsonasik

Copy link
Copy Markdown
Collaborator

@kamilmmach @arderyp this is a patch I can found for now. The PhpCsFixer -> RuleSet::resolveSubset() make recursive lookup, which somehow lookup apply prefixed namespace after it resolved, which should not.

Fixes https://github.com/easy-coding-standard/easy-coding-standard/issues/303

@samsonasik

samsonasik commented Oct 29, 2025

Copy link
Copy Markdown
Collaborator Author

@kamilmmach @arderyp could you verify manually patch prefixed vendor:

vendor/symplify/easy-coding-standard/vendor/friendsofphp/php-cs-fixer/src/RuleSet/RuleSet.php

with apply this patch

https://github.com/easy-coding-standard/easy-coding-standard/pull/305/files#diff-8ed6be1ba0632a8e2d192fd1063ed47fcd404f6f277603ffd086875d6ad54b80

Thank you.

@kamilmmach

Copy link
Copy Markdown

@samsonasik After applying the patch everything works as it should. Thank you!

@samsonasik

Copy link
Copy Markdown
Collaborator Author

It seems it cause issue on other name: phpunit43MigrationRisky -> @PHPUnitECSPrefix2025104x3Migration:risky, so I guess the str_contains() should be used instead.

@samsonasik

Copy link
Copy Markdown
Collaborator Author

Now, the issue is when we define:

    ->withPhpCsFixerSets(php84Migration: true)

the result of:

        $rules = $ruleSet->getRules();

is:

array (1)
   '@PHPECSPrefix2025108x4Migration' => true

which seems should not.

@samsonasik

Copy link
Copy Markdown
Collaborator Author

Okay, it seems the issue is on AbstractMajorMinorDeprecationSetDefinition

On version 12.6.1 it shows

https://github.com/easy-coding-standard/easy-coding-standard/blob/572539abbfd46a74c715fed4f63b638230980029/vendor/friendsofphp/php-cs-fixer/src/RuleSet/AbstractMajorMinorDeprecationSetDefinition.php#L27

which not exists in 12.6.0

@samsonasik

Copy link
Copy Markdown
Collaborator Author

Closing this, will create new PR for real patch.

@samsonasik samsonasik closed this Oct 29, 2025
@samsonasik samsonasik deleted the patch-recursive-rule-set branch October 29, 2025 08:33
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.

Exception when withPhpCsFixerSets(php84Migration: true) is used after 12.6.1 upgrade

2 participants