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

Support for "Globstar" pattern #83

Conversation

nicDamours
Copy link

Summary

Added support for globstar pattern when resolving paths in the FileIterator Factory.

A globstar can now be added to a filter's path to recursively search for a given directory in a structure. The globstar can be use like that:

root_directory/**/target_directory

This pattern will look into every directory under root_directory, recursively, and return the path of each target_directory present in the structure.

Fixes #82

Nicolas D'Amours added 2 commits August 13, 2024 11:44
Added support for globstar when resolving paths in the FileIterator factory.
The extended glob function was adapted from funkjedi's implementation: https://gist.github.com/funkjedi/3feee27d873ae2297b8e2370a7082aad

Fixed facade test to include newly created fixture directories.
Removed unnecessary formatting changes.
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (631d535) to head (fa47ef9).
Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #83   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        38        44    +6     
===========================================
  Files              4         4           
  Lines             95       114   +19     
===========================================
+ Hits              95       114   +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sebastianbergmann
Copy link
Owner

@funkjedi This PR copies your code from https://gist.github.com/funkjedi/3feee27d873ae2297b8e2370a7082aad. Are you okay with that?

@funkjedi
Copy link

rock and roll

@sebastianbergmann sebastianbergmann changed the title [FEATURE] #82 Added support for globstar when resolving paths in the FileIterator factory. Support for "Globstar" pattern Aug 14, 2024
Nicolas D'Amours added 3 commits August 14, 2024 08:25
Fixed static code analysis errors.
Added check to make sure $files isn't false when sorting the array. Otherwise, we return an empty array.
Ignore coverage for the last line of the globstar function, since it's only used if the glob function returns an error.
Added a test to validate the behaviour of the globstar function when passing non existant glob pattern.
Fixed code using php-cs-fixer.
Fixed error reported by phpstan.
@nicDamours
Copy link
Author

I was having a pretty hard time with the GitHub checks until I realized that the tools used were in the tools folder. All the checks should be successful now.

@Wulfheart
Copy link

Would love to see this land in PHPUnit!

@sebastianbergmann sebastianbergmann merged commit 6ac080a into sebastianbergmann:main Aug 27, 2024
7 checks passed
@nicDamours nicDamours deleted the feature/#82-add-support-for-globstar-in-file-iterator-factory branch August 27, 2024 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support to resolve globstar when creating FileIterator
4 participants