Skip to content

Commit 27651a5

Browse files
minor symfony#51018 [Routing] Use vsprintf instead of sprintf + unpacking (fancyweb)
This PR was merged into the 5.4 branch. Discussion ---------- [Routing] Use vsprintf instead of sprintf + unpacking | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - A very small PR "reverting" symfony#50565 and applying vimeo/psalm#9873 (comment) suggestion of using vsprintf instead. Targeting 5.4 since it "reverts" the last one but we could also decide to target 6.4. Commits ------- 2f6a355 [Routing] Use vsprintf instead of sprintf + unpacking
2 parents 0c1e73e + 2f6a355 commit 27651a5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ private function generateCompiledRoutes(): string
139139
foreach ($staticRoutes as $path => $routes) {
140140
$code .= sprintf(" %s => [\n", self::export($path));
141141
foreach ($routes as $route) {
142-
$r = array_map([__CLASS__, 'export'], $route);
143-
$code .= sprintf(" [%s, %s, %s, %s, %s, %s, %s],\n", $r[0], $r[1], $r[2], $r[3], $r[4], $r[5], $r[6]);
142+
$code .= vsprintf(" [%s, %s, %s, %s, %s, %s, %s],\n", array_map([__CLASS__, 'export'], $route));
144143
}
145144
$code .= " ],\n";
146145
}
@@ -152,8 +151,7 @@ private function generateCompiledRoutes(): string
152151
foreach ($dynamicRoutes as $path => $routes) {
153152
$code .= sprintf(" %s => [\n", self::export($path));
154153
foreach ($routes as $route) {
155-
$r = array_map([__CLASS__, 'export'], $route);
156-
$code .= sprintf(" [%s, %s, %s, %s, %s, %s, %s],\n", $r[0], $r[1], $r[2], $r[3], $r[4], $r[5], $r[6]);
154+
$code .= vsprintf(" [%s, %s, %s, %s, %s, %s, %s],\n", array_map([__CLASS__, 'export'], $route));
157155
}
158156
$code .= " ],\n";
159157
}

0 commit comments

Comments
 (0)