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

feat: ClassMapGenerator::scanPaths can exclude specific dirs #7

Merged
merged 3 commits into from
May 2, 2024

Conversation

Gashmob
Copy link
Contributor

@Gashmob Gashmob commented Apr 20, 2024

Closes #6

Class Finder from Symfony is used to get an iterator on files matching the first argument of scanPaths. Currently if we want to exclude some files from the search we can provide a regex which will be test on each file.

Finder has a method exclude() which allow us to exclude a list of dirs relative to the one passed in in(). It does a pre-filtering much more efficient than checking the regex.

To keep backward compatibility, this new argument is added at then end of the method with a default value.

Gashmob and others added 3 commits April 20, 2024 09:20
Part of composer#6

Class Finder from Symfony is used to get an iterator on files matching
the first argument of scanPaths. Currently if we want to exclude some
files from the search we can provide a regex which will be test on each
file.

Finder has a method exclude() which allow us to exclude a list of dirs
relative to the one passed in in(). It does a pre-filtering much more
efficient than checking the regex.

To keep backward compatibility, this new argument is added at then end
of the method with a default value.
@Gashmob
Copy link
Contributor Author

Gashmob commented May 2, 2024

Thanks for the changes. Is the phpstan errors on unchanged code normal?

@Seldaek Seldaek merged commit a96c53d into composer:main May 2, 2024
7 of 9 checks passed
@Seldaek
Copy link
Member

Seldaek commented May 2, 2024

Yup ignore the errors, they're from new phpstan versions, I'll get those fixed on main later.

@Seldaek
Copy link
Member

Seldaek commented May 2, 2024

As for the PR, thanks, looks good to me, but I do wonder in terms of implementing this in Composer perhaps.. if you pass in ['tests'] for example, it seems to me like it will also exclude src/foo/tests? That seems very risky to me.

@Seldaek
Copy link
Member

Seldaek commented May 2, 2024

Seems like it is indeed an issue in symfony/finder.. symfony/symfony#47431 symfony/symfony#54752

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.

Get package classmap without vendor
2 participants