Skip to content

Commit 2f349fa

Browse files
committed
Address issues reported by CI linter
1 parent edacd3c commit 2f349fa

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

components/filesystem.rst

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ You can pass absolute paths and relative paths to :method:`Symfony\\Component\\F
374374
When a relative path is passed, ".." segments at the beginning of the path are
375375
kept::
376376

377-
echo Path::canonicalize('../uploads/../config/config.yml');
378-
// => ../config/config.yml
377+
echo Path::canonicalize('../uploads/../config/config.yaml');
378+
// => ../config/config.yaml
379379

380380
Malformed paths are returned unchanged::
381381

@@ -392,8 +392,8 @@ and :method:`Symfony\\Component\\Filesystem\\Path::makeRelative`.
392392
:method:`Symfony\\Component\\Filesystem\\Path::makeAbsolute` expects a relative
393393
path and a base path to base that relative path upon::
394394

395-
echo Path::makeAbsolute('config/config.yml', '/var/www/project');
396-
// => /var/www/project/config/config.yml
395+
echo Path::makeAbsolute('config/config.yaml', '/var/www/project');
396+
// => /var/www/project/config/config.yaml
397397

398398
If an absolute path is passed in the first argument, the absolute path is
399399
returned unchanged::
@@ -403,8 +403,8 @@ returned unchanged::
403403

404404
The method resolves ".." segments, if there are any::
405405

406-
echo Path::makeAbsolute('../config/config.yml', '/var/www/project/uploads');
407-
// => /var/www/project/config/config.yml
406+
echo Path::makeAbsolute('../config/config.yaml', '/var/www/project/uploads');
407+
// => /var/www/project/config/config.yaml
408408

409409
This method is very useful if you want to be able to accept relative paths (for
410410
example, relative to the root directory of your project) and absolute paths at
@@ -413,14 +413,14 @@ the same time.
413413
:method:`Symfony\\Component\\Filesystem\\Path::makeRelative` is the inverse
414414
operation to :method:`Symfony\\Component\\Filesystem\\Path::makeAbsolute`::
415415

416-
echo Path::makeRelative('/var/www/project/config/config.yml', '/var/www/project');
417-
// => config/config.yml
416+
echo Path::makeRelative('/var/www/project/config/config.yaml', '/var/www/project');
417+
// => config/config.yaml
418418

419419
If the path is not within the base path, the method will prepend ".." segments
420420
as necessary::
421421

422-
echo Path::makeRelative('/var/www/project/config/config.yml', '/var/www/project/uploads');
423-
// => ../config/config.yml
422+
echo Path::makeRelative('/var/www/project/config/config.yaml', '/var/www/project/uploads');
423+
// => ../config/config.yaml
424424

425425
Use :method:`Symfony\\Component\\Filesystem\\Path::makeAbsolute` and
426426
:method:`Symfony\\Component\\Filesystem\\Path::makeRelative` to check whether a
@@ -437,25 +437,25 @@ Finding Longest Common Base Paths
437437
When you store absolute file paths on the file system, this leads to a lot of
438438
duplicated information::
439439

440-
return array(
441-
'/var/www/vhosts/project/httpdocs/config/config.yml',
442-
'/var/www/vhosts/project/httpdocs/config/routing.yml',
443-
'/var/www/vhosts/project/httpdocs/config/services.yml',
440+
return [
441+
'/var/www/vhosts/project/httpdocs/config/config.yaml',
442+
'/var/www/vhosts/project/httpdocs/config/routing.yaml',
443+
'/var/www/vhosts/project/httpdocs/config/services.yaml',
444444
'/var/www/vhosts/project/httpdocs/images/banana.gif',
445445
'/var/www/vhosts/project/httpdocs/uploads/images/nicer-banana.gif',
446-
);
446+
];
447447

448448
Especially when storing many paths, the amount of duplicated information is
449449
noticeable. You can use :method:`Symfony\\Component\\Filesystem\\Path::getLongestCommonBasePath`
450450
to check a list of paths for a common base path::
451451

452-
$paths = array(
453-
'/var/www/vhosts/project/httpdocs/config/config.yml',
454-
'/var/www/vhosts/project/httpdocs/config/routing.yml',
455-
'/var/www/vhosts/project/httpdocs/config/services.yml',
452+
$paths = [
453+
'/var/www/vhosts/project/httpdocs/config/config.yaml',
454+
'/var/www/vhosts/project/httpdocs/config/routing.yaml',
455+
'/var/www/vhosts/project/httpdocs/config/services.yaml',
456456
'/var/www/vhosts/project/httpdocs/images/banana.gif',
457457
'/var/www/vhosts/project/httpdocs/uploads/images/nicer-banana.gif',
458-
);
458+
];
459459

460460
Path::getLongestCommonBasePath($paths);
461461
// => /var/www/vhosts/project/httpdocs
@@ -465,13 +465,13 @@ to shorten the stored paths::
465465

466466
$bp = '/var/www/vhosts/project/httpdocs';
467467

468-
return array(
469-
$bp.'/config/config.yml',
470-
$bp.'/config/routing.yml',
471-
$bp.'/config/services.yml',
468+
return [
469+
$bp.'/config/config.yaml',
470+
$bp.'/config/routing.yaml',
471+
$bp.'/config/services.yaml',
472472
$bp.'/images/banana.gif',
473473
$bp.'/uploads/images/nicer-banana.gif',
474-
);
474+
];
475475

476476
:method:`Symfony\\Component\\Filesystem\\Path::getLongestCommonBasePath` always
477477
returns canonical paths.

0 commit comments

Comments
 (0)