final class StubFileScanner (View source)

Recursively finds files under a directory using scandir().

Why not RecursiveDirectoryIterator? Over the Docker Desktop (Windows) bind mount — gRPC-FUSE/virtiofs — the SPL directory iterators (RecursiveDirectoryIterator, DirectoryIterator) return a TRUNCATED listing: the head of each directory stream is silently dropped, so whole extension directories (Core, curl, dom, FFI, ...) vanish from the scan. The affected files are never read, never parsed, and never make it into the generated Stubs*.json / PhpStormStubsMap.php / meta references — with no error, because the files are never even discovered. scandir() reads the whole directory in a single call and is not affected, so it is the single source of truth for tree traversal in this codebase.

Methods

static array
collect(string $root, callable $accept, callable $descend)

Recursively collect file paths under $root.

Details

static array collect(string $root, callable $accept, callable $descend)

Recursively collect file paths under $root.

Parameters

string $root

Directory to scan.

callable $accept

Return true to include a file.

callable $descend

Return true to recurse into a subdirectory; use it to prune directories (e.g. vendor, tests).

Return Value

array

Matching file paths in filesystem-native (unsorted) order; callers that need determinism should sort the result.