Skip to content

Commit ac29914

Browse files
committed
minor #16531 [Filesystem] Update filesystem.rst (issamkhadiri1989)
This PR was submitted for the 6.0 branch but it was merged into the 5.4 branch instead. Discussion ---------- [Filesystem] Update filesystem.rst Hello, According to the `getLongestCommonBasePath` signature, the method accepts a variadic string parameter $paths and not an array. It means when calling the `Path::getLongestCommonBasePath` with an array, a `TypeError` occurs. I think even the PHPDoc of the `Path::getLongestCommonBasePath` should be updated too as it is mentionned that it can accept an array argument. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `6.x` for features of unreleased versions). --> Commits ------- 2ebec3b Update filesystem.rst
2 parents bdde2b8 + 2ebec3b commit ac29914

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

components/filesystem.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -438,15 +438,13 @@ Especially when storing many paths, the amount of duplicated information is
438438
noticeable. You can use :method:`Symfony\\Component\\Filesystem\\Path::getLongestCommonBasePath`
439439
to check a list of paths for a common base path::
440440

441-
$paths = [
441+
Path::getLongestCommonBasePath(
442442
'/var/www/vhosts/project/httpdocs/config/config.yaml',
443443
'/var/www/vhosts/project/httpdocs/config/routing.yaml',
444444
'/var/www/vhosts/project/httpdocs/config/services.yaml',
445445
'/var/www/vhosts/project/httpdocs/images/banana.gif',
446-
'/var/www/vhosts/project/httpdocs/uploads/images/nicer-banana.gif',
447-
];
448-
449-
Path::getLongestCommonBasePath($paths);
446+
'/var/www/vhosts/project/httpdocs/uploads/images/nicer-banana.gif'
447+
);
450448
// => /var/www/vhosts/project/httpdocs
451449

452450
Use this path together with :method:`Symfony\\Component\\Filesystem\\Path::makeRelative`

0 commit comments

Comments
 (0)