From 4609c89c6eb4709a495bdb3ea4448b49199d6483 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Sat, 13 Jul 2024 16:25:58 +0800 Subject: [PATCH] wip Signed-off-by: Mior Muhammad Zaki --- composer.json | 4 ++-- src/Concerns/CanServeSite.php | 16 ++++++++++++---- src/TestCase.php | 3 ++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 14ce40a..9b59b6e 100644 --- a/composer.json +++ b/composer.json @@ -42,8 +42,8 @@ "laravel/dusk": "^8.1", "laravel/serializable-closure": "^1.0", "orchestra/dusk-updater": "^2.4", - "orchestra/testbench": "^9.1.2", - "orchestra/testbench-core": ">=9.1.3 <9.2.0", + "orchestra/testbench": "^9.2", + "orchestra/testbench-core": "9.x-dev", "php-webdriver/webdriver": "^1.15.1", "symfony/polyfill-php83": "^1.28" }, diff --git a/src/Concerns/CanServeSite.php b/src/Concerns/CanServeSite.php index cf0499e..9533d39 100644 --- a/src/Concerns/CanServeSite.php +++ b/src/Concerns/CanServeSite.php @@ -103,9 +103,13 @@ public function beforeServingApplication(Closure|string $closure): void $app = $this->app; after_resolving($app, 'config', function ($config, $app) use ($closure) { + /** + * @var \Illuminate\Foundation\Application $app + * @var \Illuminate\Contracts\Config\Repository $config + */ \is_string($closure) && method_exists($this, $closure) - ? $this->{$closure}($app, $config) - : value($closure, $app, $config); + ? call_user_func([$this, $closure], $app, $config) // @phpstan-ignore argument.type + : value($closure, $app, $config); // @phpstan-ignore argument.type }); static::$server?->stash([ @@ -177,9 +181,13 @@ public function createServingApplicationForDuskServer(DuskServer $server) $closure = \is_string($serializedClosure) ? $serializedClosure : $serializedClosure->getClosure(); after_resolving($app, 'config', function ($config, $app) use ($closure) { + /** + * @var \Illuminate\Foundation\Application $app + * @var \Illuminate\Contracts\Config\Repository $config + */ \is_string($closure) && method_exists($this, $closure) - ? $this->{$closure}($app, $config) - : value($closure, $app, $config); + ? call_user_func([$this, $closure], $app, $config) // @phpstan-ignore argument.type + : value($closure, $app, $config); // @phpstan-ignore argument.type }); } diff --git a/src/TestCase.php b/src/TestCase.php index cad9daf..76ed8ca 100644 --- a/src/TestCase.php +++ b/src/TestCase.php @@ -227,7 +227,8 @@ protected function registerShutdownFunction() * @param \Illuminate\Foundation\Application $app * @return void */ - private function resolveApplicationResolvingCallback($app): void + #[\Override] + protected function resolveApplicationResolvingCallback($app): void { $app->bind( 'Illuminate\Foundation\Bootstrap\LoadConfiguration',