Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Filesystem] Improve exists() behaviour to be able to differentiate files/dirs#34037

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
jejem wants to merge7 commits intosymfony:4.4fromjejem:filesystem-enhancement
Closed

[Filesystem] Improve exists() behaviour to be able to differentiate files/dirs#34037

jejem wants to merge7 commits intosymfony:4.4fromjejem:filesystem-enhancement

Conversation

jejem
Copy link

QA
Branch?4.4
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#33873
LicenseMIT
Doc PRsymfony/symfony-docs#12516

The current implementation of Filesystem::exists allowed to check whether a file is present on the filesystem, without any kind of distinction on the file type, so it is blind about the fact that it can be a file, directory, symlink, socket, ...

The new (optional) second argument allows to specify whether we want to check against a specific file type. I used the standard Unix/POSIX file types definition (seehttps://en.wikipedia.org/wiki/Unix_file_types), and implemented regular/directory. Class constants were added to list/use the available file types.

The change is BC and didn't alter the default/previous behaviour. I already pushed a usage example in the associated documentation.

@xabbuh
Copy link
Member

What about not having this implemented as options to be passed to theexists() method but having dedicated methods for this that are named similarly to the existingis_file() andis_dir() functions in PHP? So something likeisFile()/isDir() orfileExists()/dirExists()?

ro0NL and javiereguiluz reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

I'm closing becauseis_dir() andis_file() are just fine. The component doesn't need to re-implement the native function that are working well enough.
Thanks for opening.

@nicolas-grekasnicolas-grekas modified the milestones:next,5.1May 4, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof left review comments

@OskarStarkOskarStarkOskarStark left review comments

@darielopperdarielopperdarielopper approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.1
Development

Successfully merging this pull request may close these issues.

Filesystem class improvement
7 participants
@jejem@xabbuh@nicolas-grekas@stof@OskarStark@darielopper@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp