From 5cb3316db7c0da382d6893de8c6e17032e51fb4d Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Mon, 23 Jun 2025 16:04:40 -0300 Subject: [PATCH 1/3] Add Tinker ClassAliasAutoloader register --- src/Loaders/LaravelLoader.php | 25 +++++++++++++++++++++++++ src/Tinker.php | 5 +++++ 2 files changed, 30 insertions(+) diff --git a/src/Loaders/LaravelLoader.php b/src/Loaders/LaravelLoader.php index e388061..9742c3a 100644 --- a/src/Loaders/LaravelLoader.php +++ b/src/Loaders/LaravelLoader.php @@ -18,6 +18,13 @@ public function __construct(string $path) $this->app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); } + public function init(): void + { + parent::init(); + + $this->bootAliases(); + } + public function name(): string { return 'Laravel'; @@ -50,4 +57,22 @@ public function casters(): array return $casters; } + + private function bootAliases(): void + { + if (! class_exists(\Laravel\Tinker\ClassAliasAutoloader::class)) { + return; + } + + $config = $this->app->make('config'); + + $path = \Illuminate\Support\Env::get('COMPOSER_VENDOR_DIR', $this->app->basePath().DIRECTORY_SEPARATOR.'vendor'); + + \Laravel\Tinker\ClassAliasAutoloader::register( + $this->tinker->getShell(), + $path.'/composer/autoload_classmap.php', + $config->get('tinker.alias', []), + $config->get('tinker.dont_alias', []) + ); + } } diff --git a/src/Tinker.php b/src/Tinker.php index 02d9cb7..ccc4d07 100644 --- a/src/Tinker.php +++ b/src/Tinker.php @@ -85,4 +85,9 @@ protected function cleanOutput(string $output): string return trim($output); } + + public function getShell(): Shell + { + return $this->shell; + } } From 92df6fdae4fe9b1299155ee55fafb4419517b01b Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Mon, 23 Jun 2025 16:09:18 -0300 Subject: [PATCH 2/3] Update GitHub Actions checkout to version 4 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b4bb846..3e2c59f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP for Current Version uses: shivammathur/setup-php@v2 From 7cd34f3a0e03d06f93f93f109bca59773b6b7791 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Mon, 23 Jun 2025 16:10:49 -0300 Subject: [PATCH 3/3] Update GitHub Actions to use version 4 for checkout and cache --- .github/workflows/code-style.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index e1fc6a4..e279458 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -17,7 +17,7 @@ jobs: node-version: [ "20.x" ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -26,7 +26,7 @@ jobs: - name: Cache Composer packages id: composer-cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}