Skip to content

[Filesystem] remove unused makeRelative example #19107

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions components/filesystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ Especially when storing many paths, the amount of duplicated information is
noticeable. You can use :method:`Symfony\\Component\\Filesystem\\Path::getLongestCommonBasePath`
to check a list of paths for a common base path::

Path::getLongestCommonBasePath(
$basePath = Path::getLongestCommonBasePath(
'/var/www/vhosts/project/httpdocs/config/config.yaml',
'/var/www/vhosts/project/httpdocs/config/routing.yaml',
'/var/www/vhosts/project/httpdocs/config/services.yaml',
Expand All @@ -444,17 +444,14 @@ to check a list of paths for a common base path::
);
// => /var/www/vhosts/project/httpdocs

Use this path together with :method:`Symfony\\Component\\Filesystem\\Path::makeRelative`
to shorten the stored paths::

$bp = '/var/www/vhosts/project/httpdocs';
Use this path together to shorten the stored paths::

return [
$bp.'/config/config.yaml',
$bp.'/config/routing.yaml',
$bp.'/config/services.yaml',
$bp.'/images/banana.gif',
$bp.'/uploads/images/nicer-banana.gif',
$basePath.'/config/config.yaml',
$basePath.'/config/routing.yaml',
$basePath.'/config/services.yaml',
$basePath.'/images/banana.gif',
$basePath.'/uploads/images/nicer-banana.gif',
];

:method:`Symfony\\Component\\Filesystem\\Path::getLongestCommonBasePath` always
Expand Down