Skip to content

Commit b606c21

Browse files
authored
[5.x] Fix adding middleware to the web group during installation (#1577)
1 parent 0ce161d commit b606c21

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Console/InstallCommand.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,13 +609,19 @@ protected function installMiddleware($names, $group = 'web', $modifier = 'append
609609
->whenNotEmpty(function ($names) use ($bootstrapApp, $group, $modifier) {
610610
$names = $names->map(fn ($name) => "$name")->implode(','.PHP_EOL.' ');
611611

612-
$bootstrapApp = str_replace(
612+
$stubs = [
613613
'->withMiddleware(function (Middleware $middleware) {',
614-
'->withMiddleware(function (Middleware $middleware) {'
614+
'->withMiddleware(function (Middleware $middleware): void {',
615+
];
616+
617+
$bootstrapApp = str_replace(
618+
$stubs,
619+
collect($stubs)->transform(fn ($stub) => $stub
615620
.PHP_EOL." \$middleware->$group($modifier: ["
616621
.PHP_EOL." $names,"
617622
.PHP_EOL.' ]);'
618-
.PHP_EOL,
623+
.PHP_EOL
624+
)->all(),
619625
$bootstrapApp,
620626
);
621627

0 commit comments

Comments
 (0)