-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Filesystem] Add the Path class #41954
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
Conversation
67755b1
to
aaa6d2a
Compare
src/Symfony/Component/Filesystem/Exception/RuntimeArgumentException.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Still pretty sure there are some places in core that could leverage this. That might be for another PR though.
I am not familiar enough with the code-base to spot those. But as a rule of thumb, I would keep the current usages of |
Can you please target 🎯 6.0, as we are not allowed to introduce experimental classes in an LTS version. |
@OskarStark is correct. We cannot have experimental code in LTS. However, we can make this new class non-experimental. It is a well used class outside of Symfony as the PR description tells. @theofidry, Do what you prefer. |
Since this has already proven useful and it’s not controversial, I vote for 5.4 with no experimental flag. |
Please rebase :) We cannot merge PRs that contain merge commits |
cce7eb6
to
9854256
Compare
Is there a technical reason for that choice or is it just the process in place? Seems weird to have to rebase which requires a force-push from the user and completely change the commits history (which messes up the GitHub discussions) |
Yes, IIRC it's a limitation from the internal tool we use for merging, it doesn't play well with merge commits |
Just adding my two cents: This PR (including its predecessor #30969) has been open for over two years (!). It's not very motivating for a contributor to have their work pending for so long, and then being asked to make small changes, rebases etc. every few months. @theofidry rebased this 19 days ago. I think it would be a great appreciation of his work and endurance to merge this, rather than waiting again, asking for another rebase, adding more nitpick comments etc. |
3905ec6
to
512b476
Compare
Thank you @theofidry. |
Re-opening #30969 as requested by @fabpot.
This PR proposes a low-level, performant and pure API to manipulate file paths.
Two methods
Path::isAbsolute()
andPath::isRelative()
are similar toFilesystem::isAbsolutePath()
andFilesystem::makePathRelative()
. They are however different as the methods fromPath
do not check the existence of the path which is very helpful in some scenarios (for example when manipulating virtual paths such as "regular" paths of a PHAR).The original code comes from webmozart/path-util from which the path part was extracted. The library is very stable, well tested and documented. It has been heavily used in Puli, which although is no longer active has been a good performance test and is used in several other popular projects such as:
It however suffers from lack of maintener from @webmozart which no longer has time to maintain it.