From a748ee998c4e5bba1ae844ad11af71854faeb224 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 25 Mar 2024 09:40:43 +0800 Subject: [PATCH 1/5] [11.x] Fixes `ApplicationBuilder::withCommandRouting()` usage. This also apply the changes from PR #50738 for `withCommandRouting()` method. Signed-off-by: Mior Muhammad Zaki --- .../Foundation/Configuration/ApplicationBuilder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php index 343786c10b18..04054ba8bd24 100644 --- a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php +++ b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php @@ -274,7 +274,9 @@ public function withCommands(array $commands = []) protected function withCommandRouting(array $paths) { $this->app->afterResolving(ConsoleKernel::class, function ($kernel) use ($paths) { - $kernel->setCommandRoutePaths($paths); + $this->app->booted(function () { + $kernel->addCommandRoutePaths($paths); + }); }); } From f4bbdedecfc0c7212c50f51a5f9829488ad02db2 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Mon, 25 Mar 2024 01:42:13 +0000 Subject: [PATCH 2/5] Apply fixes from StyleCI --- src/Illuminate/Foundation/Configuration/ApplicationBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php index 04054ba8bd24..6ed745f22eab 100644 --- a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php +++ b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php @@ -273,7 +273,7 @@ public function withCommands(array $commands = []) */ protected function withCommandRouting(array $paths) { - $this->app->afterResolving(ConsoleKernel::class, function ($kernel) use ($paths) { + $this->app->afterResolving(ConsoleKernel::class, function ($kernel) { $this->app->booted(function () { $kernel->addCommandRoutePaths($paths); }); From 855f110e1e7679cd02395fd09dada08238c49456 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 25 Mar 2024 09:42:28 +0800 Subject: [PATCH 3/5] wip Signed-off-by: Mior Muhammad Zaki --- .../Foundation/Configuration/ApplicationBuilder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php index 6ed745f22eab..1d623a09bb27 100644 --- a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php +++ b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php @@ -273,8 +273,8 @@ public function withCommands(array $commands = []) */ protected function withCommandRouting(array $paths) { - $this->app->afterResolving(ConsoleKernel::class, function ($kernel) { - $this->app->booted(function () { + $this->app->afterResolving(ConsoleKernel::class, function ($kernel) use ($paths) { + $this->app->booted(function () use ($paths) { $kernel->addCommandRoutePaths($paths); }); }); From cb60a4088ebda4d9dfcb20110fc00941f3ffaba1 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 25 Mar 2024 12:07:43 +0800 Subject: [PATCH 4/5] wip --- src/Illuminate/Foundation/Configuration/ApplicationBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php index 1d623a09bb27..de5898797c95 100644 --- a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php +++ b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php @@ -274,7 +274,7 @@ public function withCommands(array $commands = []) protected function withCommandRouting(array $paths) { $this->app->afterResolving(ConsoleKernel::class, function ($kernel) use ($paths) { - $this->app->booted(function () use ($paths) { + $this->app->booted(function () use ($kernel, $paths) { $kernel->addCommandRoutePaths($paths); }); }); From f331f7ac0ee785a180dfc545ed1e67f4a05e8249 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 25 Mar 2024 12:08:39 +0800 Subject: [PATCH 5/5] wip --- .../Foundation/Configuration/ApplicationBuilder.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php index de5898797c95..0ee659a25055 100644 --- a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php +++ b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php @@ -274,9 +274,7 @@ public function withCommands(array $commands = []) protected function withCommandRouting(array $paths) { $this->app->afterResolving(ConsoleKernel::class, function ($kernel) use ($paths) { - $this->app->booted(function () use ($kernel, $paths) { - $kernel->addCommandRoutePaths($paths); - }); + $this->app->booted(fn () => $kernel->addCommandRoutePaths($paths)); }); }