@@ -250,7 +250,7 @@ Its behavior is the following::
250
250
.. note ::
251
251
252
252
If you wish to canonicalize the path without checking its existence, you can
253
- use :method: `Symfony\\ Component\\ Filesystem\\ Path::canonicalize ` instead.
253
+ use :method: `Symfony\\ Component\\ Filesystem\\ Path::canonicalize ` method instead.
254
254
255
255
``makePathRelative ``
256
256
~~~~~~~~~~~~~~~~~~~~
@@ -354,13 +354,8 @@ those issues.
354
354
Canonicalization
355
355
~~~~~~~~~~~~~~~~
356
356
357
- *Canonicalization * is the transformation of a path into a normalized (the
358
- "canonical") format. You can canonicalize a path with :method: `Symfony\\ Component\\ Filesystem\\ Path::canonicalize `::
359
-
360
- echo Path::canonicalize('/var/www/vhost/webmozart/../config.ini');
361
- // => /var/www/vhost/config.ini
362
-
363
- The following modifications happen during canonicalization:
357
+ Returns the shortest path name equivalent to the given path. It applies the
358
+ following rules iteratively until no further processing can be done:
364
359
365
360
- "." segments are removed;
366
361
- ".." segments are resolved;
@@ -370,9 +365,14 @@ The following modifications happen during canonicalization:
370
365
- schemes (such as "phar://") are kept;
371
366
- replace "~" with the user's home directory.
372
367
373
- You can pass absolute paths and relative paths to :method: `Symfony\\ Component\\ Filesystem\\ Path::canonicalize `.
374
- When a relative path is passed, ".." segments at the beginning of the path are
375
- kept::
368
+ You can canonicalize a path with :method: `Symfony\\ Component\\ Filesystem\\ Path::canonicalize `::
369
+
370
+ echo Path::canonicalize('/var/www/vhost/webmozart/../config.ini');
371
+ // => /var/www/vhost/config.ini
372
+
373
+ You can pass absolute paths and relative paths to the
374
+ :method: `Symfony\\ Component\\ Filesystem\\ Path::canonicalize ` method. When a
375
+ relative path is passed, ".." segments at the beginning of the path are kept::
376
376
377
377
echo Path::canonicalize('../uploads/../config/config.yaml');
378
378
// => ../config/config.yaml
@@ -389,8 +389,8 @@ Absolute/relative paths can be converted with the methods
389
389
:method: `Symfony\\ Component\\ Filesystem\\ Path::makeAbsolute `
390
390
and :method: `Symfony\\ Component\\ Filesystem\\ Path::makeRelative `.
391
391
392
- :method: `Symfony\\ Component\\ Filesystem\\ Path::makeAbsolute ` expects a relative
393
- path and a base path to base that relative path upon::
392
+ :method: `Symfony\\ Component\\ Filesystem\\ Path::makeAbsolute ` method expects a
393
+ relative path and a base path to base that relative path upon::
394
394
395
395
echo Path::makeAbsolute('config/config.yaml', '/var/www/project');
396
396
// => /var/www/project/config/config.yaml
0 commit comments