Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fc745f4

Browse filesBrowse files
committed
Remove unnecessary if construct
If `0 === $depth` evaluates to true `str_repeat('../', $depth)` would result in the empty string anyway, so there is no need to handle this case.
1 parent 2adfb37 commit fc745f4
Copy full SHA for fc745f4

File tree

1 file changed

+2
-7
lines changed
Filter options

1 file changed

+2
-7
lines changed

‎src/Symfony/Component/Filesystem/Filesystem.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/Filesystem.php
+2-7Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,13 +400,8 @@ public function makePathRelative($endPath, $startPath)
400400
$depth = count($startPathArr) - $index;
401401
}
402402

403-
// When we need to traverse from the start, and we are starting from a root path, don't add '../'
404-
if ('/' === $startPath[0] && 0 === $index && 0 === $depth) {
405-
$traverser = '';
406-
} else {
407-
// Repeated "../" for each level need to reach the common path
408-
$traverser = str_repeat('../', $depth);
409-
}
403+
// Repeated "../" for each level need to reach the common path
404+
$traverser = str_repeat('../', $depth);
410405

411406
$endPathRemainder = implode('/', array_slice($endPathArr, $index));
412407

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.