@@ -1293,9 +1293,16 @@ 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 array<int, string> $patterns
1301+ * @phpstan-var list<string> $patterns
1302+ */
1303+ $ patterns = $ matches [0 ];
1304+
1305+ foreach ($ patterns as $ index => $ pattern ) {
12991306 if (! preg_match ('#^ ' . $ pattern . '$#u ' , $ params [$ index ])) {
13001307 throw RouterException::forInvalidParameterType ();
13011308 }
@@ -1338,9 +1345,16 @@ protected function buildReverseRoute(string $from, array $params): string
13381345 $ locale = $ params [$ placeholderCount ];
13391346 }
13401347
1341- // Build our resulting string, inserting the $params in
1342- // the appropriate places.
1343- foreach ($ matches [0 ] as $ index => $ placeholder ) {
1348+ /**
1349+ * Build our resulting string, inserting the $params in
1350+ * the appropriate places.
1351+ *
1352+ * @var array<int, string> $placeholders
1353+ * @phpstan-var list<string> $placeholders
1354+ */
1355+ $ placeholders = $ matches [0 ];
1356+
1357+ foreach ($ placeholders as $ index => $ placeholder ) {
13441358 if (! isset ($ params [$ index ])) {
13451359 throw new InvalidArgumentException (
13461360 'Missing argument for " ' . $ placeholder . '" in route " ' . $ from . '". '
0 commit comments