-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Filesystem] Add documentation for the Path class #15759
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
This is a first iteration of the documentation. I'm not very familiar with the documentation workflow/process neither with its conventions regarding the doc organisation or choice of vocabulary so I have no doubt that a few changes will be needed there |
/cc @chalasr |
The component contains two classes: | ||
|
||
- The :class:`Symfony\\Component\\Filesystem\\Filesystem` which provides utilities | ||
for filesystem write operations. |
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.
Not only write, right?
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.
Théo, thanks for this contribution! I left some minor comments, but your work is really nice and it will be mergeable very soon. Thanks!
@@ -236,6 +247,11 @@ Its behavior is the following:: | |||
* if ``$path`` does not exist, it returns null. | |||
* if ``$path`` exists, it returns its absolute fully resolved final version. | |||
|
|||
.. note:: | |||
|
|||
If you wish to canonicalize the path without checking its existence, you can |
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.
Reading this might be confusing if you don't know what "canonicalize the path" exactly means.
|
||
- "." segments are removed; | ||
- ".." segments are resolved; | ||
- backslashes ("\") are converted into forward slashes ("/"); |
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.
Is this "backslash to forward-slash" transform applied unconditionally? Even on Windows?
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.
IIRC yes, the idea being you should compare normalized paths (there is a Path::normalize()) method as otherwise you are always susceptible to surprises (e.g. to expect a certain hard-coded unix style path but you are on Windows hence the path you are comparing to is invalid)
99769c8
to
8a928d8
Compare
8a928d8
to
165244e
Compare
Thanks Théo for contributing not only this feature but its docs as well 🙏 |
Closes #15621