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

Skip to content

Commit 331be37

Browse files
committed
remove uneeded wrap
1 parent b10032f commit 331be37

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Symfony/Component/Finder/Gitignore.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static function toRegex(string $gitignoreFileContent): string
5555
private static function lineToRegex(string $gitignoreLine): string
5656
{
5757
if ('' === $gitignoreLine) {
58-
return '(?:$f)'; // always false
58+
return '$f'; // always false
5959
}
6060

6161
$slashPos = strpos($gitignoreLine, '/');
@@ -80,10 +80,8 @@ private static function lineToRegex(string $gitignoreLine): string
8080
return $v;
8181
}, explode('/', $gitignoreLine));
8282

83-
return '(?:'
84-
.($isAbsolute ? '' : '(?:[^/]+/)*')
83+
return ($isAbsolute ? '' : '(?:[^/]+/)*')
8584
.implode('/', $parts)
86-
.('' !== end($parts) ? '(?:$|/)' : '')
87-
.')';
85+
.('' !== end($parts) ? '(?:$|/)' : '');
8886
}
8987
}

0 commit comments

Comments
 (0)