Repository navigation
Conversation
Projects passing a custom Finder lost the default excludes: PhpCsFixer\Finder lints gitignored files and walks .cache/node_modules, which made IxDF-web runs take ~60s and OOM workers on generated PHP in storage/. - Make the default Finder public so projects extend instead of replace it - Stop excluding public/: it holds tracked code like public/index.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
A project that needs one extra exclude has to replace the default Finder, and with it every default exclude:
PhpCsFixer\Finderdoes not skip gitignored files, so this Finder goes into.cache/,node_modules/andstorage/. In IxDF-web the search alone took about 60s (.cache/holds 1.7M files). It also picked up generated PHPStan cache files instorage/, one of them 1.5MB, and php-cs-fixer workers ran out of memory on them at the default 128M (Allowed memory size of 134217728 bytes exhausted). Everycomposer csfailed after about a minute of no output. The README's customization example showed exactly this pattern, and this package's own.php-cs-fixer.dist.phpfollowed it.Solution
The default Finder is now public as
Config::finder(), so projects extend it instead of replacing it:The README example and this package's own config now use it. On IxDF-web, the same exclusion rules cut a php-cs-fixer run with a warm cache from about 60s to 2s, with no out-of-memory crash.
public/is no longer excluded by default: it holds tracked code such as Laravel'spublic/index.php, and gitignored build output in it is still skipped byignoreVCSIgnored(). Projects that want it out can add->exclude(['public']).Config::create()does not patch a Finder you pass in. AddingignoreVCSIgnored()alone would not fix the speed (Symfony filters ignored files only after walking into them; onlyexclude()stops the walk), and changing a caller's object would leave no way to opt out.