Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09d9b41

Browse files
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 92adf5f commit 09d9b41

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

components/filesystem.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,15 +426,13 @@ Especially when storing many paths, the amount of duplicated information is
426426
noticeable. You can use :method:`Symfony\\Component\\Filesystem\\Path::getLongestCommonBasePath`
427427
to check a list of paths for a common base path::
428428

429-
$paths = [
429+
Path::getLongestCommonBasePath(
430430
'/var/www/vhosts/project/httpdocs/config/config.yaml',
431431
'/var/www/vhosts/project/httpdocs/config/routing.yaml',
432432
'/var/www/vhosts/project/httpdocs/config/services.yaml',
433433
'/var/www/vhosts/project/httpdocs/images/banana.gif',
434-
'/var/www/vhosts/project/httpdocs/uploads/images/nicer-banana.gif',
435-
];
436-
437-
Path::getLongestCommonBasePath($paths);
434+
'/var/www/vhosts/project/httpdocs/uploads/images/nicer-banana.gif'
435+
);
438436
// => /var/www/vhosts/project/httpdocs
439437

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

0 commit comments

Comments
 (0)