Skip to content

Commit c886862

Browse files
committed
[Routing] Use vsprintf instead of sprintf + unpacking
1 parent 56bfc13 commit c886862

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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)