Skip to content

Commit dda78e3

Browse files
minor #48793 Leverage arrow function syntax for closure (tigitz)
This PR was merged into the 6.3 branch. Discussion ---------- Leverage arrow function syntax for closure | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #47658 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | <!-- required for new features --> Rationale in the RFC [here](https://wiki.php.net/rfc/arrow_functions_v2#introduction) It's also notable that using arrow function syntax rather than the classic one has been enforced in the past by symfony core member: symfony/symfony#48069 (comment) So this PR would be consistent. Commits ------- f5802d3a2a Leverage arrow function syntax for closure
2 parents 06d782b + 698728a commit dda78e3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Filesystem.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,9 @@ public function makePathRelative(string $endPath, string $startPath): string
438438
$startPath = str_replace('\\', '/', $startPath);
439439
}
440440

441-
$splitDriveLetter = function ($path) {
442-
return (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0]))
443-
? [substr($path, 2), strtoupper($path[0])]
444-
: [$path, null];
445-
};
441+
$splitDriveLetter = fn ($path) => (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0]))
442+
? [substr($path, 2), strtoupper($path[0])]
443+
: [$path, null];
446444

447445
$splitPath = function ($path) {
448446
$result = [];

0 commit comments

Comments
 (0)