From fb282b184e3f4dd19b793191e99685700f1d21ca Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 21 Jul 2025 13:32:03 +0100 Subject: [PATCH] fix: return type --- src/Support/Shell.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Support/Shell.php b/src/Support/Shell.php index d7fbafd2..0f9c9d55 100644 --- a/src/Support/Shell.php +++ b/src/Support/Shell.php @@ -4,9 +4,9 @@ declare(strict_types=1); namespace Pest\Support; -use Composer\Autoload\ClassLoader; use Illuminate\Support\Env; use Laravel\Tinker\ClassAliasAutoloader; +use Pest\TestSuite; use Psy\Configuration; use Psy\Shell as PsyShell; use Psy\VersionUpdater\Checker; @@ -34,7 +34,7 @@ final class Shell try { $shell->run(); } finally { - $loader?->unregister(); + $loader?->unregister(); // @phpstan-ignore-line } } @@ -75,7 +75,7 @@ final class Shell /** * Tinkers the current shell, if the Tinker package is available. */ - private static function tinkered(PsyShell $shell): ?ClassLoader + private static function tinkered(PsyShell $shell): ?object { if (function_exists('app') === false || ! class_exists(Env::class) @@ -88,6 +88,10 @@ final class Shell $path .= '/composer/autoload_classmap.php'; + if (! file_exists($path)) { + $path = TestSuite::getInstance()->rootPath.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'composer'.DIRECTORY_SEPARATOR.'autoload_classmap.php'; + } + $config = app()->make('config'); $loader = ClassAliasAutoloader::register(