Skip to content

Commit 2ebec3b

Browse files
issamkhadiri1989javiereguiluz
authored andcommitted
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.
1 parent bdde2b8 commit 2ebec3b

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)