Skip to content

Conversation

@browner12
Copy link
Contributor

we already have files(), allFiles(), and directories(), so this method completes the set and allows us to recursively get all directories within a given path.

both files() and allFiles() return an array of SplFileInfo objects, while directories() maps the results to the path name and returns an array of strings. I was torn between wanting to be consistent with the directories() method here, but also wanting to return the full object to allow the calling code to decide what it needed. Ideally all 4 methods would return an array of SplFileInfo objects, but that would be a BC. I landed on providing the objects back, but open to suggestions.

we already have `files()`, `allFiles()`, and `directories()`, so this method completes the set and allows us to recursively get all directories within a given path.
@shaedrich
Copy link
Contributor

shaedrich commented Oct 28, 2025

adding folders(): SplFileInfo[] additionally to directories(): string[] (and allFolders(): SplFileInfo[] vs allDirectories(): string[] respectively) would probably confuse people—what do you think?

@jmarble
Copy link

jmarble commented Oct 28, 2025

I agree with @shaedrich -- I think allDirectories() should return an array of strings just like directories()

@taylorotwell
Copy link
Member

Yeah probably should return strings.

@taylorotwell taylorotwell marked this pull request as draft October 28, 2025 19:21
@browner12 browner12 marked this pull request as ready for review October 28, 2025 21:04
@taylorotwell taylorotwell merged commit 70b2c87 into laravel:12.x Oct 29, 2025
66 checks passed
@browner12 browner12 deleted the AB-file-facade-all-directories branch October 29, 2025 15:09
shaedrich added a commit to shaedrich/framework that referenced this pull request Oct 29, 2025
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.

5 participants