Filters files using a custom callback function.
Filters files based on whether their path contains or matches specific patterns.
Supports two types of patterns:
Uses OR logic: accepts if any pattern matches. Always allows directories to enable recursive traversal.
Can be used to include or exclude files based on the $negate parameter:
Filters files by directory depth.
Uses DepthOperator enum for comparison:
Filters out directories by name during recursive traversal.
This filter prevents traversal into excluded directories entirely, making it more efficient than filtering after traversal.
Filters files by type (files only, directories only, or all).
Filters files by filename using glob patterns.
Supports glob patterns like:
*.php - All PHP filesTest*.php - Files starting with Test{foo,bar}.php - foo.php or bar.phpCan be used to include or exclude files based on the $negate parameter:
Filters files by matching glob patterns against relative paths.
Supports patterns like:
src/**\/*.php - Recursive matchingtests/**\/*Test.php - Files ending with Test.php*.md - Files in root directoryFilters out hidden files and directories (those starting with a dot).
Prevents descending into symbolic links that would cause an infinite loop.
When symbolic links are followed, a link pointing to one of the directories currently being traversed (for example, a link to its own parent) would be descended into forever. This iterator keeps track of the directories from the root down to the current one and refuses to descend into a link whose target is already part of that chain.
The link itself is still returned as an entry.