@@ -1293,9 +1293,15 @@ protected function fillRouteParams(string $from, ?array $params = null): string
12931293 return '/ ' . ltrim ($ from , '/ ' );
12941294 }
12951295
1296- // Build our resulting string, inserting the $params in
1297- // the appropriate places.
1298- foreach ($ matches [0 ] as $ index => $ pattern ) {
1296+ /**
1297+ * Build our resulting string, inserting the $params in
1298+ * the appropriate places.
1299+ *
1300+ * @var string[] $patterns
1301+ */
1302+ $ patterns = $ matches [0 ];
1303+
1304+ foreach ($ patterns as $ index => $ pattern ) {
12991305 if (! preg_match ('#^ ' . $ pattern . '$#u ' , $ params [$ index ])) {
13001306 throw RouterException::forInvalidParameterType ();
13011307 }
@@ -1338,9 +1344,15 @@ protected function buildReverseRoute(string $from, array $params): string
13381344 $ locale = $ params [$ placeholderCount ];
13391345 }
13401346
1341- // Build our resulting string, inserting the $params in
1342- // the appropriate places.
1343- foreach ($ matches [0 ] as $ index => $ placeholder ) {
1347+ /**
1348+ * Build our resulting string, inserting the $params in
1349+ * the appropriate places.
1350+ *
1351+ * @var string[] $placeholders
1352+ */
1353+ $ placeholders = $ matches [0 ];
1354+
1355+ foreach ($ placeholders as $ index => $ placeholder ) {
13441356 if (! isset ($ params [$ index ])) {
13451357 throw new InvalidArgumentException (
13461358 'Missing argument for " ' . $ placeholder . '" in route " ' . $ from . '". '
0 commit comments