Closed driesvints closed 2 years ago
When attempting to implement the fix locally, the issue of loading commands from config/tinker.php seems to persist. It appears getLaravel()->resolve()
is private
Call to protected method Illuminate\Foundation\Application::resolve() from scope Laravel\Tinker\Console\TinkerCommand
Fixed, thanks
Fixed, thanks
@driesvints can you share the new fix?
Last commit on the repos main branch
Hi @driesvints, I get the following error when running custom commands with laravel/tinker 2.7.1
and laravel/framework 9.5.1
. With 2.7.0
it still works. Seems to be related to this fix.
PHP Error: Call to a member function make() on null in /home/vagrant/workspace/Falcon/backend/vendor/laravel/framework/src/Illuminate/Console/Command.php on line 116
This PR fixes an issue where a change in Laravel 9 broke command resolving. The culprit is https://github.com/laravel/framework/pull/34873 which adds support for lazy loading. The change causes a
null
value to be returned for commands which are suppose to be lazy loaded and therefor these commands were never resolved or added to the Tinker session.The fix I'm attempting is to use the Laravel container instance instead of the console application. What we want to achieve is to resolve all commands beforehand and add them to the Psysh shell session. Afaik Psysh has no way of handling lazy loaded commands. Therefor we need to resolve them all beforehand.
All commands started working again when I did this change. I do not know of any side effects from making this change.
Fixes https://github.com/laravel/tinker/issues/143